-
Notifications
You must be signed in to change notification settings - Fork 3.8k
/
metadata.proto
131 lines (113 loc) · 5.59 KB
/
metadata.proto
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
// Copyright 2014 The Cockroach Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
// implied. See the License for the specific language governing
// permissions and limitations under the License.
//
// Author: Spencer Kimball ([email protected])
// Author: Bram Gruneir ([email protected])
syntax = "proto2";
package cockroach.roachpb;
option go_package = "roachpb";
import "cockroach/util/unresolved_addr.proto";
import "gogoproto/gogo.proto";
// Attributes specifies a list of arbitrary strings describing
// node topology, store type, and machine capabilities.
message Attributes {
option (gogoproto.goproto_stringer) = false;
repeated string attrs = 1 [(gogoproto.moretags) = "yaml:\"attrs,flow\""];
}
// ReplicaDescriptor describes a replica location by node ID
// (corresponds to a host:port via lookup on gossip network) and store
// ID (identifies the device).
message ReplicaDescriptor {
option (gogoproto.populate) = true;
optional int32 node_id = 1 [(gogoproto.nullable) = false,
(gogoproto.customname) = "NodeID", (gogoproto.casttype) = "NodeID"];
optional int32 store_id = 2 [(gogoproto.nullable) = false,
(gogoproto.customname) = "StoreID", (gogoproto.casttype) = "StoreID"];
// replica_id uniquely identifies a replica instance. If a range is removed from
// a store and then re-added to the same store, the new instance will have a
// higher replica_id.
optional int32 replica_id = 3 [(gogoproto.nullable) = false,
(gogoproto.customname) = "ReplicaID", (gogoproto.casttype) = "ReplicaID"];
}
// ReplicaIdent uniquely identifies a specific replica.
message ReplicaIdent {
optional int64 range_id = 1 [(gogoproto.nullable) = false,
(gogoproto.customname) = "RangeID", (gogoproto.casttype) = "RangeID"];
optional ReplicaDescriptor replica = 2 [(gogoproto.nullable) = false];
}
// RangeDescriptor is the value stored in a range metadata key.
// A range is described using an inclusive start key, a non-inclusive end key,
// and a list of replicas where the range is stored.
message RangeDescriptor {
optional int64 range_id = 1 [(gogoproto.nullable) = false,
(gogoproto.customname) = "RangeID", (gogoproto.casttype) = "RangeID"];
// start_key is the first key which may be contained by this range.
optional bytes start_key = 2 [(gogoproto.casttype) = "RKey"];
// end_key marks the end of the range's possible keys. EndKey itself is not
// contained in this range - it will be contained in the immediately
// subsequent range.
optional bytes end_key = 3 [(gogoproto.casttype) = "RKey"];
// replicas is the set of nodes/stores on which replicas of this
// range are stored, the ordering being arbitrary and subject to
// permutation.
repeated ReplicaDescriptor replicas = 4 [(gogoproto.nullable) = false];
// next_replica_id is a counter used to generate replica IDs.
optional int32 next_replica_id = 5 [(gogoproto.nullable) = false,
(gogoproto.customname) = "NextReplicaID", (gogoproto.casttype) = "ReplicaID"];
}
// StoreCapacity contains capacity information for a storage device.
message StoreCapacity {
optional int64 capacity = 1 [(gogoproto.nullable) = false];
optional int64 available = 2 [(gogoproto.nullable) = false];
optional int32 range_count = 3 [(gogoproto.nullable) = false];
}
// NodeDescriptor holds details on node physical/network topology.
message NodeDescriptor {
optional int32 node_id = 1 [(gogoproto.nullable) = false,
(gogoproto.customname) = "NodeID", (gogoproto.casttype) = "NodeID"];
optional util.UnresolvedAddr address = 2 [(gogoproto.nullable) = false];
optional Attributes attrs = 3 [(gogoproto.nullable) = false];
}
// StoreDescriptor holds store information including store attributes, node
// descriptor and store capacity.
message StoreDescriptor {
optional int32 store_id = 1 [(gogoproto.nullable) = false,
(gogoproto.customname) = "StoreID", (gogoproto.casttype) = "StoreID"];
optional Attributes attrs = 2 [(gogoproto.nullable) = false];
optional NodeDescriptor node = 3 [(gogoproto.nullable) = false];
optional StoreCapacity capacity = 4 [(gogoproto.nullable) = false];
optional Locality locality = 5 [(gogoproto.nullable) = false];
}
// StoreDeadReplicas holds a storeID and a list of dead replicas on that store.
// Used to let the range lease holder know about corrupted or otherwise
// destroyed replicas that should be transferred to a different store.
message StoreDeadReplicas {
optional int32 store_id = 1 [(gogoproto.nullable) = false,
(gogoproto.customname) = "StoreID", (gogoproto.casttype) = "StoreID"];
repeated ReplicaIdent replicas = 2 [(gogoproto.nullable) = false];
}
// Locality is an ordered set of key value Tiers that describe a nodes location.
// The tier keys should be the same across all nodes.
message Locality {
option (gogoproto.goproto_stringer) = false;
repeated Tier tiers = 1 [(gogoproto.nullable) = false];
}
// Tier represents one level of the locality hiearchy.
message Tier {
option (gogoproto.goproto_stringer) = false;
// Key is the name of tier and should match all other nodes.
optional string key = 1 [(gogoproto.nullable) = false];
// Value is node specific value corresponding to the key.
optional string value = 2 [(gogoproto.nullable) = false];
}