From f79dc69b3431cbc65e8a1f1a2866062ce5bfe149 Mon Sep 17 00:00:00 2001 From: Quint Daenen Date: Fri, 17 May 2024 11:45:02 +0200 Subject: [PATCH] Add registry client. --- go.mod | 1 + go.sum | 6 + registry/README.md | 3 + registry/dataprovider.go | 116 ++ registry/dataprovider_test.go | 11 + registry/errors.go | 83 ++ registry/go.sum | 20 + registry/interfaces.go | 53 + registry/proto.go | 6 + registry/proto/v1/local.pb.go | 446 ++++++++ registry/proto/v1/registry.pb.go | 237 ++++ registry/proto/v1/transport.pb.go | 1676 +++++++++++++++++++++++++++++ registry/testdata/local.proto | 46 + registry/testdata/registry.proto | 14 + registry/testdata/transport.proto | 241 +++++ 15 files changed, 2959 insertions(+) create mode 100644 registry/README.md create mode 100644 registry/dataprovider.go create mode 100644 registry/dataprovider_test.go create mode 100644 registry/errors.go create mode 100644 registry/go.sum create mode 100644 registry/interfaces.go create mode 100644 registry/proto.go create mode 100644 registry/proto/v1/local.pb.go create mode 100644 registry/proto/v1/registry.pb.go create mode 100644 registry/proto/v1/transport.pb.go create mode 100644 registry/testdata/local.proto create mode 100644 registry/testdata/registry.proto create mode 100644 registry/testdata/transport.proto diff --git a/go.mod b/go.mod index 7ad3e1d..ce67e51 100644 --- a/go.mod +++ b/go.mod @@ -8,6 +8,7 @@ require ( github.com/di-wu/parser v0.3.0 github.com/fxamacker/cbor/v2 v2.6.0 github.com/herumi/bls-go-binary v1.33.0 + google.golang.org/protobuf v1.34.1 ) require github.com/x448/float16 v0.8.4 // indirect diff --git a/go.sum b/go.sum index 9a67952..65e204d 100644 --- a/go.sum +++ b/go.sum @@ -6,7 +6,13 @@ github.com/di-wu/parser v0.3.0 h1:NMOvy5ifswgt4gsdhySVcKOQtvjC43cHZIfViWctqQY= github.com/di-wu/parser v0.3.0/go.mod h1:SLp58pW6WamdmznrVRrw2NTyn4wAvT9rrEFynKX7nYo= github.com/fxamacker/cbor/v2 v2.6.0 h1:sU6J2usfADwWlYDAFhZBQ6TnLFBHxgesMrQfQgk1tWA= github.com/fxamacker/cbor/v2 v2.6.0/go.mod h1:pxXPTn3joSm21Gbwsv0w9OSA2y1HFR9qXEeXQVeNoDQ= +github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU= +github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/herumi/bls-go-binary v1.33.0 h1:OJwWkXTsxF7SLHT8cBLJfb6i97KHfrG4DkgejLcDm78= github.com/herumi/bls-go-binary v1.33.0/go.mod h1:O4Vp1AfR4raRGwFeQpr9X/PQtncEicMoOe6BQt1oX0Y= github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM= github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcYsOfg= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/protobuf v1.34.1 h1:9ddQBjfCyZPOHPUiPxpYESBLc+T8P3E+Vo4IbKZgFWg= +google.golang.org/protobuf v1.34.1/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= diff --git a/registry/README.md b/registry/README.md new file mode 100644 index 0000000..fab7387 --- /dev/null +++ b/registry/README.md @@ -0,0 +1,3 @@ +# Registry Client in Go + +Based on the [Rust Registry Client](https://github.com/dfinity/ic/tree/master/rs/registry) diff --git a/registry/dataprovider.go b/registry/dataprovider.go new file mode 100644 index 0000000..f1b92c6 --- /dev/null +++ b/registry/dataprovider.go @@ -0,0 +1,116 @@ +package registry + +import ( + "fmt" + "sort" + "sync" + "time" + + "github.com/aviate-labs/agent-go" + "github.com/aviate-labs/agent-go/ic" + "github.com/aviate-labs/agent-go/identity" + "github.com/aviate-labs/agent-go/principal" + "github.com/aviate-labs/agent-go/registry/proto/v1" + "github.com/fxamacker/cbor/v2" + "google.golang.org/protobuf/proto" + "google.golang.org/protobuf/types/known/wrapperspb" +) + +type DataProvider struct { + sync.RWMutex + Records []v1.ProtoRegistryRecord +} + +func (d *DataProvider) Add( + key string, + version uint64, + value []byte, +) error { + if version < 1 { + return fmt.Errorf("version must be greater than 0") + } + + d.Lock() + defer d.Unlock() + + var ok bool + idx := sort.Search(len(d.Records), func(i int) bool { + if d.Records[i].Key == key { + if d.Records[i].Version == version { + ok = true // Record already exists. + } + return d.Records[i].Version >= version + } + return d.Records[i].Key >= key + }) + if ok { + // Key and version already exist. + return fmt.Errorf("record already exists: %s@%d", key, version) + } + d.Records = append(d.Records, v1.ProtoRegistryRecord{}) + copy(d.Records[idx+1:], d.Records[idx:]) // Shift right. + d.Records[idx] = v1.ProtoRegistryRecord{ + Key: key, + Version: version, + Value: wrapperspb.Bytes(value), + } + return nil +} + +func (d *DataProvider) GetChangesSince(version uint64) ([]*v1.RegistryDelta, uint64, error) { + a, err := agent.New(agent.DefaultConfig) + if err != nil { + return nil, 0, err + } + payload, err := proto.Marshal(&v1.RegistryGetChangesSinceRequest{ + Version: version, + }) + if err != nil { + return nil, 0, err + } + request := agent.Request{ + Type: agent.RequestTypeQuery, + Sender: principal.AnonymousID, + IngressExpiry: uint64(time.Now().Add(5 * time.Minute).UnixNano()), + CanisterID: ic.REGISTRY_PRINCIPAL, + MethodName: "get_changes_since", + Arguments: payload, + } + requestID := agent.NewRequestID(request) + id := new(identity.AnonymousIdentity) + data, err := cbor.Marshal(agent.Envelope{ + Content: request, + SenderPubKey: id.PublicKey(), + SenderSig: requestID.Sign(id), + }) + if err != nil { + return nil, 0, err + } + resp, err := a.Client().Query(ic.REGISTRY_PRINCIPAL, data) + if err != nil { + return nil, 0, err + } + var response agent.Response + if err := cbor.Unmarshal(resp, &response); err != nil { + return nil, 0, err + } + if response.Status != "replied" { + return nil, 0, fmt.Errorf("status: %s", response.Status) + } + + changesResponse := new(v1.RegistryGetChangesSinceResponse) + if err := proto.Unmarshal(response.Reply["arg"], changesResponse); err != nil { + return nil, 0, err + } + if changesResponse.Error != nil { + return nil, 0, fmt.Errorf("error: %s", changesResponse.Error.String()) + } + return changesResponse.Deltas, changesResponse.Version, nil +} + +func (d *DataProvider) IsEmpty() bool { + d.RLock() + defer d.RUnlock() + + return len(d.Records) == 0 +} diff --git a/registry/dataprovider_test.go b/registry/dataprovider_test.go new file mode 100644 index 0000000..3a29eb8 --- /dev/null +++ b/registry/dataprovider_test.go @@ -0,0 +1,11 @@ +package registry + +import ( + "testing" +) + +func TestDataProvider_GetChangesSince(t *testing.T) { + if _, _, err := new(DataProvider).GetChangesSince(0); err != nil { + t.Fatal(err) + } +} diff --git a/registry/errors.go b/registry/errors.go new file mode 100644 index 0000000..0006508 --- /dev/null +++ b/registry/errors.go @@ -0,0 +1,83 @@ +package registry + +import "fmt" + +type ClientDataProviderQueryFailedError struct { + Source DataProviderError +} + +func (e ClientDataProviderQueryFailedError) Error() string { + return fmt.Sprintf("failed to query data provider: %s", e.Source) +} + +func (ClientDataProviderQueryFailedError) registryClientError() {} + +type ClientDecodeError struct { + Err string +} + +func (e ClientDecodeError) Error() string { + return fmt.Sprintf("failed to decode registry contents: %s", e.Err) +} + +func (ClientDecodeError) registryClientError() {} + +type ClientError interface { + registryClientError() + error +} + +type ClientPollLockFailedError struct { + Err string +} + +func (e ClientPollLockFailedError) Error() string { + return fmt.Sprintf("failed to acquire poll lock: %s", e.Err) +} + +func (ClientPollLockFailedError) registryClientError() {} + +type ClientPollingLatestVersionFailedError struct { + Retries uint +} + +func (e ClientPollingLatestVersionFailedError) Error() string { + return fmt.Sprintf("failed to report the same version twice after %d times", e.Retries) +} + +func (ClientPollingLatestVersionFailedError) registryClientError() {} + +type ClientVersionNotAvailableError struct { + Version Version +} + +func (e ClientVersionNotAvailableError) Error() string { + return fmt.Sprintf("the requested version is not available locally: %d", e.Version) +} + +func (ClientVersionNotAvailableError) registryClientError() {} + +type DataProviderError interface { + dataProviderError() + error +} + +// DataProviderTimeoutError occurs when the registry transport client times out. +type DataProviderTimeoutError struct{} + +func (DataProviderTimeoutError) Error() string { + return "registry transport client timed out" +} + +func (DataProviderTimeoutError) dataProviderError() {} + +// DataProviderTransferError occurs when using registry transfer. +type DataProviderTransferError struct { + Source string +} + +func (e DataProviderTransferError) Error() string { + return fmt.Sprintf("registry transport client failed to fetch registry update from registry canister: %s", e.Source) +} + +func (DataProviderTransferError) dataProviderError() {} diff --git a/registry/go.sum b/registry/go.sum new file mode 100644 index 0000000..1f83d6f --- /dev/null +++ b/registry/go.sum @@ -0,0 +1,20 @@ +github.com/aviate-labs/agent-go v0.4.3 h1:XvUv23dw/77I5Rt6S89fHOuI9ci9ARiyLw8Lh4C2FTU= +github.com/aviate-labs/agent-go v0.4.3/go.mod h1:uodw1LlLrP5A5XxXaNOE39iHYb6IGDqnVXEvwiG+YiM= +github.com/aviate-labs/agent-go v0.4.4-0.20240515111542-ef8ce13f44f2 h1:4WA9qGa4z22TSJ6LApbRXtb/ZpeLkxgaKBOvu72srno= +github.com/aviate-labs/agent-go v0.4.4-0.20240515111542-ef8ce13f44f2/go.mod h1:uodw1LlLrP5A5XxXaNOE39iHYb6IGDqnVXEvwiG+YiM= +github.com/aviate-labs/leb128 v0.3.0 h1:s9htRv3OYk8nuHqJu9PiVFJxv1jIUTIcpEeiURa91uQ= +github.com/aviate-labs/leb128 v0.3.0/go.mod h1:GclhBOjhIKmcDlgHKhj0AEZollzERfZUbcRUKiQVqgY= +github.com/aviate-labs/secp256k1 v0.0.0-5e6736a h1:aQkG/D+l8Y7tr809l8pN+KebH2jzacWReSFQmeEKFgM= +github.com/aviate-labs/secp256k1 v0.0.0-5e6736a/go.mod h1:C/lr3F9TimrVkdZckG5mz+VU0TrmpeyVKUjzv2YyGwA= +github.com/fxamacker/cbor/v2 v2.6.0 h1:sU6J2usfADwWlYDAFhZBQ6TnLFBHxgesMrQfQgk1tWA= +github.com/fxamacker/cbor/v2 v2.6.0/go.mod h1:pxXPTn3joSm21Gbwsv0w9OSA2y1HFR9qXEeXQVeNoDQ= +github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU= +github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/herumi/bls-go-binary v1.33.0 h1:OJwWkXTsxF7SLHT8cBLJfb6i97KHfrG4DkgejLcDm78= +github.com/herumi/bls-go-binary v1.33.0/go.mod h1:O4Vp1AfR4raRGwFeQpr9X/PQtncEicMoOe6BQt1oX0Y= +github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM= +github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcYsOfg= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/protobuf v1.34.1 h1:9ddQBjfCyZPOHPUiPxpYESBLc+T8P3E+Vo4IbKZgFWg= +google.golang.org/protobuf v1.34.1/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= diff --git a/registry/interfaces.go b/registry/interfaces.go new file mode 100644 index 0000000..ac0c6cd --- /dev/null +++ b/registry/interfaces.go @@ -0,0 +1,53 @@ +package registry + +import "time" + +func GetValue(c RegistryClient, key string, version Version) (*[]byte, error) { + vv, err := c.GetVersionedValue(key, version) + if err != nil { + return nil, err + } + return vv.Value, nil +} + +type RegistryClient interface { + GetVersionedValue(key string, version Version) (VersionedRecord[[]byte], error) + GetKeyFamily(keyPrefix string, version Version) ([]string, error) + GetLatestVersion() (Version, error) + GetVersionTimestamp(version Version) (*int64, error) +} + +type RegistryDataProvider interface { + GetUpdatesSince(version Version) ([]TransportRecord, error) +} + +type TransportRecord = VersionedRecord[[]byte] + +func EmptyZeroRecord(key string) TransportRecord { + return TransportRecord{ + Key: key, + Version: ZeroRegistryVersion, + Value: nil, + } +} + +type Version uint64 + +// Reference: https://github.com/dfinity/ic/blob/master/rs/interfaces/registry/src/lib.rs + +const ( + // ZeroRegistryVersion is the version number of the empty registry. + ZeroRegistryVersion Version = 0 + // PollingPeriod is the period at which the local store is polled for updates. + PollingPeriod = 5 * time.Second +) + +// VersionedRecord is a key-value pair with a version. +type VersionedRecord[T any] struct { + // Key of the record. + Key string + // Version at which this record was created. + Version Version + // Value of the record. If the record was deleted in this version, this field is nil. + Value *T +} diff --git a/registry/proto.go b/registry/proto.go new file mode 100644 index 0000000..8f64c6d --- /dev/null +++ b/registry/proto.go @@ -0,0 +1,6 @@ +package registry + +//go:generate go install google.golang.org/protobuf/cmd/protoc-gen-go@latest +//go:generate protoc -I=testdata --go_out=. testdata/registry.proto +//go:generate protoc -I=testdata --go_out=. testdata/local.proto +//go:generate protoc -I=testdata --go_out=. testdata/transport.proto diff --git a/registry/proto/v1/local.pb.go b/registry/proto/v1/local.pb.go new file mode 100644 index 0000000..5de8427 --- /dev/null +++ b/registry/proto/v1/local.pb.go @@ -0,0 +1,446 @@ +// Protobuf message that are used in the local_store. + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.34.1 +// protoc v5.26.1 +// source: local.proto + +package v1 + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// Enum value maps for MutationType. +var ( + MutationType_name = map[int32]string{ + 0: "INVALID_STATE", + 1: "SET", + 2: "UNSET", + } + MutationType_value = map[string]int32{ + "INVALID_STATE": 0, + "SET": 1, + "UNSET": 2, + } +) + +var ( + file_local_proto_rawDescOnce sync.Once + file_local_proto_rawDescData = file_local_proto_rawDesc +) + +var File_local_proto protoreflect.FileDescriptor + +var file_local_proto_depIdxs = []int32{ + 2, // 0: ic_registry_common.pb.local_store.v1.ChangelogEntry.key_mutations:type_name -> ic_registry_common.pb.local_store.v1.KeyMutation + 0, // 1: ic_registry_common.pb.local_store.v1.KeyMutation.mutation_type:type_name -> ic_registry_common.pb.local_store.v1.MutationType + 1, // 2: ic_registry_common.pb.local_store.v1.Delta.changelog:type_name -> ic_registry_common.pb.local_store.v1.ChangelogEntry + 3, // [3:3] is the sub-list for method output_type + 3, // [3:3] is the sub-list for method input_type + 3, // [3:3] is the sub-list for extension type_name + 3, // [3:3] is the sub-list for extension extendee + 0, // [0:3] is the sub-list for field type_name +} + +var file_local_proto_enumTypes = make([]protoimpl.EnumInfo, 1) + +var file_local_proto_goTypes = []interface{}{ + (MutationType)(0), // 0: ic_registry_common.pb.local_store.v1.MutationType + (*ChangelogEntry)(nil), // 1: ic_registry_common.pb.local_store.v1.ChangelogEntry + (*KeyMutation)(nil), // 2: ic_registry_common.pb.local_store.v1.KeyMutation + (*CertifiedTime)(nil), // 3: ic_registry_common.pb.local_store.v1.CertifiedTime + (*Delta)(nil), // 4: ic_registry_common.pb.local_store.v1.Delta +} + +var file_local_proto_msgTypes = make([]protoimpl.MessageInfo, 4) + +var file_local_proto_rawDesc = []byte{ + 0x0a, 0x0b, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x24, 0x69, + 0x63, 0x5f, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, + 0x6e, 0x2e, 0x70, 0x62, 0x2e, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x5f, 0x73, 0x74, 0x6f, 0x72, 0x65, + 0x2e, 0x76, 0x31, 0x22, 0x68, 0x0a, 0x0e, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x6c, 0x6f, 0x67, + 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x56, 0x0a, 0x0d, 0x6b, 0x65, 0x79, 0x5f, 0x6d, 0x75, 0x74, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x31, 0x2e, 0x69, + 0x63, 0x5f, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, + 0x6e, 0x2e, 0x70, 0x62, 0x2e, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x5f, 0x73, 0x74, 0x6f, 0x72, 0x65, + 0x2e, 0x76, 0x31, 0x2e, 0x4b, 0x65, 0x79, 0x4d, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, + 0x0c, 0x6b, 0x65, 0x79, 0x4d, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x8e, 0x01, + 0x0a, 0x0b, 0x4b, 0x65, 0x79, 0x4d, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x10, 0x0a, + 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, + 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x57, 0x0a, 0x0d, 0x6d, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x32, 0x2e, 0x69, + 0x63, 0x5f, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, + 0x6e, 0x2e, 0x70, 0x62, 0x2e, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x5f, 0x73, 0x74, 0x6f, 0x72, 0x65, + 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x79, 0x70, 0x65, + 0x52, 0x0c, 0x6d, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x22, 0x39, + 0x0a, 0x0d, 0x43, 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, 0x65, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x12, + 0x28, 0x0a, 0x10, 0x75, 0x6e, 0x69, 0x78, 0x5f, 0x65, 0x70, 0x6f, 0x63, 0x68, 0x5f, 0x6e, 0x61, + 0x6e, 0x6f, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0e, 0x75, 0x6e, 0x69, 0x78, 0x45, + 0x70, 0x6f, 0x63, 0x68, 0x4e, 0x61, 0x6e, 0x6f, 0x73, 0x22, 0x86, 0x01, 0x0a, 0x05, 0x44, 0x65, + 0x6c, 0x74, 0x61, 0x12, 0x29, 0x0a, 0x10, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x5f, + 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0f, 0x72, + 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x52, + 0x0a, 0x09, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x6c, 0x6f, 0x67, 0x18, 0x02, 0x20, 0x03, 0x28, + 0x0b, 0x32, 0x34, 0x2e, 0x69, 0x63, 0x5f, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x5f, + 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x62, 0x2e, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x5f, + 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x6c, + 0x6f, 0x67, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x09, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x6c, + 0x6f, 0x67, 0x2a, 0x35, 0x0a, 0x0c, 0x4d, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x79, + 0x70, 0x65, 0x12, 0x11, 0x0a, 0x0d, 0x49, 0x4e, 0x56, 0x41, 0x4c, 0x49, 0x44, 0x5f, 0x53, 0x54, + 0x41, 0x54, 0x45, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x53, 0x45, 0x54, 0x10, 0x01, 0x12, 0x09, + 0x0a, 0x05, 0x55, 0x4e, 0x53, 0x45, 0x54, 0x10, 0x02, 0x42, 0x0a, 0x5a, 0x08, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x2f, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +func file_local_proto_rawDescGZIP() []byte { + file_local_proto_rawDescOnce.Do(func() { + file_local_proto_rawDescData = protoimpl.X.CompressGZIP(file_local_proto_rawDescData) + }) + return file_local_proto_rawDescData +} + +// The time when the last certified update was successfully received. +type CertifiedTime struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Number of nano seconds since UNIX EPOCH + UnixEpochNanos uint64 `protobuf:"varint,1,opt,name=unix_epoch_nanos,json=unixEpochNanos,proto3" json:"unix_epoch_nanos,omitempty"` +} + +// Deprecated: Use CertifiedTime.ProtoReflect.Descriptor instead. +func (*CertifiedTime) Descriptor() ([]byte, []int) { + return file_local_proto_rawDescGZIP(), []int{2} +} + +func (x *CertifiedTime) GetUnixEpochNanos() uint64 { + if x != nil { + return x.UnixEpochNanos + } + return 0 +} + +func (*CertifiedTime) ProtoMessage() {} + +func (x *CertifiedTime) ProtoReflect() protoreflect.Message { + mi := &file_local_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *CertifiedTime) Reset() { + *x = CertifiedTime{} + if protoimpl.UnsafeEnabled { + mi := &file_local_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CertifiedTime) String() string { + return protoimpl.X.MessageStringOf(x) +} + +// Set of all mutations that, when applied to the registry at version v, +// produce the registry at version v+1 +type ChangelogEntry struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The default, an empty list, is _invalid_ here. + KeyMutations []*KeyMutation `protobuf:"bytes,1,rep,name=key_mutations,json=keyMutations,proto3" json:"key_mutations,omitempty"` +} + +// Deprecated: Use ChangelogEntry.ProtoReflect.Descriptor instead. +func (*ChangelogEntry) Descriptor() ([]byte, []int) { + return file_local_proto_rawDescGZIP(), []int{0} +} + +func (x *ChangelogEntry) GetKeyMutations() []*KeyMutation { + if x != nil { + return x.KeyMutations + } + return nil +} + +func (*ChangelogEntry) ProtoMessage() {} + +func (x *ChangelogEntry) ProtoReflect() protoreflect.Message { + mi := &file_local_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *ChangelogEntry) Reset() { + *x = ChangelogEntry{} + if protoimpl.UnsafeEnabled { + mi := &file_local_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ChangelogEntry) String() string { + return protoimpl.X.MessageStringOf(x) +} + +// A changelog that is applicable at a specific registry version. +type Delta struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + RegistryVersion uint64 `protobuf:"varint,1,opt,name=registry_version,json=registryVersion,proto3" json:"registry_version,omitempty"` + Changelog []*ChangelogEntry `protobuf:"bytes,2,rep,name=changelog,proto3" json:"changelog,omitempty"` +} + +// Deprecated: Use Delta.ProtoReflect.Descriptor instead. +func (*Delta) Descriptor() ([]byte, []int) { + return file_local_proto_rawDescGZIP(), []int{3} +} + +func (x *Delta) GetChangelog() []*ChangelogEntry { + if x != nil { + return x.Changelog + } + return nil +} + +func (x *Delta) GetRegistryVersion() uint64 { + if x != nil { + return x.RegistryVersion + } + return 0 +} + +func (*Delta) ProtoMessage() {} + +func (x *Delta) ProtoReflect() protoreflect.Message { + mi := &file_local_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *Delta) Reset() { + *x = Delta{} + if protoimpl.UnsafeEnabled { + mi := &file_local_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Delta) String() string { + return protoimpl.X.MessageStringOf(x) +} + +// A mutation of a single key. +type KeyMutation struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Key. + Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + // Protobuf encoded value. + Value []byte `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` + // If this is `UNSET`, `value` must assume the default value. + MutationType MutationType `protobuf:"varint,3,opt,name=mutation_type,json=mutationType,proto3,enum=ic_registry_common.pb.local_store.v1.MutationType" json:"mutation_type,omitempty"` +} + +// Deprecated: Use KeyMutation.ProtoReflect.Descriptor instead. +func (*KeyMutation) Descriptor() ([]byte, []int) { + return file_local_proto_rawDescGZIP(), []int{1} +} + +func (x *KeyMutation) GetKey() string { + if x != nil { + return x.Key + } + return "" +} + +func (x *KeyMutation) GetMutationType() MutationType { + if x != nil { + return x.MutationType + } + return MutationType_INVALID_STATE +} + +func (x *KeyMutation) GetValue() []byte { + if x != nil { + return x.Value + } + return nil +} + +func (*KeyMutation) ProtoMessage() {} + +func (x *KeyMutation) ProtoReflect() protoreflect.Message { + mi := &file_local_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *KeyMutation) Reset() { + *x = KeyMutation{} + if protoimpl.UnsafeEnabled { + mi := &file_local_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *KeyMutation) String() string { + return protoimpl.X.MessageStringOf(x) +} + +type MutationType int32 + +const ( + // Illegal state. + MutationType_INVALID_STATE MutationType = 0 + // The value was SET in this delta. + MutationType_SET MutationType = 1 + // The value was UNSET in this delta. + MutationType_UNSET MutationType = 2 +) + +func (MutationType) Descriptor() protoreflect.EnumDescriptor { + return file_local_proto_enumTypes[0].Descriptor() +} + +func (x MutationType) Enum() *MutationType { + p := new(MutationType) + *p = x + return p +} + +// Deprecated: Use MutationType.Descriptor instead. +func (MutationType) EnumDescriptor() ([]byte, []int) { + return file_local_proto_rawDescGZIP(), []int{0} +} +func (x MutationType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} +func (x MutationType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} +func (MutationType) Type() protoreflect.EnumType { + return &file_local_proto_enumTypes[0] +} + +func init() { file_local_proto_init() } +func file_local_proto_init() { + if File_local_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_local_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ChangelogEntry); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_local_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*KeyMutation); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_local_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CertifiedTime); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_local_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Delta); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_local_proto_rawDesc, + NumEnums: 1, + NumMessages: 4, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_local_proto_goTypes, + DependencyIndexes: file_local_proto_depIdxs, + EnumInfos: file_local_proto_enumTypes, + MessageInfos: file_local_proto_msgTypes, + }.Build() + File_local_proto = out.File + file_local_proto_rawDesc = nil + file_local_proto_goTypes = nil + file_local_proto_depIdxs = nil +} diff --git a/registry/proto/v1/registry.pb.go b/registry/proto/v1/registry.pb.go new file mode 100644 index 0000000..08380d2 --- /dev/null +++ b/registry/proto/v1/registry.pb.go @@ -0,0 +1,237 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.34.1 +// protoc v5.26.1 +// source: registry.proto + +package v1 + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + wrapperspb "google.golang.org/protobuf/types/known/wrapperspb" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +var ( + file_registry_proto_rawDescOnce sync.Once + file_registry_proto_rawDescData = file_registry_proto_rawDesc +) + +var File_registry_proto protoreflect.FileDescriptor + +var file_registry_proto_depIdxs = []int32{ + 1, // 0: ic_registry_common.pb.proto_registry.v1.ProtoRegistry.records:type_name -> ic_registry_common.pb.proto_registry.v1.ProtoRegistryRecord + 2, // 1: ic_registry_common.pb.proto_registry.v1.ProtoRegistryRecord.value:type_name -> google.protobuf.BytesValue + 2, // [2:2] is the sub-list for method output_type + 2, // [2:2] is the sub-list for method input_type + 2, // [2:2] is the sub-list for extension type_name + 2, // [2:2] is the sub-list for extension extendee + 0, // [0:2] is the sub-list for field type_name +} + +var file_registry_proto_goTypes = []interface{}{ + (*ProtoRegistry)(nil), // 0: ic_registry_common.pb.proto_registry.v1.ProtoRegistry + (*ProtoRegistryRecord)(nil), // 1: ic_registry_common.pb.proto_registry.v1.ProtoRegistryRecord + (*wrapperspb.BytesValue)(nil), // 2: google.protobuf.BytesValue +} + +var file_registry_proto_msgTypes = make([]protoimpl.MessageInfo, 2) + +var file_registry_proto_rawDesc = []byte{ + 0x0a, 0x0e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x12, 0x27, 0x69, 0x63, 0x5f, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x5f, 0x63, 0x6f, + 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x5f, 0x72, 0x65, + 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x1a, 0x1e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, + 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x77, 0x72, 0x61, 0x70, 0x70, + 0x65, 0x72, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x67, 0x0a, 0x0d, 0x50, 0x72, 0x6f, + 0x74, 0x6f, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x12, 0x56, 0x0a, 0x07, 0x72, 0x65, + 0x63, 0x6f, 0x72, 0x64, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x3c, 0x2e, 0x69, 0x63, + 0x5f, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, + 0x2e, 0x70, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x5f, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, + 0x72, 0x79, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x52, 0x65, 0x67, 0x69, 0x73, + 0x74, 0x72, 0x79, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x52, 0x07, 0x72, 0x65, 0x63, 0x6f, 0x72, + 0x64, 0x73, 0x22, 0x74, 0x0a, 0x13, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x52, 0x65, 0x67, 0x69, 0x73, + 0x74, 0x72, 0x79, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x18, 0x0a, 0x07, 0x76, + 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x07, 0x76, 0x65, + 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x31, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x42, 0x79, 0x74, 0x65, 0x73, 0x56, 0x61, 0x6c, 0x75, + 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x0a, 0x5a, 0x08, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x2f, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +func file_registry_proto_init() { + if File_registry_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_registry_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ProtoRegistry); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_registry_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ProtoRegistryRecord); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_registry_proto_rawDesc, + NumEnums: 0, + NumMessages: 2, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_registry_proto_goTypes, + DependencyIndexes: file_registry_proto_depIdxs, + MessageInfos: file_registry_proto_msgTypes, + }.Build() + File_registry_proto = out.File + file_registry_proto_rawDesc = nil + file_registry_proto_goTypes = nil + file_registry_proto_depIdxs = nil +} + +func file_registry_proto_rawDescGZIP() []byte { + file_registry_proto_rawDescOnce.Do(func() { + file_registry_proto_rawDescData = protoimpl.X.CompressGZIP(file_registry_proto_rawDescData) + }) + return file_registry_proto_rawDescData +} + +func init() { file_registry_proto_init() } + +type ProtoRegistry struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Records []*ProtoRegistryRecord `protobuf:"bytes,1,rep,name=records,proto3" json:"records,omitempty"` +} + +// Deprecated: Use ProtoRegistry.ProtoReflect.Descriptor instead. +func (*ProtoRegistry) Descriptor() ([]byte, []int) { + return file_registry_proto_rawDescGZIP(), []int{0} +} + +func (x *ProtoRegistry) GetRecords() []*ProtoRegistryRecord { + if x != nil { + return x.Records + } + return nil +} + +func (*ProtoRegistry) ProtoMessage() {} + +func (x *ProtoRegistry) ProtoReflect() protoreflect.Message { + mi := &file_registry_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *ProtoRegistry) Reset() { + *x = ProtoRegistry{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ProtoRegistry) String() string { + return protoimpl.X.MessageStringOf(x) +} + +type ProtoRegistryRecord struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + Version uint64 `protobuf:"varint,2,opt,name=version,proto3" json:"version,omitempty"` + Value *wrapperspb.BytesValue `protobuf:"bytes,3,opt,name=value,proto3" json:"value,omitempty"` +} + +// Deprecated: Use ProtoRegistryRecord.ProtoReflect.Descriptor instead. +func (*ProtoRegistryRecord) Descriptor() ([]byte, []int) { + return file_registry_proto_rawDescGZIP(), []int{1} +} + +func (x *ProtoRegistryRecord) GetKey() string { + if x != nil { + return x.Key + } + return "" +} + +func (x *ProtoRegistryRecord) GetValue() *wrapperspb.BytesValue { + if x != nil { + return x.Value + } + return nil +} + +func (x *ProtoRegistryRecord) GetVersion() uint64 { + if x != nil { + return x.Version + } + return 0 +} +func (*ProtoRegistryRecord) ProtoMessage() {} +func (x *ProtoRegistryRecord) ProtoReflect() protoreflect.Message { + mi := &file_registry_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *ProtoRegistryRecord) Reset() { + *x = ProtoRegistryRecord{} + if protoimpl.UnsafeEnabled { + mi := &file_registry_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} +func (x *ProtoRegistryRecord) String() string { + return protoimpl.X.MessageStringOf(x) +} diff --git a/registry/proto/v1/transport.pb.go b/registry/proto/v1/transport.pb.go new file mode 100644 index 0000000..26c43d9 --- /dev/null +++ b/registry/proto/v1/transport.pb.go @@ -0,0 +1,1676 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.34.1 +// protoc v5.26.1 +// source: transport.proto + +// Set of messages used to interact with the registry canister. +// +// The registry canister implements the following three methods: +// +// get_latest_version(RegistryGetLatestVersionRequest) -> +// RegistryGetLatestVersionResponse +// +// get_value(RegistryGetValueRequest) -> RegistryGetValueResponse +// +// atomic_mutate(RegistryAtomicMutateRequest) -> RegistryAtomicMutateResponse +// +// get_latest_version() returns the latest version of the registry, i.e. the +// version of the last update made to the registry. +// +// get_value() returns the a value for specified version of a specified key from +// the registry, or the latest version if a version was not specified. +// get_value() returns a RegistryError if the key was not present. +// +// atomic_mutate() inserts, updates or deletes a set of keys in the registry. +// Mutations are atomic, meaning either all mutations are applied, or none +// are applied. +// +// Note that registry versions are always strictly >= 0, a -1 value is used +// to signal that no version was assigned. + +package v1 + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + emptypb "google.golang.org/protobuf/types/known/emptypb" + wrapperspb "google.golang.org/protobuf/types/known/wrapperspb" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// Enum value maps for RegistryError_Code. +var ( + RegistryError_Code_name = map[int32]string{ + 0: "MALFORMED_MESSAGE", + 1: "KEY_NOT_PRESENT", + 2: "KEY_ALREADY_PRESENT", + 3: "VERSION_NOT_LATEST", + 4: "VERSION_BEYOND_LATEST", + 999: "INTERNAL_ERROR", + } + RegistryError_Code_value = map[string]int32{ + "MALFORMED_MESSAGE": 0, + "KEY_NOT_PRESENT": 1, + "KEY_ALREADY_PRESENT": 2, + "VERSION_NOT_LATEST": 3, + "VERSION_BEYOND_LATEST": 4, + "INTERNAL_ERROR": 999, + } +) + +// Enum value maps for RegistryMutation_Type. +var ( + RegistryMutation_Type_name = map[int32]string{ + 0: "INSERT", + 1: "UPDATE", + 2: "DELETE", + 4: "UPSERT", + } + RegistryMutation_Type_value = map[string]int32{ + "INSERT": 0, + "UPDATE": 1, + "DELETE": 2, + "UPSERT": 4, + } +) + +var ( + file_transport_proto_rawDescOnce sync.Once + file_transport_proto_rawDescData = file_transport_proto_rawDesc +) + +var File_transport_proto protoreflect.FileDescriptor + +var file_transport_proto_depIdxs = []int32{ + 0, // 0: ic_registry_transport.pb.v1.RegistryError.code:type_name -> ic_registry_transport.pb.v1.RegistryError.Code + 3, // 1: ic_registry_transport.pb.v1.RegistryDelta.values:type_name -> ic_registry_transport.pb.v1.RegistryValue + 2, // 2: ic_registry_transport.pb.v1.RegistryGetChangesSinceResponse.error:type_name -> ic_registry_transport.pb.v1.RegistryError + 4, // 3: ic_registry_transport.pb.v1.RegistryGetChangesSinceResponse.deltas:type_name -> ic_registry_transport.pb.v1.RegistryDelta + 18, // 4: ic_registry_transport.pb.v1.RegistryGetValueRequest.version:type_name -> google.protobuf.UInt64Value + 2, // 5: ic_registry_transport.pb.v1.RegistryGetValueResponse.error:type_name -> ic_registry_transport.pb.v1.RegistryError + 1, // 6: ic_registry_transport.pb.v1.RegistryMutation.mutation_type:type_name -> ic_registry_transport.pb.v1.RegistryMutation.Type + 10, // 7: ic_registry_transport.pb.v1.RegistryAtomicMutateRequest.mutations:type_name -> ic_registry_transport.pb.v1.RegistryMutation + 11, // 8: ic_registry_transport.pb.v1.RegistryAtomicMutateRequest.preconditions:type_name -> ic_registry_transport.pb.v1.Precondition + 2, // 9: ic_registry_transport.pb.v1.RegistryAtomicMutateResponse.errors:type_name -> ic_registry_transport.pb.v1.RegistryError + 19, // 10: ic_registry_transport.pb.v1.MixedHashTree.empty:type_name -> google.protobuf.Empty + 16, // 11: ic_registry_transport.pb.v1.MixedHashTree.fork:type_name -> ic_registry_transport.pb.v1.MixedHashTree.Fork + 17, // 12: ic_registry_transport.pb.v1.MixedHashTree.labeled:type_name -> ic_registry_transport.pb.v1.MixedHashTree.Labeled + 14, // 13: ic_registry_transport.pb.v1.CertifiedResponse.hash_tree:type_name -> ic_registry_transport.pb.v1.MixedHashTree + 14, // 14: ic_registry_transport.pb.v1.MixedHashTree.Fork.left_tree:type_name -> ic_registry_transport.pb.v1.MixedHashTree + 14, // 15: ic_registry_transport.pb.v1.MixedHashTree.Fork.right_tree:type_name -> ic_registry_transport.pb.v1.MixedHashTree + 14, // 16: ic_registry_transport.pb.v1.MixedHashTree.Labeled.subtree:type_name -> ic_registry_transport.pb.v1.MixedHashTree + 17, // [17:17] is the sub-list for method output_type + 17, // [17:17] is the sub-list for method input_type + 17, // [17:17] is the sub-list for extension type_name + 17, // [17:17] is the sub-list for extension extendee + 0, // [0:17] is the sub-list for field type_name +} + +var file_transport_proto_enumTypes = make([]protoimpl.EnumInfo, 2) + +var file_transport_proto_goTypes = []interface{}{ + (RegistryError_Code)(0), // 0: ic_registry_transport.pb.v1.RegistryError.Code + (RegistryMutation_Type)(0), // 1: ic_registry_transport.pb.v1.RegistryMutation.Type + (*RegistryError)(nil), // 2: ic_registry_transport.pb.v1.RegistryError + (*RegistryValue)(nil), // 3: ic_registry_transport.pb.v1.RegistryValue + (*RegistryDelta)(nil), // 4: ic_registry_transport.pb.v1.RegistryDelta + (*RegistryGetChangesSinceRequest)(nil), // 5: ic_registry_transport.pb.v1.RegistryGetChangesSinceRequest + (*RegistryGetChangesSinceResponse)(nil), // 6: ic_registry_transport.pb.v1.RegistryGetChangesSinceResponse + (*RegistryGetValueRequest)(nil), // 7: ic_registry_transport.pb.v1.RegistryGetValueRequest + (*RegistryGetValueResponse)(nil), // 8: ic_registry_transport.pb.v1.RegistryGetValueResponse + (*RegistryGetLatestVersionResponse)(nil), // 9: ic_registry_transport.pb.v1.RegistryGetLatestVersionResponse + (*RegistryMutation)(nil), // 10: ic_registry_transport.pb.v1.RegistryMutation + (*Precondition)(nil), // 11: ic_registry_transport.pb.v1.Precondition + (*RegistryAtomicMutateRequest)(nil), // 12: ic_registry_transport.pb.v1.RegistryAtomicMutateRequest + (*RegistryAtomicMutateResponse)(nil), // 13: ic_registry_transport.pb.v1.RegistryAtomicMutateResponse + (*MixedHashTree)(nil), // 14: ic_registry_transport.pb.v1.MixedHashTree + (*CertifiedResponse)(nil), // 15: ic_registry_transport.pb.v1.CertifiedResponse + (*MixedHashTree_Fork)(nil), // 16: ic_registry_transport.pb.v1.MixedHashTree.Fork + (*MixedHashTree_Labeled)(nil), // 17: ic_registry_transport.pb.v1.MixedHashTree.Labeled + (*wrapperspb.UInt64Value)(nil), // 18: google.protobuf.UInt64Value + (*emptypb.Empty)(nil), // 19: google.protobuf.Empty +} + +var file_transport_proto_msgTypes = make([]protoimpl.MessageInfo, 16) + +var file_transport_proto_rawDesc = []byte{ + 0x0a, 0x0f, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x12, 0x1b, 0x69, 0x63, 0x5f, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x5f, 0x74, + 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x2e, 0x70, 0x62, 0x2e, 0x76, 0x31, 0x1a, 0x1b, + 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, + 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x67, 0x6f, 0x6f, + 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x77, 0x72, 0x61, + 0x70, 0x70, 0x65, 0x72, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x94, 0x02, 0x0a, 0x0d, + 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x43, 0x0a, + 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2f, 0x2e, 0x69, 0x63, + 0x5f, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x5f, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x70, + 0x6f, 0x72, 0x74, 0x2e, 0x70, 0x62, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, + 0x72, 0x79, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x2e, 0x43, 0x6f, 0x64, 0x65, 0x52, 0x04, 0x63, 0x6f, + 0x64, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x72, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x06, 0x72, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, + 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x22, 0x93, 0x01, 0x0a, + 0x04, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x15, 0x0a, 0x11, 0x4d, 0x41, 0x4c, 0x46, 0x4f, 0x52, 0x4d, + 0x45, 0x44, 0x5f, 0x4d, 0x45, 0x53, 0x53, 0x41, 0x47, 0x45, 0x10, 0x00, 0x12, 0x13, 0x0a, 0x0f, + 0x4b, 0x45, 0x59, 0x5f, 0x4e, 0x4f, 0x54, 0x5f, 0x50, 0x52, 0x45, 0x53, 0x45, 0x4e, 0x54, 0x10, + 0x01, 0x12, 0x17, 0x0a, 0x13, 0x4b, 0x45, 0x59, 0x5f, 0x41, 0x4c, 0x52, 0x45, 0x41, 0x44, 0x59, + 0x5f, 0x50, 0x52, 0x45, 0x53, 0x45, 0x4e, 0x54, 0x10, 0x02, 0x12, 0x16, 0x0a, 0x12, 0x56, 0x45, + 0x52, 0x53, 0x49, 0x4f, 0x4e, 0x5f, 0x4e, 0x4f, 0x54, 0x5f, 0x4c, 0x41, 0x54, 0x45, 0x53, 0x54, + 0x10, 0x03, 0x12, 0x19, 0x0a, 0x15, 0x56, 0x45, 0x52, 0x53, 0x49, 0x4f, 0x4e, 0x5f, 0x42, 0x45, + 0x59, 0x4f, 0x4e, 0x44, 0x5f, 0x4c, 0x41, 0x54, 0x45, 0x53, 0x54, 0x10, 0x04, 0x12, 0x13, 0x0a, + 0x0e, 0x49, 0x4e, 0x54, 0x45, 0x52, 0x4e, 0x41, 0x4c, 0x5f, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x10, + 0xe7, 0x07, 0x22, 0x68, 0x0a, 0x0d, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x56, 0x61, + 0x6c, 0x75, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0c, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, + 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, + 0x69, 0x6f, 0x6e, 0x12, 0x27, 0x0a, 0x0f, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x69, 0x6f, 0x6e, 0x5f, + 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0e, 0x64, 0x65, + 0x6c, 0x65, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x72, 0x22, 0x65, 0x0a, 0x0d, + 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x44, 0x65, 0x6c, 0x74, 0x61, 0x12, 0x10, 0x0a, + 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, + 0x42, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x2a, 0x2e, 0x69, 0x63, 0x5f, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x5f, 0x74, 0x72, + 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x2e, 0x70, 0x62, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x65, + 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x06, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x73, 0x22, 0x3a, 0x0a, 0x1e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x47, + 0x65, 0x74, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x73, 0x53, 0x69, 0x6e, 0x63, 0x65, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x22, + 0xc1, 0x01, 0x0a, 0x1f, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x47, 0x65, 0x74, 0x43, + 0x68, 0x61, 0x6e, 0x67, 0x65, 0x73, 0x53, 0x69, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x40, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x69, 0x63, 0x5f, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, + 0x5f, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x2e, 0x70, 0x62, 0x2e, 0x76, 0x31, + 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x05, + 0x65, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, + 0x42, 0x0a, 0x06, 0x64, 0x65, 0x6c, 0x74, 0x61, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x2a, 0x2e, 0x69, 0x63, 0x5f, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x5f, 0x74, 0x72, + 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x2e, 0x70, 0x62, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x65, + 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x44, 0x65, 0x6c, 0x74, 0x61, 0x52, 0x06, 0x64, 0x65, 0x6c, + 0x74, 0x61, 0x73, 0x22, 0x63, 0x0a, 0x17, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x47, + 0x65, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x36, + 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, + 0x66, 0x2e, 0x55, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x07, 0x76, + 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x0c, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x22, 0x8c, 0x01, 0x0a, 0x18, 0x52, 0x65, 0x67, + 0x69, 0x73, 0x74, 0x72, 0x79, 0x47, 0x65, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x40, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x69, 0x63, 0x5f, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, + 0x72, 0x79, 0x5f, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x2e, 0x70, 0x62, 0x2e, + 0x76, 0x31, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x45, 0x72, 0x72, 0x6f, 0x72, + 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, + 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, + 0x6e, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, + 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x3c, 0x0a, 0x20, 0x52, 0x65, 0x67, 0x69, 0x73, + 0x74, 0x72, 0x79, 0x47, 0x65, 0x74, 0x4c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x56, 0x65, 0x72, 0x73, + 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x76, + 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x07, 0x76, 0x65, + 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0xcb, 0x01, 0x0a, 0x10, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, + 0x72, 0x79, 0x4d, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x57, 0x0a, 0x0d, 0x6d, 0x75, + 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0e, 0x32, 0x32, 0x2e, 0x69, 0x63, 0x5f, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x5f, + 0x74, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x2e, 0x70, 0x62, 0x2e, 0x76, 0x31, 0x2e, + 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x4d, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x2e, 0x54, 0x79, 0x70, 0x65, 0x52, 0x0c, 0x6d, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, + 0x79, 0x70, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, + 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x36, 0x0a, 0x04, 0x54, + 0x79, 0x70, 0x65, 0x12, 0x0a, 0x0a, 0x06, 0x49, 0x4e, 0x53, 0x45, 0x52, 0x54, 0x10, 0x00, 0x12, + 0x0a, 0x0a, 0x06, 0x55, 0x50, 0x44, 0x41, 0x54, 0x45, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x44, + 0x45, 0x4c, 0x45, 0x54, 0x45, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x55, 0x50, 0x53, 0x45, 0x52, + 0x54, 0x10, 0x04, 0x22, 0x4b, 0x0a, 0x0c, 0x50, 0x72, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x69, 0x74, + 0x69, 0x6f, 0x6e, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, + 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x29, 0x0a, 0x10, 0x65, 0x78, 0x70, 0x65, 0x63, 0x74, 0x65, + 0x64, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, + 0x0f, 0x65, 0x78, 0x70, 0x65, 0x63, 0x74, 0x65, 0x64, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, + 0x22, 0xc1, 0x01, 0x0a, 0x1b, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x41, 0x74, 0x6f, + 0x6d, 0x69, 0x63, 0x4d, 0x75, 0x74, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x12, 0x4b, 0x0a, 0x09, 0x6d, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x01, 0x20, + 0x03, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x69, 0x63, 0x5f, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, + 0x79, 0x5f, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x2e, 0x70, 0x62, 0x2e, 0x76, + 0x31, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x4d, 0x75, 0x74, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x52, 0x09, 0x6d, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x4f, 0x0a, + 0x0d, 0x70, 0x72, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x05, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x69, 0x63, 0x5f, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, + 0x72, 0x79, 0x5f, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x2e, 0x70, 0x62, 0x2e, + 0x76, 0x31, 0x2e, 0x50, 0x72, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x52, + 0x0d, 0x70, 0x72, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x4a, 0x04, + 0x08, 0x04, 0x10, 0x05, 0x22, 0x7c, 0x0a, 0x1c, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, + 0x41, 0x74, 0x6f, 0x6d, 0x69, 0x63, 0x4d, 0x75, 0x74, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x42, 0x0a, 0x06, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x73, 0x18, 0x01, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x69, 0x63, 0x5f, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, + 0x72, 0x79, 0x5f, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x2e, 0x70, 0x62, 0x2e, + 0x76, 0x31, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x45, 0x72, 0x72, 0x6f, 0x72, + 0x52, 0x06, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, + 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, + 0x6f, 0x6e, 0x22, 0xad, 0x04, 0x0a, 0x0d, 0x4d, 0x69, 0x78, 0x65, 0x64, 0x48, 0x61, 0x73, 0x68, + 0x54, 0x72, 0x65, 0x65, 0x12, 0x2e, 0x0a, 0x05, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x48, 0x00, 0x52, 0x05, 0x65, + 0x6d, 0x70, 0x74, 0x79, 0x12, 0x45, 0x0a, 0x04, 0x66, 0x6f, 0x72, 0x6b, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x2f, 0x2e, 0x69, 0x63, 0x5f, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, + 0x5f, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x2e, 0x70, 0x62, 0x2e, 0x76, 0x31, + 0x2e, 0x4d, 0x69, 0x78, 0x65, 0x64, 0x48, 0x61, 0x73, 0x68, 0x54, 0x72, 0x65, 0x65, 0x2e, 0x46, + 0x6f, 0x72, 0x6b, 0x48, 0x00, 0x52, 0x04, 0x66, 0x6f, 0x72, 0x6b, 0x12, 0x4e, 0x0a, 0x07, 0x6c, + 0x61, 0x62, 0x65, 0x6c, 0x65, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x32, 0x2e, 0x69, + 0x63, 0x5f, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x5f, 0x74, 0x72, 0x61, 0x6e, 0x73, + 0x70, 0x6f, 0x72, 0x74, 0x2e, 0x70, 0x62, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x69, 0x78, 0x65, 0x64, + 0x48, 0x61, 0x73, 0x68, 0x54, 0x72, 0x65, 0x65, 0x2e, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x65, 0x64, + 0x48, 0x00, 0x52, 0x07, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x65, 0x64, 0x12, 0x1d, 0x0a, 0x09, 0x6c, + 0x65, 0x61, 0x66, 0x5f, 0x64, 0x61, 0x74, 0x61, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x48, 0x00, + 0x52, 0x08, 0x6c, 0x65, 0x61, 0x66, 0x44, 0x61, 0x74, 0x61, 0x12, 0x25, 0x0a, 0x0d, 0x70, 0x72, + 0x75, 0x6e, 0x65, 0x64, 0x5f, 0x64, 0x69, 0x67, 0x65, 0x73, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, + 0x0c, 0x48, 0x00, 0x52, 0x0c, 0x70, 0x72, 0x75, 0x6e, 0x65, 0x64, 0x44, 0x69, 0x67, 0x65, 0x73, + 0x74, 0x1a, 0x9a, 0x01, 0x0a, 0x04, 0x46, 0x6f, 0x72, 0x6b, 0x12, 0x47, 0x0a, 0x09, 0x6c, 0x65, + 0x66, 0x74, 0x5f, 0x74, 0x72, 0x65, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, + 0x69, 0x63, 0x5f, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x5f, 0x74, 0x72, 0x61, 0x6e, + 0x73, 0x70, 0x6f, 0x72, 0x74, 0x2e, 0x70, 0x62, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x69, 0x78, 0x65, + 0x64, 0x48, 0x61, 0x73, 0x68, 0x54, 0x72, 0x65, 0x65, 0x52, 0x08, 0x6c, 0x65, 0x66, 0x74, 0x54, + 0x72, 0x65, 0x65, 0x12, 0x49, 0x0a, 0x0a, 0x72, 0x69, 0x67, 0x68, 0x74, 0x5f, 0x74, 0x72, 0x65, + 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x69, 0x63, 0x5f, 0x72, 0x65, 0x67, + 0x69, 0x73, 0x74, 0x72, 0x79, 0x5f, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x2e, + 0x70, 0x62, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x69, 0x78, 0x65, 0x64, 0x48, 0x61, 0x73, 0x68, 0x54, + 0x72, 0x65, 0x65, 0x52, 0x09, 0x72, 0x69, 0x67, 0x68, 0x74, 0x54, 0x72, 0x65, 0x65, 0x1a, 0x65, + 0x0a, 0x07, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x65, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x61, 0x62, + 0x65, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x12, + 0x44, 0x0a, 0x07, 0x73, 0x75, 0x62, 0x74, 0x72, 0x65, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x2a, 0x2e, 0x69, 0x63, 0x5f, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x5f, 0x74, + 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x2e, 0x70, 0x62, 0x2e, 0x76, 0x31, 0x2e, 0x4d, + 0x69, 0x78, 0x65, 0x64, 0x48, 0x61, 0x73, 0x68, 0x54, 0x72, 0x65, 0x65, 0x52, 0x07, 0x73, 0x75, + 0x62, 0x74, 0x72, 0x65, 0x65, 0x42, 0x0b, 0x0a, 0x09, 0x74, 0x72, 0x65, 0x65, 0x5f, 0x65, 0x6e, + 0x75, 0x6d, 0x22, 0x7e, 0x0a, 0x11, 0x43, 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, 0x65, 0x64, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x47, 0x0a, 0x09, 0x68, 0x61, 0x73, 0x68, 0x5f, + 0x74, 0x72, 0x65, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x69, 0x63, 0x5f, + 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x5f, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, + 0x72, 0x74, 0x2e, 0x70, 0x62, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x69, 0x78, 0x65, 0x64, 0x48, 0x61, + 0x73, 0x68, 0x54, 0x72, 0x65, 0x65, 0x52, 0x08, 0x68, 0x61, 0x73, 0x68, 0x54, 0x72, 0x65, 0x65, + 0x12, 0x20, 0x0a, 0x0b, 0x63, 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x65, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0b, 0x63, 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, + 0x74, 0x65, 0x42, 0x0a, 0x5a, 0x08, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x76, 0x31, 0x62, 0x06, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +func file_transport_proto_init() { + if File_transport_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_transport_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RegistryError); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_transport_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RegistryValue); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_transport_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RegistryDelta); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_transport_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RegistryGetChangesSinceRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_transport_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RegistryGetChangesSinceResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_transport_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RegistryGetValueRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_transport_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RegistryGetValueResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_transport_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RegistryGetLatestVersionResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_transport_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RegistryMutation); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_transport_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Precondition); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_transport_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RegistryAtomicMutateRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_transport_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RegistryAtomicMutateResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_transport_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MixedHashTree); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_transport_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CertifiedResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_transport_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MixedHashTree_Fork); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_transport_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MixedHashTree_Labeled); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + file_transport_proto_msgTypes[12].OneofWrappers = []interface{}{ + (*MixedHashTree_Empty)(nil), + (*MixedHashTree_Fork_)(nil), + (*MixedHashTree_Labeled_)(nil), + (*MixedHashTree_LeafData)(nil), + (*MixedHashTree_PrunedDigest)(nil), + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_transport_proto_rawDesc, + NumEnums: 2, + NumMessages: 16, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_transport_proto_goTypes, + DependencyIndexes: file_transport_proto_depIdxs, + EnumInfos: file_transport_proto_enumTypes, + MessageInfos: file_transport_proto_msgTypes, + }.Build() + File_transport_proto = out.File + file_transport_proto_rawDesc = nil + file_transport_proto_goTypes = nil + file_transport_proto_depIdxs = nil +} + +func file_transport_proto_rawDescGZIP() []byte { + file_transport_proto_rawDescOnce.Do(func() { + file_transport_proto_rawDescData = protoimpl.X.CompressGZIP(file_transport_proto_rawDescData) + }) + return file_transport_proto_rawDescData +} + +func init() { file_transport_proto_init() } + +// Message encoding a response to any *_certified method call. +type CertifiedResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The hash tree encoding both the response and the intermediate + // nodes required to recompute the root hash stored in + // "certified_data" of the canister. + // + // Note that the contents of the tree depends on the type of request + // issued. + HashTree *MixedHashTree `protobuf:"bytes,1,opt,name=hash_tree,json=hashTree,proto3" json:"hash_tree,omitempty"` + // The certificate obtained from the system using + // ic0.data_certificate_copy. + Certificate []byte `protobuf:"bytes,2,opt,name=certificate,proto3" json:"certificate,omitempty"` +} + +// Deprecated: Use CertifiedResponse.ProtoReflect.Descriptor instead. +func (*CertifiedResponse) Descriptor() ([]byte, []int) { + return file_transport_proto_rawDescGZIP(), []int{13} +} + +func (x *CertifiedResponse) GetCertificate() []byte { + if x != nil { + return x.Certificate + } + return nil +} + +func (x *CertifiedResponse) GetHashTree() *MixedHashTree { + if x != nil { + return x.HashTree + } + return nil +} + +func (*CertifiedResponse) ProtoMessage() {} + +func (x *CertifiedResponse) ProtoReflect() protoreflect.Message { + mi := &file_transport_proto_msgTypes[13] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *CertifiedResponse) Reset() { + *x = CertifiedResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_transport_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CertifiedResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +type MixedHashTree struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Types that are assignable to TreeEnum: + // + // *MixedHashTree_Empty + // *MixedHashTree_Fork_ + // *MixedHashTree_Labeled_ + // *MixedHashTree_LeafData + // *MixedHashTree_PrunedDigest + TreeEnum isMixedHashTree_TreeEnum `protobuf_oneof:"tree_enum"` +} + +// Deprecated: Use MixedHashTree.ProtoReflect.Descriptor instead. +func (*MixedHashTree) Descriptor() ([]byte, []int) { + return file_transport_proto_rawDescGZIP(), []int{12} +} + +func (x *MixedHashTree) GetEmpty() *emptypb.Empty { + if x, ok := x.GetTreeEnum().(*MixedHashTree_Empty); ok { + return x.Empty + } + return nil +} + +func (x *MixedHashTree) GetFork() *MixedHashTree_Fork { + if x, ok := x.GetTreeEnum().(*MixedHashTree_Fork_); ok { + return x.Fork + } + return nil +} + +func (x *MixedHashTree) GetLabeled() *MixedHashTree_Labeled { + if x, ok := x.GetTreeEnum().(*MixedHashTree_Labeled_); ok { + return x.Labeled + } + return nil +} + +func (x *MixedHashTree) GetLeafData() []byte { + if x, ok := x.GetTreeEnum().(*MixedHashTree_LeafData); ok { + return x.LeafData + } + return nil +} + +func (x *MixedHashTree) GetPrunedDigest() []byte { + if x, ok := x.GetTreeEnum().(*MixedHashTree_PrunedDigest); ok { + return x.PrunedDigest + } + return nil +} + +func (m *MixedHashTree) GetTreeEnum() isMixedHashTree_TreeEnum { + if m != nil { + return m.TreeEnum + } + return nil +} + +func (*MixedHashTree) ProtoMessage() {} + +func (x *MixedHashTree) ProtoReflect() protoreflect.Message { + mi := &file_transport_proto_msgTypes[12] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *MixedHashTree) Reset() { + *x = MixedHashTree{} + if protoimpl.UnsafeEnabled { + mi := &file_transport_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MixedHashTree) String() string { + return protoimpl.X.MessageStringOf(x) +} + +type MixedHashTree_Empty struct { + Empty *emptypb.Empty `protobuf:"bytes,1,opt,name=empty,proto3,oneof"` +} + +func (*MixedHashTree_Empty) isMixedHashTree_TreeEnum() {} + +type MixedHashTree_Fork struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + LeftTree *MixedHashTree `protobuf:"bytes,1,opt,name=left_tree,json=leftTree,proto3" json:"left_tree,omitempty"` + RightTree *MixedHashTree `protobuf:"bytes,2,opt,name=right_tree,json=rightTree,proto3" json:"right_tree,omitempty"` +} + +// Deprecated: Use MixedHashTree_Fork.ProtoReflect.Descriptor instead. +func (*MixedHashTree_Fork) Descriptor() ([]byte, []int) { + return file_transport_proto_rawDescGZIP(), []int{12, 0} +} + +func (x *MixedHashTree_Fork) GetLeftTree() *MixedHashTree { + if x != nil { + return x.LeftTree + } + return nil +} + +func (x *MixedHashTree_Fork) GetRightTree() *MixedHashTree { + if x != nil { + return x.RightTree + } + return nil +} + +func (*MixedHashTree_Fork) ProtoMessage() {} + +func (x *MixedHashTree_Fork) ProtoReflect() protoreflect.Message { + mi := &file_transport_proto_msgTypes[14] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *MixedHashTree_Fork) Reset() { + *x = MixedHashTree_Fork{} + if protoimpl.UnsafeEnabled { + mi := &file_transport_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MixedHashTree_Fork) String() string { + return protoimpl.X.MessageStringOf(x) +} + +type MixedHashTree_Fork_ struct { + Fork *MixedHashTree_Fork `protobuf:"bytes,2,opt,name=fork,proto3,oneof"` +} + +func (*MixedHashTree_Fork_) isMixedHashTree_TreeEnum() {} + +type MixedHashTree_Labeled struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Label []byte `protobuf:"bytes,1,opt,name=label,proto3" json:"label,omitempty"` + Subtree *MixedHashTree `protobuf:"bytes,2,opt,name=subtree,proto3" json:"subtree,omitempty"` +} + +// Deprecated: Use MixedHashTree_Labeled.ProtoReflect.Descriptor instead. +func (*MixedHashTree_Labeled) Descriptor() ([]byte, []int) { + return file_transport_proto_rawDescGZIP(), []int{12, 1} +} + +func (x *MixedHashTree_Labeled) GetLabel() []byte { + if x != nil { + return x.Label + } + return nil +} + +func (x *MixedHashTree_Labeled) GetSubtree() *MixedHashTree { + if x != nil { + return x.Subtree + } + return nil +} + +func (*MixedHashTree_Labeled) ProtoMessage() {} + +func (x *MixedHashTree_Labeled) ProtoReflect() protoreflect.Message { + mi := &file_transport_proto_msgTypes[15] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *MixedHashTree_Labeled) Reset() { + *x = MixedHashTree_Labeled{} + if protoimpl.UnsafeEnabled { + mi := &file_transport_proto_msgTypes[15] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MixedHashTree_Labeled) String() string { + return protoimpl.X.MessageStringOf(x) +} + +type MixedHashTree_Labeled_ struct { + Labeled *MixedHashTree_Labeled `protobuf:"bytes,3,opt,name=labeled,proto3,oneof"` +} + +func (*MixedHashTree_Labeled_) isMixedHashTree_TreeEnum() {} + +type MixedHashTree_LeafData struct { + LeafData []byte `protobuf:"bytes,4,opt,name=leaf_data,json=leafData,proto3,oneof"` +} + +func (*MixedHashTree_LeafData) isMixedHashTree_TreeEnum() {} + +type MixedHashTree_PrunedDigest struct { + PrunedDigest []byte `protobuf:"bytes,5,opt,name=pruned_digest,json=prunedDigest,proto3,oneof"` +} + +func (*MixedHashTree_PrunedDigest) isMixedHashTree_TreeEnum() {} + +// A precondition on the version at which the value of a given key was +// last mutated. +type Precondition struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Key []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + // The precondition is satisfied if and only is the version in the + // RegistryValue for the key is equal to this. + ExpectedVersion uint64 `protobuf:"varint,2,opt,name=expected_version,json=expectedVersion,proto3" json:"expected_version,omitempty"` +} + +// Deprecated: Use Precondition.ProtoReflect.Descriptor instead. +func (*Precondition) Descriptor() ([]byte, []int) { + return file_transport_proto_rawDescGZIP(), []int{9} +} + +func (x *Precondition) GetExpectedVersion() uint64 { + if x != nil { + return x.ExpectedVersion + } + return 0 +} + +func (x *Precondition) GetKey() []byte { + if x != nil { + return x.Key + } + return nil +} + +func (*Precondition) ProtoMessage() {} + +func (x *Precondition) ProtoReflect() protoreflect.Message { + mi := &file_transport_proto_msgTypes[9] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *Precondition) Reset() { + *x = Precondition{} + if protoimpl.UnsafeEnabled { + mi := &file_transport_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Precondition) String() string { + return protoimpl.X.MessageStringOf(x) +} + +// Message corresponding to a list of mutations to apply, atomically, to the +// registry canister. If any of the mutations fails, the whole operation will fail. +type RegistryAtomicMutateRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The set of mutations to apply to the registry. + Mutations []*RegistryMutation `protobuf:"bytes,1,rep,name=mutations,proto3" json:"mutations,omitempty"` + // Preconditions at the key level. + Preconditions []*Precondition `protobuf:"bytes,5,rep,name=preconditions,proto3" json:"preconditions,omitempty"` +} + +// Deprecated: Use RegistryAtomicMutateRequest.ProtoReflect.Descriptor instead. +func (*RegistryAtomicMutateRequest) Descriptor() ([]byte, []int) { + return file_transport_proto_rawDescGZIP(), []int{10} +} + +func (x *RegistryAtomicMutateRequest) GetMutations() []*RegistryMutation { + if x != nil { + return x.Mutations + } + return nil +} + +func (x *RegistryAtomicMutateRequest) GetPreconditions() []*Precondition { + if x != nil { + return x.Preconditions + } + return nil +} + +func (*RegistryAtomicMutateRequest) ProtoMessage() {} + +func (x *RegistryAtomicMutateRequest) ProtoReflect() protoreflect.Message { + mi := &file_transport_proto_msgTypes[10] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *RegistryAtomicMutateRequest) Reset() { + *x = RegistryAtomicMutateRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_transport_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RegistryAtomicMutateRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +// Message corresponding to the response of an atomic_mutate request. If any of +// mutations failed the corresponding errors will be reflected in 'errors'. +// Otherwise 'version' will contain the version under which all the mutations +// were applied. +type RegistryAtomicMutateResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // If anything went wrong, the registry canister + // will set this error. + Errors []*RegistryError `protobuf:"bytes,1,rep,name=errors,proto3" json:"errors,omitempty"` + // The last version of the registry. + Version uint64 `protobuf:"varint,2,opt,name=version,proto3" json:"version,omitempty"` +} + +// Deprecated: Use RegistryAtomicMutateResponse.ProtoReflect.Descriptor instead. +func (*RegistryAtomicMutateResponse) Descriptor() ([]byte, []int) { + return file_transport_proto_rawDescGZIP(), []int{11} +} + +func (x *RegistryAtomicMutateResponse) GetErrors() []*RegistryError { + if x != nil { + return x.Errors + } + return nil +} + +func (x *RegistryAtomicMutateResponse) GetVersion() uint64 { + if x != nil { + return x.Version + } + return 0 +} + +func (*RegistryAtomicMutateResponse) ProtoMessage() {} + +func (x *RegistryAtomicMutateResponse) ProtoReflect() protoreflect.Message { + mi := &file_transport_proto_msgTypes[11] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *RegistryAtomicMutateResponse) Reset() { + *x = RegistryAtomicMutateResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_transport_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RegistryAtomicMutateResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +// A sequence of changes made to a key in the registry. +type RegistryDelta struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Key []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + Values []*RegistryValue `protobuf:"bytes,2,rep,name=values,proto3" json:"values,omitempty"` +} + +// Deprecated: Use RegistryDelta.ProtoReflect.Descriptor instead. +func (*RegistryDelta) Descriptor() ([]byte, []int) { + return file_transport_proto_rawDescGZIP(), []int{2} +} + +func (x *RegistryDelta) GetKey() []byte { + if x != nil { + return x.Key + } + return nil +} + +func (x *RegistryDelta) GetValues() []*RegistryValue { + if x != nil { + return x.Values + } + return nil +} + +func (*RegistryDelta) ProtoMessage() {} + +func (x *RegistryDelta) ProtoReflect() protoreflect.Message { + mi := &file_transport_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *RegistryDelta) Reset() { + *x = RegistryDelta{} + if protoimpl.UnsafeEnabled { + mi := &file_transport_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RegistryDelta) String() string { + return protoimpl.X.MessageStringOf(x) +} + +// Message corresponding to an error while performing +// an operation on the registry. +type RegistryError struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Code RegistryError_Code `protobuf:"varint,1,opt,name=code,proto3,enum=ic_registry_transport.pb.v1.RegistryError_Code" json:"code,omitempty"` + // The reason for the error. + // This is optional. + Reason string `protobuf:"bytes,2,opt,name=reason,proto3" json:"reason,omitempty"` + // The key on which the error occurred. + // This is optional and only present for by-key errors. + Key []byte `protobuf:"bytes,3,opt,name=key,proto3" json:"key,omitempty"` +} + +// Deprecated: Use RegistryError.ProtoReflect.Descriptor instead. +func (*RegistryError) Descriptor() ([]byte, []int) { + return file_transport_proto_rawDescGZIP(), []int{0} +} + +func (x *RegistryError) GetCode() RegistryError_Code { + if x != nil { + return x.Code + } + return RegistryError_MALFORMED_MESSAGE +} + +func (x *RegistryError) GetKey() []byte { + if x != nil { + return x.Key + } + return nil +} + +func (x *RegistryError) GetReason() string { + if x != nil { + return x.Reason + } + return "" +} + +func (*RegistryError) ProtoMessage() {} + +func (x *RegistryError) ProtoReflect() protoreflect.Message { + mi := &file_transport_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *RegistryError) Reset() { + *x = RegistryError{} + if protoimpl.UnsafeEnabled { + mi := &file_transport_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RegistryError) String() string { + return protoimpl.X.MessageStringOf(x) +} + +type RegistryError_Code int32 + +const ( + // The message had a problem like a missing field + // or a field that was set when it shouldn't. + RegistryError_MALFORMED_MESSAGE RegistryError_Code = 0 + // The 'key' specified on the request was not present + // in the registry. + RegistryError_KEY_NOT_PRESENT RegistryError_Code = 1 + // The 'key' specified on the request was already present. + RegistryError_KEY_ALREADY_PRESENT RegistryError_Code = 2 + // The 'version' specified in a precondition for a mutation + // was not the latest version. + RegistryError_VERSION_NOT_LATEST RegistryError_Code = 3 + // The 'version' specified in a precondition for a mutation + // is beyond the latest version in the registry. + RegistryError_VERSION_BEYOND_LATEST RegistryError_Code = 4 + // A generic internal error occurred in the registry. + RegistryError_INTERNAL_ERROR RegistryError_Code = 999 +) + +func (RegistryError_Code) Descriptor() protoreflect.EnumDescriptor { + return file_transport_proto_enumTypes[0].Descriptor() +} + +func (x RegistryError_Code) Enum() *RegistryError_Code { + p := new(RegistryError_Code) + *p = x + return p +} + +// Deprecated: Use RegistryError_Code.Descriptor instead. +func (RegistryError_Code) EnumDescriptor() ([]byte, []int) { + return file_transport_proto_rawDescGZIP(), []int{0, 0} +} + +func (x RegistryError_Code) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +func (x RegistryError_Code) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (RegistryError_Code) Type() protoreflect.EnumType { + return &file_transport_proto_enumTypes[0] +} + +// Message to retrieve all the changes from the registry +// since 'version'. +type RegistryGetChangesSinceRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Version uint64 `protobuf:"varint,1,opt,name=version,proto3" json:"version,omitempty"` +} + +// Deprecated: Use RegistryGetChangesSinceRequest.ProtoReflect.Descriptor instead. +func (*RegistryGetChangesSinceRequest) Descriptor() ([]byte, []int) { + return file_transport_proto_rawDescGZIP(), []int{3} +} + +func (x *RegistryGetChangesSinceRequest) GetVersion() uint64 { + if x != nil { + return x.Version + } + return 0 +} + +func (*RegistryGetChangesSinceRequest) ProtoMessage() {} + +func (x *RegistryGetChangesSinceRequest) ProtoReflect() protoreflect.Message { + mi := &file_transport_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *RegistryGetChangesSinceRequest) Reset() { + *x = RegistryGetChangesSinceRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_transport_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RegistryGetChangesSinceRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +// Message corresponding to the response from the registry +// canister to a get_latest_version() request. +type RegistryGetChangesSinceResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // If anything went wrong, the registry canister + // will set this error. + Error *RegistryError `protobuf:"bytes,1,opt,name=error,proto3" json:"error,omitempty"` + // The last version of the registry. + Version uint64 `protobuf:"varint,2,opt,name=version,proto3" json:"version,omitempty"` + // A list of all the keys and all the values that change + // and all the intermediate changes since the version + // requested. + Deltas []*RegistryDelta `protobuf:"bytes,3,rep,name=deltas,proto3" json:"deltas,omitempty"` +} + +// Deprecated: Use RegistryGetChangesSinceResponse.ProtoReflect.Descriptor instead. +func (*RegistryGetChangesSinceResponse) Descriptor() ([]byte, []int) { + return file_transport_proto_rawDescGZIP(), []int{4} +} + +func (x *RegistryGetChangesSinceResponse) GetDeltas() []*RegistryDelta { + if x != nil { + return x.Deltas + } + return nil +} + +func (x *RegistryGetChangesSinceResponse) GetError() *RegistryError { + if x != nil { + return x.Error + } + return nil +} + +func (x *RegistryGetChangesSinceResponse) GetVersion() uint64 { + if x != nil { + return x.Version + } + return 0 +} + +func (*RegistryGetChangesSinceResponse) ProtoMessage() {} + +func (x *RegistryGetChangesSinceResponse) ProtoReflect() protoreflect.Message { + mi := &file_transport_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *RegistryGetChangesSinceResponse) Reset() { + *x = RegistryGetChangesSinceResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_transport_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RegistryGetChangesSinceResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +// Message corresponding to the response from the canister +// to a get_latest_version() request. +type RegistryGetLatestVersionResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // the latest registry version + Version uint64 `protobuf:"varint,1,opt,name=version,proto3" json:"version,omitempty"` +} + +// Deprecated: Use RegistryGetLatestVersionResponse.ProtoReflect.Descriptor instead. +func (*RegistryGetLatestVersionResponse) Descriptor() ([]byte, []int) { + return file_transport_proto_rawDescGZIP(), []int{7} +} + +func (x *RegistryGetLatestVersionResponse) GetVersion() uint64 { + if x != nil { + return x.Version + } + return 0 +} + +func (*RegistryGetLatestVersionResponse) ProtoMessage() {} + +func (x *RegistryGetLatestVersionResponse) ProtoReflect() protoreflect.Message { + mi := &file_transport_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *RegistryGetLatestVersionResponse) Reset() { + *x = RegistryGetLatestVersionResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_transport_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RegistryGetLatestVersionResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +// Message to retrieve a version of some registry key +// from the registry canister. +type RegistryGetValueRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The version of the registry key to retrieve. + // Optional: If not set (or set to the default value, 0), the method + // will return the last version. + Version *wrapperspb.UInt64Value `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"` + // The byte array corresponding to the key to retrieve + // from the registry. + // Required. + Key []byte `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"` +} + +// Deprecated: Use RegistryGetValueRequest.ProtoReflect.Descriptor instead. +func (*RegistryGetValueRequest) Descriptor() ([]byte, []int) { + return file_transport_proto_rawDescGZIP(), []int{5} +} + +func (x *RegistryGetValueRequest) GetKey() []byte { + if x != nil { + return x.Key + } + return nil +} + +func (x *RegistryGetValueRequest) GetVersion() *wrapperspb.UInt64Value { + if x != nil { + return x.Version + } + return nil +} + +func (*RegistryGetValueRequest) ProtoMessage() {} + +func (x *RegistryGetValueRequest) ProtoReflect() protoreflect.Message { + mi := &file_transport_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *RegistryGetValueRequest) Reset() { + *x = RegistryGetValueRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_transport_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RegistryGetValueRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +// Message corresponding to the response from the canister +// to a get_value() request. +// +// Both 'version' and 'value' are mandatorily set if 'error' +// is not set. +type RegistryGetValueResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // If anything went wrong, the registry canister + // will set this error. + Error *RegistryError `protobuf:"bytes,1,opt,name=error,proto3" json:"error,omitempty"` + // the version at which the value corresponding to the queried + // key was last mutated (inserted, updated, or deleted) + // before at or at the version specified + // in the RegistryGetValueRequest. + Version uint64 `protobuf:"varint,2,opt,name=version,proto3" json:"version,omitempty"` + // The value retrieved from the registry. + Value []byte `protobuf:"bytes,3,opt,name=value,proto3" json:"value,omitempty"` +} + +// Deprecated: Use RegistryGetValueResponse.ProtoReflect.Descriptor instead. +func (*RegistryGetValueResponse) Descriptor() ([]byte, []int) { + return file_transport_proto_rawDescGZIP(), []int{6} +} + +func (x *RegistryGetValueResponse) GetError() *RegistryError { + if x != nil { + return x.Error + } + return nil +} + +func (x *RegistryGetValueResponse) GetValue() []byte { + if x != nil { + return x.Value + } + return nil +} + +func (x *RegistryGetValueResponse) GetVersion() uint64 { + if x != nil { + return x.Version + } + return 0 +} + +func (*RegistryGetValueResponse) ProtoMessage() {} + +func (x *RegistryGetValueResponse) ProtoReflect() protoreflect.Message { + mi := &file_transport_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *RegistryGetValueResponse) Reset() { + *x = RegistryGetValueResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_transport_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RegistryGetValueResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +// A single mutation in the registry. +type RegistryMutation struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The type of the mutation to apply to the registry. + // Always required. + MutationType RegistryMutation_Type `protobuf:"varint,1,opt,name=mutation_type,json=mutationType,proto3,enum=ic_registry_transport.pb.v1.RegistryMutation_Type" json:"mutation_type,omitempty"` + // The key of the entry to mutate in the registry. + // Always required. + Key []byte `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"` + // The value to mutate in the registry. + // Required for insert, update, but not for delete. + Value []byte `protobuf:"bytes,3,opt,name=value,proto3" json:"value,omitempty"` +} + +// Deprecated: Use RegistryMutation.ProtoReflect.Descriptor instead. +func (*RegistryMutation) Descriptor() ([]byte, []int) { + return file_transport_proto_rawDescGZIP(), []int{8} +} + +func (x *RegistryMutation) GetKey() []byte { + if x != nil { + return x.Key + } + return nil +} + +func (x *RegistryMutation) GetMutationType() RegistryMutation_Type { + if x != nil { + return x.MutationType + } + return RegistryMutation_INSERT +} + +func (x *RegistryMutation) GetValue() []byte { + if x != nil { + return x.Value + } + return nil +} + +func (*RegistryMutation) ProtoMessage() {} + +func (x *RegistryMutation) ProtoReflect() protoreflect.Message { + mi := &file_transport_proto_msgTypes[8] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +func (x *RegistryMutation) Reset() { + *x = RegistryMutation{} + if protoimpl.UnsafeEnabled { + mi := &file_transport_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RegistryMutation) String() string { + return protoimpl.X.MessageStringOf(x) +} + +type RegistryMutation_Type int32 + +const ( + // Key is expected to not exist in the registry at the current version. + // (This includes the case of a key that has existed in the past and + // later got deleted). + // The mutation will fail otherwise. + RegistryMutation_INSERT RegistryMutation_Type = 0 + // Key is expected to exist in the registry at the current version. + // The mutation will fail otherwise. + RegistryMutation_UPDATE RegistryMutation_Type = 1 + // Key is expected to exist in the registry at the current version. + // The mutation will fail otherwise. + RegistryMutation_DELETE RegistryMutation_Type = 2 + // If the key does not exist at the current version, it will be created. + // Otherwise, the value will be updated. The name is common in the + // database world, and means Update or Insert. + RegistryMutation_UPSERT RegistryMutation_Type = 4 +) + +func (RegistryMutation_Type) Descriptor() protoreflect.EnumDescriptor { + return file_transport_proto_enumTypes[1].Descriptor() +} + +func (x RegistryMutation_Type) Enum() *RegistryMutation_Type { + p := new(RegistryMutation_Type) + *p = x + return p +} + +// Deprecated: Use RegistryMutation_Type.Descriptor instead. +func (RegistryMutation_Type) EnumDescriptor() ([]byte, []int) { + return file_transport_proto_rawDescGZIP(), []int{8, 0} +} + +func (x RegistryMutation_Type) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +func (x RegistryMutation_Type) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (RegistryMutation_Type) Type() protoreflect.EnumType { + return &file_transport_proto_enumTypes[1] +} + +// A single change made to a key in the registry. +type RegistryValue struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The value that was set in this mutation. If the + // mutation is a deletion, the field has no meaning. + Value []byte `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"` + // The version at which this mutation happened. + Version uint64 `protobuf:"varint,2,opt,name=version,proto3" json:"version,omitempty"` + // If true, this change represents a deletion. + DeletionMarker bool `protobuf:"varint,3,opt,name=deletion_marker,json=deletionMarker,proto3" json:"deletion_marker,omitempty"` +} + +// Deprecated: Use RegistryValue.ProtoReflect.Descriptor instead. +func (*RegistryValue) Descriptor() ([]byte, []int) { + return file_transport_proto_rawDescGZIP(), []int{1} +} + +func (x *RegistryValue) GetDeletionMarker() bool { + if x != nil { + return x.DeletionMarker + } + return false +} + +func (x *RegistryValue) GetValue() []byte { + if x != nil { + return x.Value + } + return nil +} + +func (x *RegistryValue) GetVersion() uint64 { + if x != nil { + return x.Version + } + return 0 +} +func (*RegistryValue) ProtoMessage() {} +func (x *RegistryValue) ProtoReflect() protoreflect.Message { + mi := &file_transport_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} +func (x *RegistryValue) Reset() { + *x = RegistryValue{} + if protoimpl.UnsafeEnabled { + mi := &file_transport_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RegistryValue) String() string { + return protoimpl.X.MessageStringOf(x) +} + +type isMixedHashTree_TreeEnum interface { + isMixedHashTree_TreeEnum() +} diff --git a/registry/testdata/local.proto b/registry/testdata/local.proto new file mode 100644 index 0000000..b195455 --- /dev/null +++ b/registry/testdata/local.proto @@ -0,0 +1,46 @@ +// Protobuf message that are used in the local_store. + +syntax = "proto3"; + +package ic_registry_common.pb.local_store.v1; +option go_package = "proto/v1"; + +// Set of all mutations that, when applied to the registry at version v, +// produce the registry at version v+1 +message ChangelogEntry { + // The default, an empty list, is _invalid_ here. + repeated KeyMutation key_mutations = 1; +} + +// A mutation of a single key. +message KeyMutation { + // Key. + string key = 1; + + // Protobuf encoded value. + bytes value = 2; + + // If this is `UNSET`, `value` must assume the default value. + MutationType mutation_type = 3; +} + +enum MutationType { + // Illegal state. + INVALID_STATE = 0; + // The value was SET in this delta. + SET = 1; + // The value was UNSET in this delta. + UNSET = 2; +} + +// The time when the last certified update was successfully received. +message CertifiedTime { + // Number of nano seconds since UNIX EPOCH + uint64 unix_epoch_nanos = 1; +} + +// A changelog that is applicable at a specific registry version. +message Delta { + uint64 registry_version = 1; + repeated ChangelogEntry changelog = 2; +} diff --git a/registry/testdata/registry.proto b/registry/testdata/registry.proto new file mode 100644 index 0000000..d3acd94 --- /dev/null +++ b/registry/testdata/registry.proto @@ -0,0 +1,14 @@ +syntax = "proto3"; + +import "google/protobuf/wrappers.proto"; + +package ic_registry_common.pb.proto_registry.v1; +option go_package = "proto/v1"; + +message ProtoRegistry { repeated ProtoRegistryRecord records = 1; } + +message ProtoRegistryRecord { + string key = 1; + uint64 version = 2; + google.protobuf.BytesValue value = 3; +} diff --git a/registry/testdata/transport.proto b/registry/testdata/transport.proto new file mode 100644 index 0000000..1fe56f8 --- /dev/null +++ b/registry/testdata/transport.proto @@ -0,0 +1,241 @@ +syntax = "proto3"; + +// Set of messages used to interact with the registry canister. +// +// The registry canister implements the following three methods: +// +// get_latest_version(RegistryGetLatestVersionRequest) -> +// RegistryGetLatestVersionResponse +// +// get_value(RegistryGetValueRequest) -> RegistryGetValueResponse +// +// atomic_mutate(RegistryAtomicMutateRequest) -> RegistryAtomicMutateResponse +// +// get_latest_version() returns the latest version of the registry, i.e. the +// version of the last update made to the registry. +// +// get_value() returns the a value for specified version of a specified key from +// the registry, or the latest version if a version was not specified. +// get_value() returns a RegistryError if the key was not present. +// +// atomic_mutate() inserts, updates or deletes a set of keys in the registry. +// Mutations are atomic, meaning either all mutations are applied, or none +// are applied. +// +// Note that registry versions are always strictly >= 0, a -1 value is used +// to signal that no version was assigned. +package ic_registry_transport.pb.v1; +option go_package = "proto/v1"; + +import "google/protobuf/empty.proto"; +import "google/protobuf/wrappers.proto"; + +// Message corresponding to an error while performing +// an operation on the registry. +message RegistryError { + enum Code { + // The message had a problem like a missing field + // or a field that was set when it shouldn't. + MALFORMED_MESSAGE = 0; + // The 'key' specified on the request was not present + // in the registry. + KEY_NOT_PRESENT = 1; + // The 'key' specified on the request was already present. + KEY_ALREADY_PRESENT = 2; + // The 'version' specified in a precondition for a mutation + // was not the latest version. + VERSION_NOT_LATEST = 3; + // The 'version' specified in a precondition for a mutation + // is beyond the latest version in the registry. + VERSION_BEYOND_LATEST = 4; + + // A generic internal error occurred in the registry. + INTERNAL_ERROR = 999; + } + + Code code = 1; + + // The reason for the error. + // This is optional. + string reason = 2; + + // The key on which the error occurred. + // This is optional and only present for by-key errors. + bytes key = 3; +} + +// A single change made to a key in the registry. +message RegistryValue { + // The value that was set in this mutation. If the + // mutation is a deletion, the field has no meaning. + bytes value = 1; + + // The version at which this mutation happened. + uint64 version = 2; + + // If true, this change represents a deletion. + bool deletion_marker = 3; +} + +// A sequence of changes made to a key in the registry. +message RegistryDelta { + bytes key = 1; + repeated RegistryValue values = 2; +} + +// Message to retrieve all the changes from the registry +// since 'version'. +message RegistryGetChangesSinceRequest {uint64 version = 1;} + +// Message corresponding to the response from the registry +// canister to a get_latest_version() request. +message RegistryGetChangesSinceResponse { + // If anything went wrong, the registry canister + // will set this error. + RegistryError error = 1; + // The last version of the registry. + uint64 version = 2; + // A list of all the keys and all the values that change + // and all the intermediate changes since the version + // requested. + repeated RegistryDelta deltas = 3; +} + +// Message to retrieve a version of some registry key +// from the registry canister. +message RegistryGetValueRequest { + // The version of the registry key to retrieve. + // Optional: If not set (or set to the default value, 0), the method + // will return the last version. + google.protobuf.UInt64Value version = 1; + // The byte array corresponding to the key to retrieve + // from the registry. + // Required. + bytes key = 2; +} + +// Message corresponding to the response from the canister +// to a get_value() request. +// +// Both 'version' and 'value' are mandatorily set if 'error' +// is not set. +message RegistryGetValueResponse { + // If anything went wrong, the registry canister + // will set this error. + RegistryError error = 1; + // the version at which the value corresponding to the queried + // key was last mutated (inserted, updated, or deleted) + // before at or at the version specified + // in the RegistryGetValueRequest. + uint64 version = 2; + // The value retrieved from the registry. + bytes value = 3; +} + +// Message corresponding to the response from the canister +// to a get_latest_version() request. +message RegistryGetLatestVersionResponse { + // the latest registry version + uint64 version = 1; +} + +// A single mutation in the registry. +message RegistryMutation { + enum Type { + // Key is expected to not exist in the registry at the current version. + // (This includes the case of a key that has existed in the past and + // later got deleted). + // The mutation will fail otherwise. + INSERT = 0; + // Key is expected to exist in the registry at the current version. + // The mutation will fail otherwise. + UPDATE = 1; + // Key is expected to exist in the registry at the current version. + // The mutation will fail otherwise. + DELETE = 2; + // If the key does not exist at the current version, it will be created. + // Otherwise, the value will be updated. The name is common in the + // database world, and means Update or Insert. + UPSERT = 4; + } + + // The type of the mutation to apply to the registry. + // Always required. + Type mutation_type = 1; + + // The key of the entry to mutate in the registry. + // Always required. + bytes key = 2; + + // The value to mutate in the registry. + // Required for insert, update, but not for delete. + bytes value = 3; +} + +// A precondition on the version at which the value of a given key was +// last mutated. +message Precondition { + bytes key = 1; + + // The precondition is satisfied if and only is the version in the + // RegistryValue for the key is equal to this. + uint64 expected_version = 2; +} + +// Message corresponding to a list of mutations to apply, atomically, to the +// registry canister. If any of the mutations fails, the whole operation will fail. +message RegistryAtomicMutateRequest { + // The set of mutations to apply to the registry. + repeated RegistryMutation mutations = 1; + + // Preconditions at the key level. + repeated Precondition preconditions = 5; + + reserved 4; +} + +// Message corresponding to the response of an atomic_mutate request. If any of +// mutations failed the corresponding errors will be reflected in 'errors'. +// Otherwise 'version' will contain the version under which all the mutations +// were applied. +message RegistryAtomicMutateResponse { + // If anything went wrong, the registry canister + // will set this error. + repeated RegistryError errors = 1; + // The last version of the registry. + uint64 version = 2; +} + +message MixedHashTree { + message Fork { + MixedHashTree left_tree = 1; + MixedHashTree right_tree = 2; + } + + message Labeled { + bytes label = 1; + MixedHashTree subtree = 2; + } + + oneof tree_enum { + google.protobuf.Empty empty = 1; + Fork fork = 2; + Labeled labeled = 3; + bytes leaf_data = 4; + bytes pruned_digest = 5; + } +} + +// Message encoding a response to any *_certified method call. +message CertifiedResponse { + // The hash tree encoding both the response and the intermediate + // nodes required to recompute the root hash stored in + // "certified_data" of the canister. + // + // Note that the contents of the tree depends on the type of request + // issued. + MixedHashTree hash_tree = 1; + // The certificate obtained from the system using + // ic0.data_certificate_copy. + bytes certificate = 2; +}