|
| 1 | +/* |
| 2 | +Copyright The Velero Contributors. |
| 3 | +
|
| 4 | +Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | +you may not use this file except in compliance with the License. |
| 6 | +You may obtain a copy of the License at |
| 7 | +
|
| 8 | +http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | +
|
| 10 | +Unless required by applicable law or agreed to in writing, software |
| 11 | +distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | +See the License for the specific language governing permissions and |
| 14 | +limitations under the License. |
| 15 | +*/ |
| 16 | + |
| 17 | +package cbtservice |
| 18 | + |
| 19 | +import "context" |
| 20 | + |
| 21 | +// Range defines the range of a change |
| 22 | +type Range struct { |
| 23 | + Offset int64 |
| 24 | + Length int64 |
| 25 | +} |
| 26 | + |
| 27 | +// SourceInfo is the information provided to the uploader, the uploader calls CBT service with this information |
| 28 | +type SourceInfo struct { |
| 29 | + // Snapshot is the identifier of the current snapshot |
| 30 | + Snapshot string |
| 31 | + |
| 32 | + // ChangeID is the identifier associated to the current snapshot that is used as changeID for following backups |
| 33 | + ChangeID string |
| 34 | + |
| 35 | + // VolumeID is the identifier uniquely identifier a volume in the storage to which the CBT is associated |
| 36 | + VolumeID string |
| 37 | +} |
| 38 | + |
| 39 | +// Service defines the methods for CBT service which could be implemented by Kubernetes SnapshotMetadataService or other customized services |
| 40 | +type Service interface { |
| 41 | + // GetAllocatedBlocks enumerates the allocated blocks of the snapshot and call the record callback |
| 42 | + GetAllocatedBlocks(ctx context.Context, snapshot string, record func([]Range) error) error |
| 43 | + |
| 44 | + // GetChangedBlocks enumerates the changed blocks of the snapshot since PIT of changeID and call the record callback |
| 45 | + GetChangedBlocks(ctx context.Context, snapshot string, changeID string, record func([]Range) error) error |
| 46 | +} |
0 commit comments