Skip to content

Commit aa0e11d

Browse files
committed
Added the SnapshotMetadata service.
1 parent abf6346 commit aa0e11d

File tree

4 files changed

+2920
-1602
lines changed

4 files changed

+2920
-1602
lines changed

csi.proto

+188
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,16 @@ service GroupController {
132132
}
133133
}
134134

135+
service SnapshotMetadata {
136+
option (alpha_service) = true;
137+
138+
rpc GetMetadataAllocated(GetMetadataAllocatedRequest)
139+
returns (stream GetMetadataAllocatedResponse) {}
140+
141+
rpc GetMetadataDelta(GetMetadataDeltaRequest)
142+
returns (stream GetMetadataDeltaResponse) {}
143+
}
144+
135145
service Node {
136146
rpc NodeStageVolume (NodeStageVolumeRequest)
137147
returns (NodeStageVolumeResponse) {}
@@ -220,6 +230,14 @@ message PluginCapability {
220230
// well as specific RPCs as indicated by
221231
// GroupControllerGetCapabilities.
222232
GROUP_CONTROLLER_SERVICE = 3 [(alpha_enum_value) = true];
233+
234+
// SNAPSHOT_METADATA_SERVICE indicates that the Plugin provides
235+
// RPCs to retrieve metadata on the allocated blocks of a single
236+
// snapshot, or the changed blocks between a pair of snapshots of
237+
// the same block volume.
238+
// The presence of this capability determines whether the CO will
239+
// attempt to invoke the OPTIONAL SnapshotMetadata service RPCs.
240+
SNAPSHOT_METADATA_SERVICE = 4 [(alpha_enum_value) = true];
223241
}
224242
Type type = 1;
225243
}
@@ -1913,3 +1931,173 @@ message GetVolumeGroupSnapshotResponse {
19131931
// This field is REQUIRED
19141932
VolumeGroupSnapshot group_snapshot = 1;
19151933
}
1934+
// BlockMetadata specifies a data range.
1935+
message BlockMetadata {
1936+
// This is the zero based byte position in the volume or snapshot,
1937+
// measured from the start of the object.
1938+
// This field is REQUIRED.
1939+
int64 byte_offset = 1;
1940+
1941+
// This is the size of the data range.
1942+
// size_bytes MUST be greater than zero.
1943+
// This field is REQUIRED.
1944+
int64 size_bytes = 2;
1945+
}
1946+
enum BlockMetadataType {
1947+
UNKNOWN = 0;
1948+
1949+
// The FIXED_LENGTH value indicates that data ranges are
1950+
// returned in fixed size blocks.
1951+
FIXED_LENGTH = 1;
1952+
1953+
// The VARIABLE_LENGTH value indicates that data ranges
1954+
// are returned in potentially variable sized extents.
1955+
VARIABLE_LENGTH = 2;
1956+
}
1957+
// The GetMetadataAllocatedRequest message is used to solicit metadata
1958+
// on the allocated blocks of a snapshot: i.e. this identifies the
1959+
// data ranges that have valid data as they were the target of some
1960+
// previous write operation on the volume.
1961+
message GetMetadataAllocatedRequest {
1962+
// This is the identifier of the snapshot.
1963+
// This field is REQUIRED.
1964+
string snapshot_id = 1;
1965+
1966+
// This indicates the zero based starting byte position in the volume
1967+
// snapshot from which the result should be computed.
1968+
// It is intended to be used to continue a previously interrupted
1969+
// call.
1970+
// The CO SHOULD specify this value to be the offset of the byte
1971+
// position immediately after the last byte of the last data range
1972+
// received, if continuing an interrupted operation, or zero if not.
1973+
// The SP MUST ensure that the returned response stream does not
1974+
// contain BlockMetadata tuples that end before the requested
1975+
// starting_offset: i.e. if S is the requested starting_offset, and
1976+
// B0 is block_metadata[0] of the first message in the response
1977+
// stream, then (S < B0.byte_offset + B0.size_bytes) must be true.
1978+
// This field is REQUIRED.
1979+
int64 starting_offset = 2;
1980+
1981+
// This is an optional parameter, and if non-zero it specifies the
1982+
// maximum number of tuples to be returned in each
1983+
// GetMetadataAllocatedResponse message returned by the RPC stream.
1984+
// The plugin will determine an appropriate value if 0, and is
1985+
// always free to send less than the requested value.
1986+
// This field is OPTIONAL.
1987+
int32 max_results = 3;
1988+
1989+
// Secrets required by plugin to complete the request.
1990+
// This field is OPTIONAL. Refer to the `Secrets Requirements`
1991+
// section on how to use this field.
1992+
map<string, string> secrets = 4 [(csi_secret) = true];
1993+
}
1994+
1995+
// GetMetadataAllocatedResponse messages are returned in a gRPC stream.
1996+
// Cumulatively, they provide information on the allocated data
1997+
// ranges in the snapshot.
1998+
message GetMetadataAllocatedResponse {
1999+
// This specifies the style used in the BlockMetadata sequence.
2000+
// This value must be the same in all such messages returned by
2001+
// the stream.
2002+
// If block_metadata_type is FIXED_LENGTH, then the size_bytes field
2003+
// of each message in the block_metadata list MUST be constant.
2004+
// This field is REQUIRED.
2005+
BlockMetadataType block_metadata_type = 1;
2006+
2007+
// This returns the capacity of the underlying volume in bytes.
2008+
// This value must be the same in all such messages returned by
2009+
// the stream.
2010+
// This field is REQUIRED.
2011+
int64 volume_capacity_bytes = 2;
2012+
2013+
// This is a list of data range tuples.
2014+
// If the value of max_results in the GetMetadataAllocatedRequest
2015+
// message is greater than zero, then the number of entries in this
2016+
// list MUST be less than or equal to that value.
2017+
// The SP MUST respect the value of starting_offset in the request.
2018+
// The byte_offset fields of adjacent BlockMetadata messages
2019+
// MUST be strictly increasing and messages MUST NOT overlap:
2020+
// i.e. for any two BlockMetadata messages, A and B, if A is returned
2021+
// before B, then (A.byte_offset + A.size_bytes <= B.byte_offset)
2022+
// MUST be true.
2023+
// This MUST also be true if A and B are from block_metadata lists in
2024+
// different GetMetadataAllocatedResponse messages in the gRPC stream.
2025+
// This field is OPTIONAL.
2026+
repeated BlockMetadata block_metadata = 3;
2027+
}
2028+
// The GetMetadataDeltaRequest message is used to solicit metadata on
2029+
// the data ranges that have changed between two snapshots.
2030+
message GetMetadataDeltaRequest {
2031+
// This is the identifier of the snapshot against which changes
2032+
// are to be computed.
2033+
// This field is REQUIRED.
2034+
string base_snapshot_id = 1;
2035+
2036+
// This is the identifier of a second snapshot in the same volume,
2037+
// created after the base snapshot.
2038+
// This field is REQUIRED.
2039+
string target_snapshot_id = 2;
2040+
2041+
// This indicates the zero based starting byte position in the volume
2042+
// snapshot from which the result should be computed.
2043+
// It is intended to be used to continue a previously interrupted
2044+
// call.
2045+
// The CO SHOULD specify this value to be the offset of the byte
2046+
// position immediately after the last byte of the last data range
2047+
// received, if continuing an interrupted operation, or zero if not.
2048+
// The SP MUST ensure that the returned response stream does not
2049+
// contain BlockMetadata tuples that end before the requested
2050+
// starting_offset: i.e. if S is the requested starting_offset, and
2051+
// B0 is block_metadata[0] of the first message in the response
2052+
// stream, then (S < B0.byte_offset + B0.size_bytes) must be true.
2053+
// This field is REQUIRED.
2054+
int64 starting_offset = 3;
2055+
2056+
// This is an optional parameter, and if non-zero it specifies the
2057+
// maximum number of tuples to be returned in each
2058+
// GetMetadataDeltaResponse message returned by the RPC stream.
2059+
// The plugin will determine an appropriate value if 0, and is
2060+
// always free to send less than the requested value.
2061+
// This field is OPTIONAL.
2062+
int32 max_results = 4;
2063+
2064+
// Secrets required by plugin to complete the request.
2065+
// This field is OPTIONAL. Refer to the `Secrets Requirements`
2066+
// section on how to use this field.
2067+
map<string, string> secrets = 5 [(csi_secret) = true];
2068+
}
2069+
2070+
// GetMetadataDeltaResponse messages are returned in a gRPC stream.
2071+
// Cumulatively, they provide information on the data ranges that
2072+
// have changed between the base and target snapshots specified
2073+
// in the GetMetadataDeltaRequest message.
2074+
message GetMetadataDeltaResponse {
2075+
// This specifies the style used in the BlockMetadata sequence.
2076+
// This value must be the same in all such messages returned by
2077+
// the stream.
2078+
// If block_metadata_type is FIXED_LENGTH, then the size_bytes field
2079+
// of each message in the block_metadata list MUST be constant.
2080+
// This field is REQUIRED.
2081+
BlockMetadataType block_metadata_type = 1;
2082+
2083+
// This returns the capacity of the underlying volume in bytes.
2084+
// This value must be the same in all such messages returned by
2085+
// the stream.
2086+
// This field is REQUIRED.
2087+
int64 volume_capacity_bytes = 2;
2088+
2089+
// This is a list of data range tuples.
2090+
// If the value of max_results in the GetMetadataDeltaRequest message
2091+
// is greater than zero, then the number of entries in this list MUST
2092+
// be less than or equal to that value.
2093+
// The SP MUST respect the value of starting_offset in the request.
2094+
// The byte_offset fields of adjacent BlockMetadata messages
2095+
// MUST be strictly increasing and messages MUST NOT overlap:
2096+
// i.e. for any two BlockMetadata messages, A and B, if A is returned
2097+
// before B, then (A.byte_offset + A.size_bytes <= B.byte_offset)
2098+
// MUST be true.
2099+
// This MUST also be true if A and B are from block_metadata lists in
2100+
// different GetMetadataDeltaResponse messages in the gRPC stream.
2101+
// This field is OPTIONAL.
2102+
repeated BlockMetadata block_metadata = 3;
2103+
}

0 commit comments

Comments
 (0)