diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 7b9615c..72f84c3 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -1,4 +1,4 @@ -name: CD +name: Releases on: push: tags: @@ -15,19 +15,21 @@ jobs: fetch-depth: 0 - name: Set up Go - uses: actions/setup-go@v4 + uses: actions/setup-go@v5 with: - go-version: 1.21.x + go-version: 1.23.x - name: Import GPG key id: import_gpg - uses: crazy-max/ghaction-import-gpg@v3 + uses: crazy-max/ghaction-import-gpg@v6 with: - gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }} + gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} passphrase: ${{ secrets.PASSPHRASE }} + git_user_signingkey: true + git_commit_gpgsign: true - name: Create Release - uses: goreleaser/goreleaser-action@v5 + uses: goreleaser/goreleaser-action@v6 with: distribution: goreleaser version: latest diff --git a/.github/workflows/build.yaml b/.github/workflows/tests.yaml similarity index 83% rename from .github/workflows/build.yaml rename to .github/workflows/tests.yaml index 3120db7..667c1e6 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/tests.yaml @@ -1,9 +1,8 @@ -name: CI +name: Tests on: push: branches: - main - - develop - "v*" tags: - "v*" @@ -15,12 +14,12 @@ jobs: runs-on: ubuntu-latest steps: - name: Set up Go - uses: actions/setup-go@v4 + uses: actions/setup-go@v5 with: - go-version: 1.21.x + go-version: 1.23.x - name: Install Staticcheck - run: go install honnef.co/go/tools/cmd/staticcheck@2023.1.3 + run: go install honnef.co/go/tools/cmd/staticcheck@2024.1.1 - name: Checkout Code uses: actions/checkout@v4 @@ -34,7 +33,7 @@ jobs: strategy: fail-fast: true matrix: - go-version: [1.20.x, 1.21.x] + go-version: [1.22.x, 1.23.x] env: GOPATH: ${{ github.workspace }}/go GOBIN: ${{ github.workspace }}/go/bin @@ -44,12 +43,12 @@ jobs: working-directory: ${{ env.GOPATH }}/src/github.com/rotationalio/honu steps: - name: Set up Go - uses: actions/setup-go@v4 + uses: actions/setup-go@v5 with: go-version: ${{ matrix.go-version }} - name: Cache Speedup - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ${{ env.GOPATH }}/pkg/mod key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} @@ -62,16 +61,16 @@ jobs: path: ${{ env.GOPATH }}/src/github.com/rotationalio/honu - name: Install Protoc - uses: arduino/setup-protoc@v2 + uses: arduino/setup-protoc@v3 with: - version: "23.x" + version: "28.x" repo-token: ${{ secrets.GITHUB_TOKEN }} - name: Install Dependencies run: | go version - go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.31 - go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.3 + go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.35 + go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.5 - name: Code Generation run: go generate ./... @@ -90,12 +89,12 @@ jobs: working-directory: ${{ env.GOPATH }}/src/github.com/rotationalio/honu steps: - name: Set up Go - uses: actions/setup-go@v4 + uses: actions/setup-go@v5 with: - go-version: 1.21.x + go-version: 1.23.x - name: Cache Speedup - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ${{ env.GOPATH }}/pkg/mod key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} @@ -108,16 +107,16 @@ jobs: path: ${{ env.GOPATH }}/src/github.com/rotationalio/honu - name: Install Protoc - uses: arduino/setup-protoc@v2 + uses: arduino/setup-protoc@v3 with: - version: "23.x" + version: "28.x" repo-token: ${{ secrets.GITHUB_TOKEN }} - name: Install Dependencies run: | go version - go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.31 - go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.3 + go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.35 + go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.5 - name: Code Generation run: go generate ./... diff --git a/.goreleaser.yml b/.goreleaser.yml index 5208299..764b490 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -2,10 +2,10 @@ project_name: honu dist: dist builds: # Define multiple builds as a yaml list, specify by a unique id - - id: "cmd-honu-build" + - id: "cmd-honudb-build" dir: . - main: ./cmd/honu - binary: honu + main: ./cmd/honudb + binary: honudb flags: - -v ldflags: -s -w -X github.com/rotationalio/honu.GitVersion={{.Commit}} -X github.com/rotationalio/honu.BuildDate={{.Date}} @@ -31,7 +31,7 @@ archives: - id: "honu-archive-tgz" format: tar.gz builds: - - "cmd-honu-build" + - "cmd-honudb-build" name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}" wrap_in_directory: true files: @@ -62,11 +62,11 @@ release: footer: | ### About - Honu is distributed key-value store that is intended for large systems of replicas - that are distributed across the globe. Honu provides an eventually consistent - replication semantic that uses reinforcement learning to optimize replication to - lower both costs and the instances of stale reads and write forks. If you're - interested in this project, please see https://geodistributed.systems for more. + The Honu Database is an eventually consistent replicated document database that + is intended for large systems that are distributed globally. Honu uses reinforcement + learning with anti-entropy replication to enhance consistency and decrease costs. + Honu provides data governance with access controls, privacy, and provenance tracking + so that the use of your database complies with laws like GDPR. # If set to true, will not auto-publish the release. disable: false diff --git a/LICENSE b/LICENSE index 0c62d27..99faf3e 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ BSD 3-Clause License -Copyright (c) 2021, Rotational Labs, Inc. +Copyright (c) 2024, Rotational Labs, Inc. All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/README.md b/README.md index cc8592d..0d3fdfc 100644 --- a/README.md +++ b/README.md @@ -1,25 +1,10 @@ # Honu -[![Go Reference](https://pkg.go.dev/badge/github.com/rotationalio/honu.svg)](https://pkg.go.dev/github.com/rotationalio/honu) [![Go Report Card](https://goreportcard.com/badge/github.com/rotationalio/honu)](https://goreportcard.com/report/github.com/rotationalio/honu) -![GitHub Actions CI](https://github.com/rotationalio/honu/actions/workflows/build.yaml/badge.svg?branch=main) +![GitHub Actions CI](https://github.com/rotationalio/honu/actions/workflows/tests.yaml/badge.svg?branch=main) -**HonuDB is a replicated key-value store intended for large systems that are distributed globally. Although HonuDB uses an eventually consistent gossip protocol for replication, it uses reinforcement learning with multi-armed bandits to optimize replication. Adaptive consistency reduces costs (ingress and egress data transfer) as well as improves consistency by lowering the likelihood of stale reads or forked writes.** +The Honu Database is an eventually consistent replicated document database that intended for large systems that are distributed globally. Honu uses smart anti-entropy replication to quickly replicate collections across multiple nodes. -## Benchmarks +Smart anti-entropy uses reinforcement learning with multi-armed bandits to optimize replication. Adaptive consistency reduces costs (ingress and egress data transfer) as well as improves consistency by lowering the likelihood of stale reads or forked writes. -Baseline comparison of honu database vs. pure leveldb performance to determine the overhead that honu adds: - -``` -BenchmarkHonuGet-8 466665 2405 ns/op -BenchmarkLevelDBGet-8 1243785 955.3 ns/op -BenchmarkHonuPut-8 21448 55125 ns/op -BenchmarkLevelDBPut-8 24276 52422 ns/op -BenchmarkHonuDelete-8 42298 25136 ns/op -BenchmarkLevelDBDelete-8 76857 16101 ns/op -BenchmarkHonuIter-8 63772 18349 ns/op -BenchmarkLevelDBIter-8 255319 4271 ns/op -BenchmarkHonuObject-8 480555 2362 ns/op -``` - -[![Baseline Benchmarks](docs/benchmark.png)](docs/benchmark.png) \ No newline at end of file +The goal of the database is to provide scalable data retrieval both in terms of number of nodes (e.g. scale to 100s of nodes) and amount of data (hundreds of terabytes). In addition to scale, this database provides data access controls, privacy and provenance, and other security related features. In short, HonuDB is a distributed data governance database for machine learning and artificial intelligence workloads. diff --git a/api/generate.go b/api/generate.go deleted file mode 100644 index 6988598..0000000 --- a/api/generate.go +++ /dev/null @@ -1,3 +0,0 @@ -package api - -//go:generate bash generate.sh diff --git a/api/generate.sh b/api/generate.sh deleted file mode 100644 index f0fe4da..0000000 --- a/api/generate.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash - -PROTOS="${GOPATH}/src/github.com/rotationalio/honu/proto" - -if [[ ! -d $PROTOS ]]; then - echo "cannot find ${PROTOS}" - exit 1 -fi - -if [[ ! -d "./v1" ]]; then - mkdir v1 -fi - -MODULE="github.com/rotationalio/honu/api/v1" -APIMOD="github.com/rotationalio/honu/api/v1;api" - -# Generate the protocol buffers -protoc -I=${PROTOS} \ - --go_out=./v1 --go-grpc_out=./v1 \ - --go_opt=module=${MODULE} \ - --go-grpc_opt=module=${MODULE} \ - --go_opt=Mhonu/v1/honu.proto="${APIMOD}" \ - --go-grpc_opt=Mhonu/v1/honu.proto="${APIMOD}" \ - honu/v1/honu.proto \ No newline at end of file diff --git a/api/v1/honu.pb.go b/api/v1/honu.pb.go deleted file mode 100644 index 167331e..0000000 --- a/api/v1/honu.pb.go +++ /dev/null @@ -1,2285 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.34.1 -// protoc v5.26.1 -// source: honu/v1/honu.proto - -package api - -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) -) - -type GetRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Key []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` - Namespace string `protobuf:"bytes,2,opt,name=namespace,proto3" json:"namespace,omitempty"` - Options *Options `protobuf:"bytes,3,opt,name=options,proto3" json:"options,omitempty"` -} - -func (x *GetRequest) Reset() { - *x = GetRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_honu_v1_honu_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GetRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GetRequest) ProtoMessage() {} - -func (x *GetRequest) ProtoReflect() protoreflect.Message { - mi := &file_honu_v1_honu_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) -} - -// Deprecated: Use GetRequest.ProtoReflect.Descriptor instead. -func (*GetRequest) Descriptor() ([]byte, []int) { - return file_honu_v1_honu_proto_rawDescGZIP(), []int{0} -} - -func (x *GetRequest) GetKey() []byte { - if x != nil { - return x.Key - } - return nil -} - -func (x *GetRequest) GetNamespace() string { - if x != nil { - return x.Namespace - } - return "" -} - -func (x *GetRequest) GetOptions() *Options { - if x != nil { - return x.Options - } - return nil -} - -type GetReply struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Value []byte `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"` - Meta *Meta `protobuf:"bytes,2,opt,name=meta,proto3" json:"meta,omitempty"` // will only be supplied if return_meta=true in options -} - -func (x *GetReply) Reset() { - *x = GetReply{} - if protoimpl.UnsafeEnabled { - mi := &file_honu_v1_honu_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GetReply) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GetReply) ProtoMessage() {} - -func (x *GetReply) ProtoReflect() protoreflect.Message { - mi := &file_honu_v1_honu_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) -} - -// Deprecated: Use GetReply.ProtoReflect.Descriptor instead. -func (*GetReply) Descriptor() ([]byte, []int) { - return file_honu_v1_honu_proto_rawDescGZIP(), []int{1} -} - -func (x *GetReply) GetValue() []byte { - if x != nil { - return x.Value - } - return nil -} - -func (x *GetReply) GetMeta() *Meta { - if x != nil { - return x.Meta - } - return nil -} - -type PutRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Key []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` - Value []byte `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` - Namespace string `protobuf:"bytes,3,opt,name=namespace,proto3" json:"namespace,omitempty"` - Options *Options `protobuf:"bytes,4,opt,name=options,proto3" json:"options,omitempty"` -} - -func (x *PutRequest) Reset() { - *x = PutRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_honu_v1_honu_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PutRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PutRequest) ProtoMessage() {} - -func (x *PutRequest) ProtoReflect() protoreflect.Message { - mi := &file_honu_v1_honu_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) -} - -// Deprecated: Use PutRequest.ProtoReflect.Descriptor instead. -func (*PutRequest) Descriptor() ([]byte, []int) { - return file_honu_v1_honu_proto_rawDescGZIP(), []int{2} -} - -func (x *PutRequest) GetKey() []byte { - if x != nil { - return x.Key - } - return nil -} - -func (x *PutRequest) GetValue() []byte { - if x != nil { - return x.Value - } - return nil -} - -func (x *PutRequest) GetNamespace() string { - if x != nil { - return x.Namespace - } - return "" -} - -func (x *PutRequest) GetOptions() *Options { - if x != nil { - return x.Options - } - return nil -} - -type PutReply struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` - Meta *Meta `protobuf:"bytes,2,opt,name=meta,proto3" json:"meta,omitempty"` // will only be supplied if return_meta=true in options -} - -func (x *PutReply) Reset() { - *x = PutReply{} - if protoimpl.UnsafeEnabled { - mi := &file_honu_v1_honu_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PutReply) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PutReply) ProtoMessage() {} - -func (x *PutReply) ProtoReflect() protoreflect.Message { - mi := &file_honu_v1_honu_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) -} - -// Deprecated: Use PutReply.ProtoReflect.Descriptor instead. -func (*PutReply) Descriptor() ([]byte, []int) { - return file_honu_v1_honu_proto_rawDescGZIP(), []int{3} -} - -func (x *PutReply) GetSuccess() bool { - if x != nil { - return x.Success - } - return false -} - -func (x *PutReply) GetMeta() *Meta { - if x != nil { - return x.Meta - } - return nil -} - -type DeleteRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Key []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` - Namespace string `protobuf:"bytes,2,opt,name=namespace,proto3" json:"namespace,omitempty"` - Options *Options `protobuf:"bytes,3,opt,name=options,proto3" json:"options,omitempty"` // if return_meta=true then the meta of the version deleted is returned -} - -func (x *DeleteRequest) Reset() { - *x = DeleteRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_honu_v1_honu_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *DeleteRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*DeleteRequest) ProtoMessage() {} - -func (x *DeleteRequest) ProtoReflect() protoreflect.Message { - mi := &file_honu_v1_honu_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) -} - -// Deprecated: Use DeleteRequest.ProtoReflect.Descriptor instead. -func (*DeleteRequest) Descriptor() ([]byte, []int) { - return file_honu_v1_honu_proto_rawDescGZIP(), []int{4} -} - -func (x *DeleteRequest) GetKey() []byte { - if x != nil { - return x.Key - } - return nil -} - -func (x *DeleteRequest) GetNamespace() string { - if x != nil { - return x.Namespace - } - return "" -} - -func (x *DeleteRequest) GetOptions() *Options { - if x != nil { - return x.Options - } - return nil -} - -type DeleteReply struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` - Meta *Meta `protobuf:"bytes,2,opt,name=meta,proto3" json:"meta,omitempty"` // will only be supplied if return_meta=true in options -} - -func (x *DeleteReply) Reset() { - *x = DeleteReply{} - if protoimpl.UnsafeEnabled { - mi := &file_honu_v1_honu_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *DeleteReply) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*DeleteReply) ProtoMessage() {} - -func (x *DeleteReply) ProtoReflect() protoreflect.Message { - mi := &file_honu_v1_honu_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) -} - -// Deprecated: Use DeleteReply.ProtoReflect.Descriptor instead. -func (*DeleteReply) Descriptor() ([]byte, []int) { - return file_honu_v1_honu_proto_rawDescGZIP(), []int{5} -} - -func (x *DeleteReply) GetSuccess() bool { - if x != nil { - return x.Success - } - return false -} - -func (x *DeleteReply) GetMeta() *Meta { - if x != nil { - return x.Meta - } - return nil -} - -type IterRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Prefix []byte `protobuf:"bytes,1,opt,name=prefix,proto3" json:"prefix,omitempty"` // the prefix to range over, if nil all objects are returned - Namespace string `protobuf:"bytes,2,opt,name=namespace,proto3" json:"namespace,omitempty"` - Options *Options `protobuf:"bytes,3,opt,name=options,proto3" json:"options,omitempty"` -} - -func (x *IterRequest) Reset() { - *x = IterRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_honu_v1_honu_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *IterRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*IterRequest) ProtoMessage() {} - -func (x *IterRequest) ProtoReflect() protoreflect.Message { - mi := &file_honu_v1_honu_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) -} - -// Deprecated: Use IterRequest.ProtoReflect.Descriptor instead. -func (*IterRequest) Descriptor() ([]byte, []int) { - return file_honu_v1_honu_proto_rawDescGZIP(), []int{6} -} - -func (x *IterRequest) GetPrefix() []byte { - if x != nil { - return x.Prefix - } - return nil -} - -func (x *IterRequest) GetNamespace() string { - if x != nil { - return x.Namespace - } - return "" -} - -func (x *IterRequest) GetOptions() *Options { - if x != nil { - return x.Options - } - return nil -} - -type IterReply struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Values []*KVPair `protobuf:"bytes,1,rep,name=values,proto3" json:"values,omitempty"` - NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"` -} - -func (x *IterReply) Reset() { - *x = IterReply{} - if protoimpl.UnsafeEnabled { - mi := &file_honu_v1_honu_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *IterReply) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*IterReply) ProtoMessage() {} - -func (x *IterReply) ProtoReflect() protoreflect.Message { - mi := &file_honu_v1_honu_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) -} - -// Deprecated: Use IterReply.ProtoReflect.Descriptor instead. -func (*IterReply) Descriptor() ([]byte, []int) { - return file_honu_v1_honu_proto_rawDescGZIP(), []int{7} -} - -func (x *IterReply) GetValues() []*KVPair { - if x != nil { - return x.Values - } - return nil -} - -func (x *IterReply) GetNextPageToken() string { - if x != nil { - return x.NextPageToken - } - return "" -} - -type BatchRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` - // Types that are assignable to Request: - // - // *BatchRequest_Put - // *BatchRequest_Delete - Request isBatchRequest_Request `protobuf_oneof:"request"` -} - -func (x *BatchRequest) Reset() { - *x = BatchRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_honu_v1_honu_proto_msgTypes[8] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *BatchRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*BatchRequest) ProtoMessage() {} - -func (x *BatchRequest) ProtoReflect() protoreflect.Message { - mi := &file_honu_v1_honu_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) -} - -// Deprecated: Use BatchRequest.ProtoReflect.Descriptor instead. -func (*BatchRequest) Descriptor() ([]byte, []int) { - return file_honu_v1_honu_proto_rawDescGZIP(), []int{8} -} - -func (x *BatchRequest) GetId() int64 { - if x != nil { - return x.Id - } - return 0 -} - -func (m *BatchRequest) GetRequest() isBatchRequest_Request { - if m != nil { - return m.Request - } - return nil -} - -func (x *BatchRequest) GetPut() *PutRequest { - if x, ok := x.GetRequest().(*BatchRequest_Put); ok { - return x.Put - } - return nil -} - -func (x *BatchRequest) GetDelete() *DeleteRequest { - if x, ok := x.GetRequest().(*BatchRequest_Delete); ok { - return x.Delete - } - return nil -} - -type isBatchRequest_Request interface { - isBatchRequest_Request() -} - -type BatchRequest_Put struct { - Put *PutRequest `protobuf:"bytes,2,opt,name=put,proto3,oneof"` -} - -type BatchRequest_Delete struct { - Delete *DeleteRequest `protobuf:"bytes,3,opt,name=delete,proto3,oneof"` -} - -func (*BatchRequest_Put) isBatchRequest_Request() {} - -func (*BatchRequest_Delete) isBatchRequest_Request() {} - -type BatchReply struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Operations int64 `protobuf:"varint,1,opt,name=operations,proto3" json:"operations,omitempty"` - Successful int64 `protobuf:"varint,2,opt,name=successful,proto3" json:"successful,omitempty"` - Failed int64 `protobuf:"varint,3,opt,name=failed,proto3" json:"failed,omitempty"` - Errors []*BatchReply_Error `protobuf:"bytes,4,rep,name=errors,proto3" json:"errors,omitempty"` -} - -func (x *BatchReply) Reset() { - *x = BatchReply{} - if protoimpl.UnsafeEnabled { - mi := &file_honu_v1_honu_proto_msgTypes[9] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *BatchReply) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*BatchReply) ProtoMessage() {} - -func (x *BatchReply) ProtoReflect() protoreflect.Message { - mi := &file_honu_v1_honu_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) -} - -// Deprecated: Use BatchReply.ProtoReflect.Descriptor instead. -func (*BatchReply) Descriptor() ([]byte, []int) { - return file_honu_v1_honu_proto_rawDescGZIP(), []int{9} -} - -func (x *BatchReply) GetOperations() int64 { - if x != nil { - return x.Operations - } - return 0 -} - -func (x *BatchReply) GetSuccessful() int64 { - if x != nil { - return x.Successful - } - return 0 -} - -func (x *BatchReply) GetFailed() int64 { - if x != nil { - return x.Failed - } - return 0 -} - -func (x *BatchReply) GetErrors() []*BatchReply_Error { - if x != nil { - return x.Errors - } - return nil -} - -type CursorRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Prefix []byte `protobuf:"bytes,1,opt,name=prefix,proto3" json:"prefix,omitempty"` // the prefix to range over, if nil all objects are returned - SeekKey []byte `protobuf:"bytes,2,opt,name=seek_key,json=seekKey,proto3" json:"seek_key,omitempty"` // a key to seekto within the prefix (optional) - Namespace string `protobuf:"bytes,3,opt,name=namespace,proto3" json:"namespace,omitempty"` - Options *Options `protobuf:"bytes,4,opt,name=options,proto3" json:"options,omitempty"` -} - -func (x *CursorRequest) Reset() { - *x = CursorRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_honu_v1_honu_proto_msgTypes[10] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *CursorRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CursorRequest) ProtoMessage() {} - -func (x *CursorRequest) ProtoReflect() protoreflect.Message { - mi := &file_honu_v1_honu_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) -} - -// Deprecated: Use CursorRequest.ProtoReflect.Descriptor instead. -func (*CursorRequest) Descriptor() ([]byte, []int) { - return file_honu_v1_honu_proto_rawDescGZIP(), []int{10} -} - -func (x *CursorRequest) GetPrefix() []byte { - if x != nil { - return x.Prefix - } - return nil -} - -func (x *CursorRequest) GetSeekKey() []byte { - if x != nil { - return x.SeekKey - } - return nil -} - -func (x *CursorRequest) GetNamespace() string { - if x != nil { - return x.Namespace - } - return "" -} - -func (x *CursorRequest) GetOptions() *Options { - if x != nil { - return x.Options - } - return nil -} - -type SyncRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` - // Types that are assignable to Request: - // - // *SyncRequest_Get - // *SyncRequest_Put - // *SyncRequest_Delete - // *SyncRequest_Iter - Request isSyncRequest_Request `protobuf_oneof:"request"` -} - -func (x *SyncRequest) Reset() { - *x = SyncRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_honu_v1_honu_proto_msgTypes[11] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *SyncRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SyncRequest) ProtoMessage() {} - -func (x *SyncRequest) ProtoReflect() protoreflect.Message { - mi := &file_honu_v1_honu_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) -} - -// Deprecated: Use SyncRequest.ProtoReflect.Descriptor instead. -func (*SyncRequest) Descriptor() ([]byte, []int) { - return file_honu_v1_honu_proto_rawDescGZIP(), []int{11} -} - -func (x *SyncRequest) GetId() int64 { - if x != nil { - return x.Id - } - return 0 -} - -func (m *SyncRequest) GetRequest() isSyncRequest_Request { - if m != nil { - return m.Request - } - return nil -} - -func (x *SyncRequest) GetGet() *GetRequest { - if x, ok := x.GetRequest().(*SyncRequest_Get); ok { - return x.Get - } - return nil -} - -func (x *SyncRequest) GetPut() *PutRequest { - if x, ok := x.GetRequest().(*SyncRequest_Put); ok { - return x.Put - } - return nil -} - -func (x *SyncRequest) GetDelete() *DeleteRequest { - if x, ok := x.GetRequest().(*SyncRequest_Delete); ok { - return x.Delete - } - return nil -} - -func (x *SyncRequest) GetIter() *IterRequest { - if x, ok := x.GetRequest().(*SyncRequest_Iter); ok { - return x.Iter - } - return nil -} - -type isSyncRequest_Request interface { - isSyncRequest_Request() -} - -type SyncRequest_Get struct { - Get *GetRequest `protobuf:"bytes,2,opt,name=get,proto3,oneof"` -} - -type SyncRequest_Put struct { - Put *PutRequest `protobuf:"bytes,3,opt,name=put,proto3,oneof"` -} - -type SyncRequest_Delete struct { - Delete *DeleteRequest `protobuf:"bytes,4,opt,name=delete,proto3,oneof"` -} - -type SyncRequest_Iter struct { - Iter *IterRequest `protobuf:"bytes,5,opt,name=iter,proto3,oneof"` -} - -func (*SyncRequest_Get) isSyncRequest_Request() {} - -func (*SyncRequest_Put) isSyncRequest_Request() {} - -func (*SyncRequest_Delete) isSyncRequest_Request() {} - -func (*SyncRequest_Iter) isSyncRequest_Request() {} - -type SyncReply struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` - Success bool `protobuf:"varint,2,opt,name=success,proto3" json:"success,omitempty"` - Error string `protobuf:"bytes,3,opt,name=error,proto3" json:"error,omitempty"` - // Types that are assignable to Reply: - // - // *SyncReply_Get - // *SyncReply_Put - // *SyncReply_Delete - // *SyncReply_Iter - Reply isSyncReply_Reply `protobuf_oneof:"reply"` -} - -func (x *SyncReply) Reset() { - *x = SyncReply{} - if protoimpl.UnsafeEnabled { - mi := &file_honu_v1_honu_proto_msgTypes[12] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *SyncReply) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SyncReply) ProtoMessage() {} - -func (x *SyncReply) ProtoReflect() protoreflect.Message { - mi := &file_honu_v1_honu_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) -} - -// Deprecated: Use SyncReply.ProtoReflect.Descriptor instead. -func (*SyncReply) Descriptor() ([]byte, []int) { - return file_honu_v1_honu_proto_rawDescGZIP(), []int{12} -} - -func (x *SyncReply) GetId() int64 { - if x != nil { - return x.Id - } - return 0 -} - -func (x *SyncReply) GetSuccess() bool { - if x != nil { - return x.Success - } - return false -} - -func (x *SyncReply) GetError() string { - if x != nil { - return x.Error - } - return "" -} - -func (m *SyncReply) GetReply() isSyncReply_Reply { - if m != nil { - return m.Reply - } - return nil -} - -func (x *SyncReply) GetGet() *GetReply { - if x, ok := x.GetReply().(*SyncReply_Get); ok { - return x.Get - } - return nil -} - -func (x *SyncReply) GetPut() *PutReply { - if x, ok := x.GetReply().(*SyncReply_Put); ok { - return x.Put - } - return nil -} - -func (x *SyncReply) GetDelete() *DeleteReply { - if x, ok := x.GetReply().(*SyncReply_Delete); ok { - return x.Delete - } - return nil -} - -func (x *SyncReply) GetIter() *IterReply { - if x, ok := x.GetReply().(*SyncReply_Iter); ok { - return x.Iter - } - return nil -} - -type isSyncReply_Reply interface { - isSyncReply_Reply() -} - -type SyncReply_Get struct { - Get *GetReply `protobuf:"bytes,4,opt,name=get,proto3,oneof"` -} - -type SyncReply_Put struct { - Put *PutReply `protobuf:"bytes,5,opt,name=put,proto3,oneof"` -} - -type SyncReply_Delete struct { - Delete *DeleteReply `protobuf:"bytes,6,opt,name=delete,proto3,oneof"` -} - -type SyncReply_Iter struct { - Iter *IterReply `protobuf:"bytes,7,opt,name=iter,proto3,oneof"` -} - -func (*SyncReply_Get) isSyncReply_Reply() {} - -func (*SyncReply_Put) isSyncReply_Reply() {} - -func (*SyncReply_Delete) isSyncReply_Reply() {} - -func (*SyncReply_Iter) isSyncReply_Reply() {} - -type CountRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Prefix []byte `protobuf:"bytes,1,opt,name=prefix,proto3" json:"prefix,omitempty"` // the prefix to range over, if nil all objects are counted - SeekKey []byte `protobuf:"bytes,2,opt,name=seek_key,json=seekKey,proto3" json:"seek_key,omitempty"` // a key to seekto within the prefix (optional) - Namespace string `protobuf:"bytes,3,opt,name=namespace,proto3" json:"namespace,omitempty"` -} - -func (x *CountRequest) Reset() { - *x = CountRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_honu_v1_honu_proto_msgTypes[13] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *CountRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CountRequest) ProtoMessage() {} - -func (x *CountRequest) ProtoReflect() protoreflect.Message { - mi := &file_honu_v1_honu_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) -} - -// Deprecated: Use CountRequest.ProtoReflect.Descriptor instead. -func (*CountRequest) Descriptor() ([]byte, []int) { - return file_honu_v1_honu_proto_rawDescGZIP(), []int{13} -} - -func (x *CountRequest) GetPrefix() []byte { - if x != nil { - return x.Prefix - } - return nil -} - -func (x *CountRequest) GetSeekKey() []byte { - if x != nil { - return x.SeekKey - } - return nil -} - -func (x *CountRequest) GetNamespace() string { - if x != nil { - return x.Namespace - } - return "" -} - -type CountReply struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Objects uint64 `protobuf:"varint,1,opt,name=objects,proto3" json:"objects,omitempty"` // the number of objects in the iterator - KeyBytes uint64 `protobuf:"varint,2,opt,name=key_bytes,json=keyBytes,proto3" json:"key_bytes,omitempty"` // the number of bytes used for keys - ObjectBytes uint64 `protobuf:"varint,3,opt,name=object_bytes,json=objectBytes,proto3" json:"object_bytes,omitempty"` // the number of bytes used for objects -} - -func (x *CountReply) Reset() { - *x = CountReply{} - if protoimpl.UnsafeEnabled { - mi := &file_honu_v1_honu_proto_msgTypes[14] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *CountReply) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CountReply) ProtoMessage() {} - -func (x *CountReply) ProtoReflect() protoreflect.Message { - mi := &file_honu_v1_honu_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) -} - -// Deprecated: Use CountReply.ProtoReflect.Descriptor instead. -func (*CountReply) Descriptor() ([]byte, []int) { - return file_honu_v1_honu_proto_rawDescGZIP(), []int{14} -} - -func (x *CountReply) GetObjects() uint64 { - if x != nil { - return x.Objects - } - return 0 -} - -func (x *CountReply) GetKeyBytes() uint64 { - if x != nil { - return x.KeyBytes - } - return 0 -} - -func (x *CountReply) GetObjectBytes() uint64 { - if x != nil { - return x.ObjectBytes - } - return 0 -} - -type HealthCheck struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *HealthCheck) Reset() { - *x = HealthCheck{} - if protoimpl.UnsafeEnabled { - mi := &file_honu_v1_honu_proto_msgTypes[15] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *HealthCheck) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*HealthCheck) ProtoMessage() {} - -func (x *HealthCheck) ProtoReflect() protoreflect.Message { - mi := &file_honu_v1_honu_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) -} - -// Deprecated: Use HealthCheck.ProtoReflect.Descriptor instead. -func (*HealthCheck) Descriptor() ([]byte, []int) { - return file_honu_v1_honu_proto_rawDescGZIP(), []int{15} -} - -type ServerStatus struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Status string `protobuf:"bytes,1,opt,name=status,proto3" json:"status,omitempty"` - Version string `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"` - Uptime string `protobuf:"bytes,3,opt,name=uptime,proto3" json:"uptime,omitempty"` - Replica *ReplicaStatus `protobuf:"bytes,15,opt,name=replica,proto3" json:"replica,omitempty"` -} - -func (x *ServerStatus) Reset() { - *x = ServerStatus{} - if protoimpl.UnsafeEnabled { - mi := &file_honu_v1_honu_proto_msgTypes[16] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ServerStatus) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ServerStatus) ProtoMessage() {} - -func (x *ServerStatus) ProtoReflect() protoreflect.Message { - mi := &file_honu_v1_honu_proto_msgTypes[16] - 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) -} - -// Deprecated: Use ServerStatus.ProtoReflect.Descriptor instead. -func (*ServerStatus) Descriptor() ([]byte, []int) { - return file_honu_v1_honu_proto_rawDescGZIP(), []int{16} -} - -func (x *ServerStatus) GetStatus() string { - if x != nil { - return x.Status - } - return "" -} - -func (x *ServerStatus) GetVersion() string { - if x != nil { - return x.Version - } - return "" -} - -func (x *ServerStatus) GetUptime() string { - if x != nil { - return x.Uptime - } - return "" -} - -func (x *ServerStatus) GetReplica() *ReplicaStatus { - if x != nil { - return x.Replica - } - return nil -} - -type ReplicaStatus struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Enabled bool `protobuf:"varint,1,opt,name=enabled,proto3" json:"enabled,omitempty"` - Pid uint64 `protobuf:"varint,2,opt,name=pid,proto3" json:"pid,omitempty"` - Region string `protobuf:"bytes,3,opt,name=region,proto3" json:"region,omitempty"` - Name string `protobuf:"bytes,4,opt,name=name,proto3" json:"name,omitempty"` - Interval string `protobuf:"bytes,5,opt,name=interval,proto3" json:"interval,omitempty"` - Sigma string `protobuf:"bytes,6,opt,name=sigma,proto3" json:"sigma,omitempty"` -} - -func (x *ReplicaStatus) Reset() { - *x = ReplicaStatus{} - if protoimpl.UnsafeEnabled { - mi := &file_honu_v1_honu_proto_msgTypes[17] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ReplicaStatus) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ReplicaStatus) ProtoMessage() {} - -func (x *ReplicaStatus) ProtoReflect() protoreflect.Message { - mi := &file_honu_v1_honu_proto_msgTypes[17] - 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) -} - -// Deprecated: Use ReplicaStatus.ProtoReflect.Descriptor instead. -func (*ReplicaStatus) Descriptor() ([]byte, []int) { - return file_honu_v1_honu_proto_rawDescGZIP(), []int{17} -} - -func (x *ReplicaStatus) GetEnabled() bool { - if x != nil { - return x.Enabled - } - return false -} - -func (x *ReplicaStatus) GetPid() uint64 { - if x != nil { - return x.Pid - } - return 0 -} - -func (x *ReplicaStatus) GetRegion() string { - if x != nil { - return x.Region - } - return "" -} - -func (x *ReplicaStatus) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *ReplicaStatus) GetInterval() string { - if x != nil { - return x.Interval - } - return "" -} - -func (x *ReplicaStatus) GetSigma() string { - if x != nil { - return x.Sigma - } - return "" -} - -// Options conditions all accesses to trtl, e.g. there are not different structs for -// Get vs Put options. The semantics of each option depends on the type of request. -type Options struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - ReturnMeta bool `protobuf:"varint,1,opt,name=return_meta,json=returnMeta,proto3" json:"return_meta,omitempty"` // generally, return the version information for the object in the response - IterNoKeys bool `protobuf:"varint,2,opt,name=iter_no_keys,json=iterNoKeys,proto3" json:"iter_no_keys,omitempty"` // do not include keys in an Iter or Cursor response, to reduce data transfer load - IterNoValues bool `protobuf:"varint,3,opt,name=iter_no_values,json=iterNoValues,proto3" json:"iter_no_values,omitempty"` // do not include values in an Iter or Cursor response, to reduce data transfer load - PageToken string `protobuf:"bytes,4,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"` // specify the page token to fetch the next page of results - PageSize int32 `protobuf:"varint,5,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` // specify the number of results per page, cannot change between page requests -} - -func (x *Options) Reset() { - *x = Options{} - if protoimpl.UnsafeEnabled { - mi := &file_honu_v1_honu_proto_msgTypes[18] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Options) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Options) ProtoMessage() {} - -func (x *Options) ProtoReflect() protoreflect.Message { - mi := &file_honu_v1_honu_proto_msgTypes[18] - 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) -} - -// Deprecated: Use Options.ProtoReflect.Descriptor instead. -func (*Options) Descriptor() ([]byte, []int) { - return file_honu_v1_honu_proto_rawDescGZIP(), []int{18} -} - -func (x *Options) GetReturnMeta() bool { - if x != nil { - return x.ReturnMeta - } - return false -} - -func (x *Options) GetIterNoKeys() bool { - if x != nil { - return x.IterNoKeys - } - return false -} - -func (x *Options) GetIterNoValues() bool { - if x != nil { - return x.IterNoValues - } - return false -} - -func (x *Options) GetPageToken() string { - if x != nil { - return x.PageToken - } - return "" -} - -func (x *Options) GetPageSize() int32 { - if x != nil { - return x.PageSize - } - return 0 -} - -// A key/value pair that is returned in Iter and Cursor requests -type KVPair struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Key []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` - Value []byte `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` - Namespace string `protobuf:"bytes,3,opt,name=namespace,proto3" json:"namespace,omitempty"` - Meta *Meta `protobuf:"bytes,4,opt,name=meta,proto3" json:"meta,omitempty"` -} - -func (x *KVPair) Reset() { - *x = KVPair{} - if protoimpl.UnsafeEnabled { - mi := &file_honu_v1_honu_proto_msgTypes[19] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *KVPair) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*KVPair) ProtoMessage() {} - -func (x *KVPair) ProtoReflect() protoreflect.Message { - mi := &file_honu_v1_honu_proto_msgTypes[19] - 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) -} - -// Deprecated: Use KVPair.ProtoReflect.Descriptor instead. -func (*KVPair) Descriptor() ([]byte, []int) { - return file_honu_v1_honu_proto_rawDescGZIP(), []int{19} -} - -func (x *KVPair) GetKey() []byte { - if x != nil { - return x.Key - } - return nil -} - -func (x *KVPair) GetValue() []byte { - if x != nil { - return x.Value - } - return nil -} - -func (x *KVPair) GetNamespace() string { - if x != nil { - return x.Namespace - } - return "" -} - -func (x *KVPair) GetMeta() *Meta { - if x != nil { - return x.Meta - } - return nil -} - -// Meta is a simplified representation of the honu.object.v1.Object metadata that trtl -// actually stores. The simplification is intended to return non-nested data version -// information to the user in a read-only fashion. -type Meta struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Key []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` // the key that the metadata describes - Namespace string `protobuf:"bytes,2,opt,name=namespace,proto3" json:"namespace,omitempty"` // a unique namespace of the key, usually a prefix - Region string `protobuf:"bytes,3,opt,name=region,proto3" json:"region,omitempty"` // the region in which the data originated - Owner string `protobuf:"bytes,4,opt,name=owner,proto3" json:"owner,omitempty"` // the name of the replica where the data originated - Version *Version `protobuf:"bytes,5,opt,name=version,proto3" json:"version,omitempty"` // the current conflict-free version of the data - Parent *Version `protobuf:"bytes,6,opt,name=parent,proto3" json:"parent,omitempty"` // the version the current data was was derived from -} - -func (x *Meta) Reset() { - *x = Meta{} - if protoimpl.UnsafeEnabled { - mi := &file_honu_v1_honu_proto_msgTypes[20] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Meta) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Meta) ProtoMessage() {} - -func (x *Meta) ProtoReflect() protoreflect.Message { - mi := &file_honu_v1_honu_proto_msgTypes[20] - 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) -} - -// Deprecated: Use Meta.ProtoReflect.Descriptor instead. -func (*Meta) Descriptor() ([]byte, []int) { - return file_honu_v1_honu_proto_rawDescGZIP(), []int{20} -} - -func (x *Meta) GetKey() []byte { - if x != nil { - return x.Key - } - return nil -} - -func (x *Meta) GetNamespace() string { - if x != nil { - return x.Namespace - } - return "" -} - -func (x *Meta) GetRegion() string { - if x != nil { - return x.Region - } - return "" -} - -func (x *Meta) GetOwner() string { - if x != nil { - return x.Owner - } - return "" -} - -func (x *Meta) GetVersion() *Version { - if x != nil { - return x.Version - } - return nil -} - -func (x *Meta) GetParent() *Version { - if x != nil { - return x.Parent - } - return nil -} - -type Version struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Pid uint64 `protobuf:"varint,1,opt,name=pid,proto3" json:"pid,omitempty"` // process id, used for conflict-free version comparisons - Version uint64 `protobuf:"varint,2,opt,name=version,proto3" json:"version,omitempty"` // a monotonically increasing scalar that describes changes in the record - Region string `protobuf:"bytes,3,opt,name=region,proto3" json:"region,omitempty"` // the region where the version originated -} - -func (x *Version) Reset() { - *x = Version{} - if protoimpl.UnsafeEnabled { - mi := &file_honu_v1_honu_proto_msgTypes[21] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Version) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Version) ProtoMessage() {} - -func (x *Version) ProtoReflect() protoreflect.Message { - mi := &file_honu_v1_honu_proto_msgTypes[21] - 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) -} - -// Deprecated: Use Version.ProtoReflect.Descriptor instead. -func (*Version) Descriptor() ([]byte, []int) { - return file_honu_v1_honu_proto_rawDescGZIP(), []int{21} -} - -func (x *Version) GetPid() uint64 { - if x != nil { - return x.Pid - } - return 0 -} - -func (x *Version) GetVersion() uint64 { - if x != nil { - return x.Version - } - return 0 -} - -func (x *Version) GetRegion() string { - if x != nil { - return x.Region - } - return "" -} - -type BatchReply_Error struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` - Error string `protobuf:"bytes,2,opt,name=error,proto3" json:"error,omitempty"` -} - -func (x *BatchReply_Error) Reset() { - *x = BatchReply_Error{} - if protoimpl.UnsafeEnabled { - mi := &file_honu_v1_honu_proto_msgTypes[22] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *BatchReply_Error) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*BatchReply_Error) ProtoMessage() {} - -func (x *BatchReply_Error) ProtoReflect() protoreflect.Message { - mi := &file_honu_v1_honu_proto_msgTypes[22] - 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) -} - -// Deprecated: Use BatchReply_Error.ProtoReflect.Descriptor instead. -func (*BatchReply_Error) Descriptor() ([]byte, []int) { - return file_honu_v1_honu_proto_rawDescGZIP(), []int{9, 0} -} - -func (x *BatchReply_Error) GetId() int64 { - if x != nil { - return x.Id - } - return 0 -} - -func (x *BatchReply_Error) GetError() string { - if x != nil { - return x.Error - } - return "" -} - -var File_honu_v1_honu_proto protoreflect.FileDescriptor - -var file_honu_v1_honu_proto_rawDesc = []byte{ - 0x0a, 0x12, 0x68, 0x6f, 0x6e, 0x75, 0x2f, 0x76, 0x31, 0x2f, 0x68, 0x6f, 0x6e, 0x75, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x07, 0x68, 0x6f, 0x6e, 0x75, 0x2e, 0x76, 0x31, 0x22, 0x68, 0x0a, - 0x0a, 0x47, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x6b, - 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x1c, 0x0a, - 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x12, 0x2a, 0x0a, 0x07, 0x6f, - 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x68, - 0x6f, 0x6e, 0x75, 0x2e, 0x76, 0x31, 0x2e, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x07, - 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x43, 0x0a, 0x08, 0x47, 0x65, 0x74, 0x52, 0x65, - 0x70, 0x6c, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0c, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x21, 0x0a, 0x04, 0x6d, 0x65, 0x74, - 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x68, 0x6f, 0x6e, 0x75, 0x2e, 0x76, - 0x31, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x52, 0x04, 0x6d, 0x65, 0x74, 0x61, 0x22, 0x7e, 0x0a, 0x0a, - 0x50, 0x75, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, - 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 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, 0x1c, 0x0a, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, - 0x12, 0x2a, 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x10, 0x2e, 0x68, 0x6f, 0x6e, 0x75, 0x2e, 0x76, 0x31, 0x2e, 0x4f, 0x70, 0x74, 0x69, - 0x6f, 0x6e, 0x73, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x47, 0x0a, 0x08, - 0x50, 0x75, 0x74, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x75, 0x63, 0x63, - 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x73, 0x75, 0x63, 0x63, 0x65, - 0x73, 0x73, 0x12, 0x21, 0x0a, 0x04, 0x6d, 0x65, 0x74, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x0d, 0x2e, 0x68, 0x6f, 0x6e, 0x75, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x52, - 0x04, 0x6d, 0x65, 0x74, 0x61, 0x22, 0x6b, 0x0a, 0x0d, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0c, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x1c, 0x0a, 0x09, 0x6e, 0x61, 0x6d, 0x65, - 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6e, 0x61, 0x6d, - 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x12, 0x2a, 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, - 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x68, 0x6f, 0x6e, 0x75, 0x2e, 0x76, - 0x31, 0x2e, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, - 0x6e, 0x73, 0x22, 0x4a, 0x0a, 0x0b, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x70, 0x6c, - 0x79, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x08, 0x52, 0x07, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x12, 0x21, 0x0a, 0x04, 0x6d, - 0x65, 0x74, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x68, 0x6f, 0x6e, 0x75, - 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x52, 0x04, 0x6d, 0x65, 0x74, 0x61, 0x22, 0x6f, - 0x0a, 0x0b, 0x49, 0x74, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x16, 0x0a, - 0x06, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x70, - 0x72, 0x65, 0x66, 0x69, 0x78, 0x12, 0x1c, 0x0a, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, - 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, - 0x61, 0x63, 0x65, 0x12, 0x2a, 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x68, 0x6f, 0x6e, 0x75, 0x2e, 0x76, 0x31, 0x2e, 0x4f, - 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, - 0x5c, 0x0a, 0x09, 0x49, 0x74, 0x65, 0x72, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x27, 0x0a, 0x06, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x68, - 0x6f, 0x6e, 0x75, 0x2e, 0x76, 0x31, 0x2e, 0x4b, 0x56, 0x50, 0x61, 0x69, 0x72, 0x52, 0x06, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x26, 0x0a, 0x0f, 0x6e, 0x65, 0x78, 0x74, 0x5f, 0x70, 0x61, - 0x67, 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, - 0x6e, 0x65, 0x78, 0x74, 0x50, 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0x84, 0x01, - 0x0a, 0x0c, 0x42, 0x61, 0x74, 0x63, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, - 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69, 0x64, 0x12, 0x27, - 0x0a, 0x03, 0x70, 0x75, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x68, 0x6f, - 0x6e, 0x75, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x75, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x48, 0x00, 0x52, 0x03, 0x70, 0x75, 0x74, 0x12, 0x30, 0x0a, 0x06, 0x64, 0x65, 0x6c, 0x65, 0x74, - 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x68, 0x6f, 0x6e, 0x75, 0x2e, 0x76, - 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x48, - 0x00, 0x52, 0x06, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x72, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x22, 0xc6, 0x01, 0x0a, 0x0a, 0x42, 0x61, 0x74, 0x63, 0x68, 0x52, 0x65, - 0x70, 0x6c, 0x79, 0x12, 0x1e, 0x0a, 0x0a, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x73, 0x12, 0x1e, 0x0a, 0x0a, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x66, 0x75, - 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, - 0x66, 0x75, 0x6c, 0x12, 0x16, 0x0a, 0x06, 0x66, 0x61, 0x69, 0x6c, 0x65, 0x64, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x03, 0x52, 0x06, 0x66, 0x61, 0x69, 0x6c, 0x65, 0x64, 0x12, 0x31, 0x0a, 0x06, 0x65, - 0x72, 0x72, 0x6f, 0x72, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x68, 0x6f, - 0x6e, 0x75, 0x2e, 0x76, 0x31, 0x2e, 0x42, 0x61, 0x74, 0x63, 0x68, 0x52, 0x65, 0x70, 0x6c, 0x79, - 0x2e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x06, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x73, 0x1a, 0x2d, - 0x0a, 0x05, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x03, 0x52, 0x02, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x22, 0x8c, 0x01, - 0x0a, 0x0d, 0x43, 0x75, 0x72, 0x73, 0x6f, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, - 0x16, 0x0a, 0x06, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, - 0x06, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x12, 0x19, 0x0a, 0x08, 0x73, 0x65, 0x65, 0x6b, 0x5f, - 0x6b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x73, 0x65, 0x65, 0x6b, 0x4b, - 0x65, 0x79, 0x12, 0x1c, 0x0a, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, - 0x12, 0x2a, 0x0a, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x10, 0x2e, 0x68, 0x6f, 0x6e, 0x75, 0x2e, 0x76, 0x31, 0x2e, 0x4f, 0x70, 0x74, 0x69, - 0x6f, 0x6e, 0x73, 0x52, 0x07, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0xd8, 0x01, 0x0a, - 0x0b, 0x53, 0x79, 0x6e, 0x63, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, - 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69, 0x64, 0x12, 0x27, 0x0a, 0x03, - 0x67, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x68, 0x6f, 0x6e, 0x75, - 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x48, 0x00, - 0x52, 0x03, 0x67, 0x65, 0x74, 0x12, 0x27, 0x0a, 0x03, 0x70, 0x75, 0x74, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x68, 0x6f, 0x6e, 0x75, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x75, 0x74, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x48, 0x00, 0x52, 0x03, 0x70, 0x75, 0x74, 0x12, 0x30, - 0x0a, 0x06, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, - 0x2e, 0x68, 0x6f, 0x6e, 0x75, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x48, 0x00, 0x52, 0x06, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, - 0x12, 0x2a, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, - 0x2e, 0x68, 0x6f, 0x6e, 0x75, 0x2e, 0x76, 0x31, 0x2e, 0x49, 0x74, 0x65, 0x72, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x48, 0x00, 0x52, 0x04, 0x69, 0x74, 0x65, 0x72, 0x42, 0x09, 0x0a, 0x07, - 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0xfc, 0x01, 0x0a, 0x09, 0x53, 0x79, 0x6e, 0x63, - 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x03, 0x52, 0x02, 0x69, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x12, - 0x14, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, - 0x65, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x25, 0x0a, 0x03, 0x67, 0x65, 0x74, 0x18, 0x04, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x68, 0x6f, 0x6e, 0x75, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, - 0x52, 0x65, 0x70, 0x6c, 0x79, 0x48, 0x00, 0x52, 0x03, 0x67, 0x65, 0x74, 0x12, 0x25, 0x0a, 0x03, - 0x70, 0x75, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x68, 0x6f, 0x6e, 0x75, - 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x75, 0x74, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x48, 0x00, 0x52, 0x03, - 0x70, 0x75, 0x74, 0x12, 0x2e, 0x0a, 0x06, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x18, 0x06, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x68, 0x6f, 0x6e, 0x75, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, - 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x48, 0x00, 0x52, 0x06, 0x64, 0x65, 0x6c, - 0x65, 0x74, 0x65, 0x12, 0x28, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x72, 0x18, 0x07, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x12, 0x2e, 0x68, 0x6f, 0x6e, 0x75, 0x2e, 0x76, 0x31, 0x2e, 0x49, 0x74, 0x65, 0x72, - 0x52, 0x65, 0x70, 0x6c, 0x79, 0x48, 0x00, 0x52, 0x04, 0x69, 0x74, 0x65, 0x72, 0x42, 0x07, 0x0a, - 0x05, 0x72, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x5f, 0x0a, 0x0c, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x12, 0x19, - 0x0a, 0x08, 0x73, 0x65, 0x65, 0x6b, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, - 0x52, 0x07, 0x73, 0x65, 0x65, 0x6b, 0x4b, 0x65, 0x79, 0x12, 0x1c, 0x0a, 0x09, 0x6e, 0x61, 0x6d, - 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6e, 0x61, - 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x22, 0x66, 0x0a, 0x0a, 0x43, 0x6f, 0x75, 0x6e, 0x74, - 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x18, 0x0a, 0x07, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x07, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x12, - 0x1b, 0x0a, 0x09, 0x6b, 0x65, 0x79, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x04, 0x52, 0x08, 0x6b, 0x65, 0x79, 0x42, 0x79, 0x74, 0x65, 0x73, 0x12, 0x21, 0x0a, 0x0c, - 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x04, 0x52, 0x0b, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x42, 0x79, 0x74, 0x65, 0x73, 0x22, - 0x0d, 0x0a, 0x0b, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x22, 0x8a, - 0x01, 0x0a, 0x0c, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, - 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, - 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, - 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x75, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x06, 0x75, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x30, 0x0a, 0x07, 0x72, 0x65, 0x70, - 0x6c, 0x69, 0x63, 0x61, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x68, 0x6f, 0x6e, - 0x75, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x53, 0x74, 0x61, 0x74, - 0x75, 0x73, 0x52, 0x07, 0x72, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x22, 0x99, 0x01, 0x0a, 0x0d, - 0x52, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x18, 0x0a, - 0x07, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, - 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x70, 0x69, 0x64, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x04, 0x52, 0x03, 0x70, 0x69, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x72, 0x65, 0x67, - 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x72, 0x65, 0x67, 0x69, 0x6f, - 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, - 0x6c, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, - 0x6c, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x69, 0x67, 0x6d, 0x61, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x05, 0x73, 0x69, 0x67, 0x6d, 0x61, 0x22, 0xae, 0x01, 0x0a, 0x07, 0x4f, 0x70, 0x74, 0x69, - 0x6f, 0x6e, 0x73, 0x12, 0x1f, 0x0a, 0x0b, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x5f, 0x6d, 0x65, - 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, - 0x4d, 0x65, 0x74, 0x61, 0x12, 0x20, 0x0a, 0x0c, 0x69, 0x74, 0x65, 0x72, 0x5f, 0x6e, 0x6f, 0x5f, - 0x6b, 0x65, 0x79, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x69, 0x74, 0x65, 0x72, - 0x4e, 0x6f, 0x4b, 0x65, 0x79, 0x73, 0x12, 0x24, 0x0a, 0x0e, 0x69, 0x74, 0x65, 0x72, 0x5f, 0x6e, - 0x6f, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c, - 0x69, 0x74, 0x65, 0x72, 0x4e, 0x6f, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x1d, 0x0a, 0x0a, - 0x70, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x09, 0x70, 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x1b, 0x0a, 0x09, 0x70, - 0x61, 0x67, 0x65, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, - 0x70, 0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x22, 0x71, 0x0a, 0x06, 0x4b, 0x56, 0x50, 0x61, - 0x69, 0x72, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 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, 0x1c, 0x0a, 0x09, 0x6e, 0x61, - 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6e, - 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x12, 0x21, 0x0a, 0x04, 0x6d, 0x65, 0x74, 0x61, - 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x68, 0x6f, 0x6e, 0x75, 0x2e, 0x76, 0x31, - 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x52, 0x04, 0x6d, 0x65, 0x74, 0x61, 0x22, 0xba, 0x01, 0x0a, 0x04, - 0x4d, 0x65, 0x74, 0x61, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0c, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x1c, 0x0a, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, - 0x61, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, - 0x70, 0x61, 0x63, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x72, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x72, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x12, 0x14, 0x0a, 0x05, - 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6f, 0x77, 0x6e, - 0x65, 0x72, 0x12, 0x2a, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x05, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x68, 0x6f, 0x6e, 0x75, 0x2e, 0x76, 0x31, 0x2e, 0x56, 0x65, - 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x28, - 0x0a, 0x06, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, - 0x2e, 0x68, 0x6f, 0x6e, 0x75, 0x2e, 0x76, 0x31, 0x2e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, - 0x52, 0x06, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x22, 0x4d, 0x0a, 0x07, 0x56, 0x65, 0x72, 0x73, - 0x69, 0x6f, 0x6e, 0x12, 0x10, 0x0a, 0x03, 0x70, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, - 0x52, 0x03, 0x70, 0x69, 0x64, 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, - 0x16, 0x0a, 0x06, 0x72, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x06, 0x72, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x32, 0xee, 0x03, 0x0a, 0x04, 0x48, 0x6f, 0x6e, 0x75, - 0x12, 0x2f, 0x0a, 0x03, 0x47, 0x65, 0x74, 0x12, 0x13, 0x2e, 0x68, 0x6f, 0x6e, 0x75, 0x2e, 0x76, - 0x31, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x11, 0x2e, 0x68, - 0x6f, 0x6e, 0x75, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, - 0x00, 0x12, 0x2f, 0x0a, 0x03, 0x50, 0x75, 0x74, 0x12, 0x13, 0x2e, 0x68, 0x6f, 0x6e, 0x75, 0x2e, - 0x76, 0x31, 0x2e, 0x50, 0x75, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x11, 0x2e, - 0x68, 0x6f, 0x6e, 0x75, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x75, 0x74, 0x52, 0x65, 0x70, 0x6c, 0x79, - 0x22, 0x00, 0x12, 0x38, 0x0a, 0x06, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x12, 0x16, 0x2e, 0x68, - 0x6f, 0x6e, 0x75, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x68, 0x6f, 0x6e, 0x75, 0x2e, 0x76, 0x31, 0x2e, 0x44, - 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x32, 0x0a, 0x04, - 0x49, 0x74, 0x65, 0x72, 0x12, 0x14, 0x2e, 0x68, 0x6f, 0x6e, 0x75, 0x2e, 0x76, 0x31, 0x2e, 0x49, - 0x74, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x68, 0x6f, 0x6e, - 0x75, 0x2e, 0x76, 0x31, 0x2e, 0x49, 0x74, 0x65, 0x72, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, - 0x12, 0x37, 0x0a, 0x05, 0x42, 0x61, 0x74, 0x63, 0x68, 0x12, 0x15, 0x2e, 0x68, 0x6f, 0x6e, 0x75, - 0x2e, 0x76, 0x31, 0x2e, 0x42, 0x61, 0x74, 0x63, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x1a, 0x13, 0x2e, 0x68, 0x6f, 0x6e, 0x75, 0x2e, 0x76, 0x31, 0x2e, 0x42, 0x61, 0x74, 0x63, 0x68, - 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x28, 0x01, 0x12, 0x35, 0x0a, 0x06, 0x43, 0x75, 0x72, - 0x73, 0x6f, 0x72, 0x12, 0x16, 0x2e, 0x68, 0x6f, 0x6e, 0x75, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x75, - 0x72, 0x73, 0x6f, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0f, 0x2e, 0x68, 0x6f, - 0x6e, 0x75, 0x2e, 0x76, 0x31, 0x2e, 0x4b, 0x56, 0x50, 0x61, 0x69, 0x72, 0x22, 0x00, 0x30, 0x01, - 0x12, 0x36, 0x0a, 0x04, 0x53, 0x79, 0x6e, 0x63, 0x12, 0x14, 0x2e, 0x68, 0x6f, 0x6e, 0x75, 0x2e, - 0x76, 0x31, 0x2e, 0x53, 0x79, 0x6e, 0x63, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, - 0x2e, 0x68, 0x6f, 0x6e, 0x75, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x79, 0x6e, 0x63, 0x52, 0x65, 0x70, - 0x6c, 0x79, 0x22, 0x00, 0x28, 0x01, 0x30, 0x01, 0x12, 0x35, 0x0a, 0x05, 0x43, 0x6f, 0x75, 0x6e, - 0x74, 0x12, 0x15, 0x2e, 0x68, 0x6f, 0x6e, 0x75, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x6f, 0x75, 0x6e, - 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x13, 0x2e, 0x68, 0x6f, 0x6e, 0x75, 0x2e, - 0x76, 0x31, 0x2e, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, - 0x37, 0x0a, 0x06, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x14, 0x2e, 0x68, 0x6f, 0x6e, 0x75, - 0x2e, 0x76, 0x31, 0x2e, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x1a, - 0x15, 0x2e, 0x68, 0x6f, 0x6e, 0x75, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, - 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0x00, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_honu_v1_honu_proto_rawDescOnce sync.Once - file_honu_v1_honu_proto_rawDescData = file_honu_v1_honu_proto_rawDesc -) - -func file_honu_v1_honu_proto_rawDescGZIP() []byte { - file_honu_v1_honu_proto_rawDescOnce.Do(func() { - file_honu_v1_honu_proto_rawDescData = protoimpl.X.CompressGZIP(file_honu_v1_honu_proto_rawDescData) - }) - return file_honu_v1_honu_proto_rawDescData -} - -var file_honu_v1_honu_proto_msgTypes = make([]protoimpl.MessageInfo, 23) -var file_honu_v1_honu_proto_goTypes = []interface{}{ - (*GetRequest)(nil), // 0: honu.v1.GetRequest - (*GetReply)(nil), // 1: honu.v1.GetReply - (*PutRequest)(nil), // 2: honu.v1.PutRequest - (*PutReply)(nil), // 3: honu.v1.PutReply - (*DeleteRequest)(nil), // 4: honu.v1.DeleteRequest - (*DeleteReply)(nil), // 5: honu.v1.DeleteReply - (*IterRequest)(nil), // 6: honu.v1.IterRequest - (*IterReply)(nil), // 7: honu.v1.IterReply - (*BatchRequest)(nil), // 8: honu.v1.BatchRequest - (*BatchReply)(nil), // 9: honu.v1.BatchReply - (*CursorRequest)(nil), // 10: honu.v1.CursorRequest - (*SyncRequest)(nil), // 11: honu.v1.SyncRequest - (*SyncReply)(nil), // 12: honu.v1.SyncReply - (*CountRequest)(nil), // 13: honu.v1.CountRequest - (*CountReply)(nil), // 14: honu.v1.CountReply - (*HealthCheck)(nil), // 15: honu.v1.HealthCheck - (*ServerStatus)(nil), // 16: honu.v1.ServerStatus - (*ReplicaStatus)(nil), // 17: honu.v1.ReplicaStatus - (*Options)(nil), // 18: honu.v1.Options - (*KVPair)(nil), // 19: honu.v1.KVPair - (*Meta)(nil), // 20: honu.v1.Meta - (*Version)(nil), // 21: honu.v1.Version - (*BatchReply_Error)(nil), // 22: honu.v1.BatchReply.Error -} -var file_honu_v1_honu_proto_depIdxs = []int32{ - 18, // 0: honu.v1.GetRequest.options:type_name -> honu.v1.Options - 20, // 1: honu.v1.GetReply.meta:type_name -> honu.v1.Meta - 18, // 2: honu.v1.PutRequest.options:type_name -> honu.v1.Options - 20, // 3: honu.v1.PutReply.meta:type_name -> honu.v1.Meta - 18, // 4: honu.v1.DeleteRequest.options:type_name -> honu.v1.Options - 20, // 5: honu.v1.DeleteReply.meta:type_name -> honu.v1.Meta - 18, // 6: honu.v1.IterRequest.options:type_name -> honu.v1.Options - 19, // 7: honu.v1.IterReply.values:type_name -> honu.v1.KVPair - 2, // 8: honu.v1.BatchRequest.put:type_name -> honu.v1.PutRequest - 4, // 9: honu.v1.BatchRequest.delete:type_name -> honu.v1.DeleteRequest - 22, // 10: honu.v1.BatchReply.errors:type_name -> honu.v1.BatchReply.Error - 18, // 11: honu.v1.CursorRequest.options:type_name -> honu.v1.Options - 0, // 12: honu.v1.SyncRequest.get:type_name -> honu.v1.GetRequest - 2, // 13: honu.v1.SyncRequest.put:type_name -> honu.v1.PutRequest - 4, // 14: honu.v1.SyncRequest.delete:type_name -> honu.v1.DeleteRequest - 6, // 15: honu.v1.SyncRequest.iter:type_name -> honu.v1.IterRequest - 1, // 16: honu.v1.SyncReply.get:type_name -> honu.v1.GetReply - 3, // 17: honu.v1.SyncReply.put:type_name -> honu.v1.PutReply - 5, // 18: honu.v1.SyncReply.delete:type_name -> honu.v1.DeleteReply - 7, // 19: honu.v1.SyncReply.iter:type_name -> honu.v1.IterReply - 17, // 20: honu.v1.ServerStatus.replica:type_name -> honu.v1.ReplicaStatus - 20, // 21: honu.v1.KVPair.meta:type_name -> honu.v1.Meta - 21, // 22: honu.v1.Meta.version:type_name -> honu.v1.Version - 21, // 23: honu.v1.Meta.parent:type_name -> honu.v1.Version - 0, // 24: honu.v1.Honu.Get:input_type -> honu.v1.GetRequest - 2, // 25: honu.v1.Honu.Put:input_type -> honu.v1.PutRequest - 4, // 26: honu.v1.Honu.Delete:input_type -> honu.v1.DeleteRequest - 6, // 27: honu.v1.Honu.Iter:input_type -> honu.v1.IterRequest - 8, // 28: honu.v1.Honu.Batch:input_type -> honu.v1.BatchRequest - 10, // 29: honu.v1.Honu.Cursor:input_type -> honu.v1.CursorRequest - 11, // 30: honu.v1.Honu.Sync:input_type -> honu.v1.SyncRequest - 13, // 31: honu.v1.Honu.Count:input_type -> honu.v1.CountRequest - 15, // 32: honu.v1.Honu.Status:input_type -> honu.v1.HealthCheck - 1, // 33: honu.v1.Honu.Get:output_type -> honu.v1.GetReply - 3, // 34: honu.v1.Honu.Put:output_type -> honu.v1.PutReply - 5, // 35: honu.v1.Honu.Delete:output_type -> honu.v1.DeleteReply - 7, // 36: honu.v1.Honu.Iter:output_type -> honu.v1.IterReply - 9, // 37: honu.v1.Honu.Batch:output_type -> honu.v1.BatchReply - 19, // 38: honu.v1.Honu.Cursor:output_type -> honu.v1.KVPair - 12, // 39: honu.v1.Honu.Sync:output_type -> honu.v1.SyncReply - 14, // 40: honu.v1.Honu.Count:output_type -> honu.v1.CountReply - 16, // 41: honu.v1.Honu.Status:output_type -> honu.v1.ServerStatus - 33, // [33:42] is the sub-list for method output_type - 24, // [24:33] is the sub-list for method input_type - 24, // [24:24] is the sub-list for extension type_name - 24, // [24:24] is the sub-list for extension extendee - 0, // [0:24] is the sub-list for field type_name -} - -func init() { file_honu_v1_honu_proto_init() } -func file_honu_v1_honu_proto_init() { - if File_honu_v1_honu_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_honu_v1_honu_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_honu_v1_honu_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetReply); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_honu_v1_honu_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PutRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_honu_v1_honu_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PutReply); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_honu_v1_honu_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DeleteRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_honu_v1_honu_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DeleteReply); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_honu_v1_honu_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*IterRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_honu_v1_honu_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*IterReply); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_honu_v1_honu_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*BatchRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_honu_v1_honu_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*BatchReply); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_honu_v1_honu_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CursorRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_honu_v1_honu_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SyncRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_honu_v1_honu_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SyncReply); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_honu_v1_honu_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CountRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_honu_v1_honu_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CountReply); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_honu_v1_honu_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*HealthCheck); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_honu_v1_honu_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ServerStatus); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_honu_v1_honu_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ReplicaStatus); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_honu_v1_honu_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Options); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_honu_v1_honu_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*KVPair); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_honu_v1_honu_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Meta); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_honu_v1_honu_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Version); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_honu_v1_honu_proto_msgTypes[22].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*BatchReply_Error); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - file_honu_v1_honu_proto_msgTypes[8].OneofWrappers = []interface{}{ - (*BatchRequest_Put)(nil), - (*BatchRequest_Delete)(nil), - } - file_honu_v1_honu_proto_msgTypes[11].OneofWrappers = []interface{}{ - (*SyncRequest_Get)(nil), - (*SyncRequest_Put)(nil), - (*SyncRequest_Delete)(nil), - (*SyncRequest_Iter)(nil), - } - file_honu_v1_honu_proto_msgTypes[12].OneofWrappers = []interface{}{ - (*SyncReply_Get)(nil), - (*SyncReply_Put)(nil), - (*SyncReply_Delete)(nil), - (*SyncReply_Iter)(nil), - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_honu_v1_honu_proto_rawDesc, - NumEnums: 0, - NumMessages: 23, - NumExtensions: 0, - NumServices: 1, - }, - GoTypes: file_honu_v1_honu_proto_goTypes, - DependencyIndexes: file_honu_v1_honu_proto_depIdxs, - MessageInfos: file_honu_v1_honu_proto_msgTypes, - }.Build() - File_honu_v1_honu_proto = out.File - file_honu_v1_honu_proto_rawDesc = nil - file_honu_v1_honu_proto_goTypes = nil - file_honu_v1_honu_proto_depIdxs = nil -} diff --git a/api/v1/honu_grpc.pb.go b/api/v1/honu_grpc.pb.go deleted file mode 100644 index 065a026..0000000 --- a/api/v1/honu_grpc.pb.go +++ /dev/null @@ -1,517 +0,0 @@ -// Code generated by protoc-gen-go-grpc. DO NOT EDIT. -// versions: -// - protoc-gen-go-grpc v1.3.0 -// - protoc v5.26.1 -// source: honu/v1/honu.proto - -package api - -import ( - context "context" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" -) - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.32.0 or later. -const _ = grpc.SupportPackageIsVersion7 - -const ( - Honu_Get_FullMethodName = "/honu.v1.Honu/Get" - Honu_Put_FullMethodName = "/honu.v1.Honu/Put" - Honu_Delete_FullMethodName = "/honu.v1.Honu/Delete" - Honu_Iter_FullMethodName = "/honu.v1.Honu/Iter" - Honu_Batch_FullMethodName = "/honu.v1.Honu/Batch" - Honu_Cursor_FullMethodName = "/honu.v1.Honu/Cursor" - Honu_Sync_FullMethodName = "/honu.v1.Honu/Sync" - Honu_Count_FullMethodName = "/honu.v1.Honu/Count" - Honu_Status_FullMethodName = "/honu.v1.Honu/Status" -) - -// HonuClient is the client API for Honu service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. -type HonuClient interface { - // Get is a unary request to retrieve a value for a key. - Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (*GetReply, error) - // Put is a unary request to store a value for a key. - Put(ctx context.Context, in *PutRequest, opts ...grpc.CallOption) (*PutReply, error) - // Delete is a unary request to remove a value and key. - Delete(ctx context.Context, in *DeleteRequest, opts ...grpc.CallOption) (*DeleteReply, error) - // Iter is a unary request that returns a completely materialized list of key value pairs. - Iter(ctx context.Context, in *IterRequest, opts ...grpc.CallOption) (*IterReply, error) - // Batch is a client-side streaming request to issue multiple commands, usually Put and Delete. - Batch(ctx context.Context, opts ...grpc.CallOption) (Honu_BatchClient, error) - // Cursor is a server-side streaming request to iterate in a memory safe fashion. - Cursor(ctx context.Context, in *CursorRequest, opts ...grpc.CallOption) (Honu_CursorClient, error) - // Sync is a bi-directional streaming mechanism to issue access requests synchronously. - Sync(ctx context.Context, opts ...grpc.CallOption) (Honu_SyncClient, error) - // Count the number of objects currently stored in the database - Count(ctx context.Context, in *CountRequest, opts ...grpc.CallOption) (*CountReply, error) - // This RPC servers as a health check for clients to make sure the server is online. - Status(ctx context.Context, in *HealthCheck, opts ...grpc.CallOption) (*ServerStatus, error) -} - -type honuClient struct { - cc grpc.ClientConnInterface -} - -func NewHonuClient(cc grpc.ClientConnInterface) HonuClient { - return &honuClient{cc} -} - -func (c *honuClient) Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (*GetReply, error) { - out := new(GetReply) - err := c.cc.Invoke(ctx, Honu_Get_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *honuClient) Put(ctx context.Context, in *PutRequest, opts ...grpc.CallOption) (*PutReply, error) { - out := new(PutReply) - err := c.cc.Invoke(ctx, Honu_Put_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *honuClient) Delete(ctx context.Context, in *DeleteRequest, opts ...grpc.CallOption) (*DeleteReply, error) { - out := new(DeleteReply) - err := c.cc.Invoke(ctx, Honu_Delete_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *honuClient) Iter(ctx context.Context, in *IterRequest, opts ...grpc.CallOption) (*IterReply, error) { - out := new(IterReply) - err := c.cc.Invoke(ctx, Honu_Iter_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *honuClient) Batch(ctx context.Context, opts ...grpc.CallOption) (Honu_BatchClient, error) { - stream, err := c.cc.NewStream(ctx, &Honu_ServiceDesc.Streams[0], Honu_Batch_FullMethodName, opts...) - if err != nil { - return nil, err - } - x := &honuBatchClient{stream} - return x, nil -} - -type Honu_BatchClient interface { - Send(*BatchRequest) error - CloseAndRecv() (*BatchReply, error) - grpc.ClientStream -} - -type honuBatchClient struct { - grpc.ClientStream -} - -func (x *honuBatchClient) Send(m *BatchRequest) error { - return x.ClientStream.SendMsg(m) -} - -func (x *honuBatchClient) CloseAndRecv() (*BatchReply, error) { - if err := x.ClientStream.CloseSend(); err != nil { - return nil, err - } - m := new(BatchReply) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func (c *honuClient) Cursor(ctx context.Context, in *CursorRequest, opts ...grpc.CallOption) (Honu_CursorClient, error) { - stream, err := c.cc.NewStream(ctx, &Honu_ServiceDesc.Streams[1], Honu_Cursor_FullMethodName, opts...) - if err != nil { - return nil, err - } - x := &honuCursorClient{stream} - if err := x.ClientStream.SendMsg(in); err != nil { - return nil, err - } - if err := x.ClientStream.CloseSend(); err != nil { - return nil, err - } - return x, nil -} - -type Honu_CursorClient interface { - Recv() (*KVPair, error) - grpc.ClientStream -} - -type honuCursorClient struct { - grpc.ClientStream -} - -func (x *honuCursorClient) Recv() (*KVPair, error) { - m := new(KVPair) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func (c *honuClient) Sync(ctx context.Context, opts ...grpc.CallOption) (Honu_SyncClient, error) { - stream, err := c.cc.NewStream(ctx, &Honu_ServiceDesc.Streams[2], Honu_Sync_FullMethodName, opts...) - if err != nil { - return nil, err - } - x := &honuSyncClient{stream} - return x, nil -} - -type Honu_SyncClient interface { - Send(*SyncRequest) error - Recv() (*SyncReply, error) - grpc.ClientStream -} - -type honuSyncClient struct { - grpc.ClientStream -} - -func (x *honuSyncClient) Send(m *SyncRequest) error { - return x.ClientStream.SendMsg(m) -} - -func (x *honuSyncClient) Recv() (*SyncReply, error) { - m := new(SyncReply) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func (c *honuClient) Count(ctx context.Context, in *CountRequest, opts ...grpc.CallOption) (*CountReply, error) { - out := new(CountReply) - err := c.cc.Invoke(ctx, Honu_Count_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *honuClient) Status(ctx context.Context, in *HealthCheck, opts ...grpc.CallOption) (*ServerStatus, error) { - out := new(ServerStatus) - err := c.cc.Invoke(ctx, Honu_Status_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// HonuServer is the server API for Honu service. -// All implementations must embed UnimplementedHonuServer -// for forward compatibility -type HonuServer interface { - // Get is a unary request to retrieve a value for a key. - Get(context.Context, *GetRequest) (*GetReply, error) - // Put is a unary request to store a value for a key. - Put(context.Context, *PutRequest) (*PutReply, error) - // Delete is a unary request to remove a value and key. - Delete(context.Context, *DeleteRequest) (*DeleteReply, error) - // Iter is a unary request that returns a completely materialized list of key value pairs. - Iter(context.Context, *IterRequest) (*IterReply, error) - // Batch is a client-side streaming request to issue multiple commands, usually Put and Delete. - Batch(Honu_BatchServer) error - // Cursor is a server-side streaming request to iterate in a memory safe fashion. - Cursor(*CursorRequest, Honu_CursorServer) error - // Sync is a bi-directional streaming mechanism to issue access requests synchronously. - Sync(Honu_SyncServer) error - // Count the number of objects currently stored in the database - Count(context.Context, *CountRequest) (*CountReply, error) - // This RPC servers as a health check for clients to make sure the server is online. - Status(context.Context, *HealthCheck) (*ServerStatus, error) - mustEmbedUnimplementedHonuServer() -} - -// UnimplementedHonuServer must be embedded to have forward compatible implementations. -type UnimplementedHonuServer struct { -} - -func (UnimplementedHonuServer) Get(context.Context, *GetRequest) (*GetReply, error) { - return nil, status.Errorf(codes.Unimplemented, "method Get not implemented") -} -func (UnimplementedHonuServer) Put(context.Context, *PutRequest) (*PutReply, error) { - return nil, status.Errorf(codes.Unimplemented, "method Put not implemented") -} -func (UnimplementedHonuServer) Delete(context.Context, *DeleteRequest) (*DeleteReply, error) { - return nil, status.Errorf(codes.Unimplemented, "method Delete not implemented") -} -func (UnimplementedHonuServer) Iter(context.Context, *IterRequest) (*IterReply, error) { - return nil, status.Errorf(codes.Unimplemented, "method Iter not implemented") -} -func (UnimplementedHonuServer) Batch(Honu_BatchServer) error { - return status.Errorf(codes.Unimplemented, "method Batch not implemented") -} -func (UnimplementedHonuServer) Cursor(*CursorRequest, Honu_CursorServer) error { - return status.Errorf(codes.Unimplemented, "method Cursor not implemented") -} -func (UnimplementedHonuServer) Sync(Honu_SyncServer) error { - return status.Errorf(codes.Unimplemented, "method Sync not implemented") -} -func (UnimplementedHonuServer) Count(context.Context, *CountRequest) (*CountReply, error) { - return nil, status.Errorf(codes.Unimplemented, "method Count not implemented") -} -func (UnimplementedHonuServer) Status(context.Context, *HealthCheck) (*ServerStatus, error) { - return nil, status.Errorf(codes.Unimplemented, "method Status not implemented") -} -func (UnimplementedHonuServer) mustEmbedUnimplementedHonuServer() {} - -// UnsafeHonuServer may be embedded to opt out of forward compatibility for this service. -// Use of this interface is not recommended, as added methods to HonuServer will -// result in compilation errors. -type UnsafeHonuServer interface { - mustEmbedUnimplementedHonuServer() -} - -func RegisterHonuServer(s grpc.ServiceRegistrar, srv HonuServer) { - s.RegisterService(&Honu_ServiceDesc, srv) -} - -func _Honu_Get_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(HonuServer).Get(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Honu_Get_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(HonuServer).Get(ctx, req.(*GetRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Honu_Put_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(PutRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(HonuServer).Put(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Honu_Put_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(HonuServer).Put(ctx, req.(*PutRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Honu_Delete_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(DeleteRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(HonuServer).Delete(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Honu_Delete_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(HonuServer).Delete(ctx, req.(*DeleteRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Honu_Iter_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(IterRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(HonuServer).Iter(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Honu_Iter_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(HonuServer).Iter(ctx, req.(*IterRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Honu_Batch_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(HonuServer).Batch(&honuBatchServer{stream}) -} - -type Honu_BatchServer interface { - SendAndClose(*BatchReply) error - Recv() (*BatchRequest, error) - grpc.ServerStream -} - -type honuBatchServer struct { - grpc.ServerStream -} - -func (x *honuBatchServer) SendAndClose(m *BatchReply) error { - return x.ServerStream.SendMsg(m) -} - -func (x *honuBatchServer) Recv() (*BatchRequest, error) { - m := new(BatchRequest) - if err := x.ServerStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func _Honu_Cursor_Handler(srv interface{}, stream grpc.ServerStream) error { - m := new(CursorRequest) - if err := stream.RecvMsg(m); err != nil { - return err - } - return srv.(HonuServer).Cursor(m, &honuCursorServer{stream}) -} - -type Honu_CursorServer interface { - Send(*KVPair) error - grpc.ServerStream -} - -type honuCursorServer struct { - grpc.ServerStream -} - -func (x *honuCursorServer) Send(m *KVPair) error { - return x.ServerStream.SendMsg(m) -} - -func _Honu_Sync_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(HonuServer).Sync(&honuSyncServer{stream}) -} - -type Honu_SyncServer interface { - Send(*SyncReply) error - Recv() (*SyncRequest, error) - grpc.ServerStream -} - -type honuSyncServer struct { - grpc.ServerStream -} - -func (x *honuSyncServer) Send(m *SyncReply) error { - return x.ServerStream.SendMsg(m) -} - -func (x *honuSyncServer) Recv() (*SyncRequest, error) { - m := new(SyncRequest) - if err := x.ServerStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func _Honu_Count_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(CountRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(HonuServer).Count(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Honu_Count_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(HonuServer).Count(ctx, req.(*CountRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Honu_Status_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(HealthCheck) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(HonuServer).Status(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Honu_Status_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(HonuServer).Status(ctx, req.(*HealthCheck)) - } - return interceptor(ctx, in, info, handler) -} - -// Honu_ServiceDesc is the grpc.ServiceDesc for Honu service. -// It's only intended for direct use with grpc.RegisterService, -// and not to be introspected or modified (even as a copy) -var Honu_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "honu.v1.Honu", - HandlerType: (*HonuServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "Get", - Handler: _Honu_Get_Handler, - }, - { - MethodName: "Put", - Handler: _Honu_Put_Handler, - }, - { - MethodName: "Delete", - Handler: _Honu_Delete_Handler, - }, - { - MethodName: "Iter", - Handler: _Honu_Iter_Handler, - }, - { - MethodName: "Count", - Handler: _Honu_Count_Handler, - }, - { - MethodName: "Status", - Handler: _Honu_Status_Handler, - }, - }, - Streams: []grpc.StreamDesc{ - { - StreamName: "Batch", - Handler: _Honu_Batch_Handler, - ClientStreams: true, - }, - { - StreamName: "Cursor", - Handler: _Honu_Cursor_Handler, - ServerStreams: true, - }, - { - StreamName: "Sync", - Handler: _Honu_Sync_Handler, - ServerStreams: true, - ClientStreams: true, - }, - }, - Metadata: "honu/v1/honu.proto", -} diff --git a/cmd/honu/main.go b/cmd/honudb/main.go similarity index 88% rename from cmd/honu/main.go rename to cmd/honudb/main.go index 611b438..434231f 100644 --- a/cmd/honu/main.go +++ b/cmd/honudb/main.go @@ -6,8 +6,8 @@ import ( "os" "github.com/joho/godotenv" - "github.com/rotationalio/honu" - "github.com/rotationalio/honu/config" + "github.com/rotationalio/honu/pkg" + "github.com/rotationalio/honu/pkg/config" "github.com/urfave/cli/v2" ) @@ -17,8 +17,8 @@ func main() { // Create HonuDB command line application app := cli.NewApp() - app.Name = "honu" - app.Version = honu.Version() + app.Name = "honudb" + app.Version = pkg.Version() app.Usage = "run and manage a honudb replica service" app.Flags = []cli.Flag{} app.Commands = []*cli.Command{ diff --git a/config/config.go b/config/config.go deleted file mode 100644 index b65b3c9..0000000 --- a/config/config.go +++ /dev/null @@ -1,73 +0,0 @@ -package config - -import ( - ldbopt "github.com/syndtr/goleveldb/leveldb/opt" -) - -// DefaultConfig is used if the user does not specify a configuration -var DefaultConfig = Config{ - Versions: ReplicaConfig{ - PID: 1, - Region: "local", - Name: "localhost", - }, -} - -// New creates a configuration with the required options and can also be used to specify -// optional configuration e.g. for engine-specific operations. -func New(options ...Option) (_ Config, err error) { - // Create the default configuration in editable mode - conf := &Config{ - Versions: ReplicaConfig{ - PID: DefaultConfig.Versions.PID, - Region: DefaultConfig.Versions.Region, - Name: DefaultConfig.Versions.Name, - }, - } - - // Apply all options to the configuration - for _, opt := range options { - if err = opt(conf); err != nil { - return Config{}, err - } - } - - // Return the value of the configuration - return *conf, nil -} - -// Config specifies the options necessary to open a Honu database. -type Config struct { - Versions ReplicaConfig - LDBOptions *ldbopt.Options -} - -// ReplicaConfig specifies the information needed for the Version manager to maintain -// global object versioning and provenance. Honu is intended to support data replication -// by versioning using Lamport scalars. These conflict-free version numbers are closely -// tied to a replica's configuration (where a replica is a process that performs data -// replication using Honu), e.g. the PID is the process ID of a running replica, the -// region is where the replica is running, and the name is usually the hostname of the -// replica. -type ReplicaConfig struct { - PID uint64 `split_words:"true" required:"false"` - Region string `split_words:"true" required:"false"` - Name string `split_words:"true" required:"false"` -} - -// Option modifies a configuration to add optional configuration items. -type Option func(*Config) error - -func WithReplica(conf ReplicaConfig) Option { - return func(cfg *Config) error { - cfg.Versions = conf - return nil - } -} - -func WithLevelDB(opt *ldbopt.Options) Option { - return func(cfg *Config) error { - cfg.LDBOptions = opt - return nil - } -} diff --git a/config/config_test.go b/config/config_test.go deleted file mode 100644 index 32f779e..0000000 --- a/config/config_test.go +++ /dev/null @@ -1,33 +0,0 @@ -package config_test - -import ( - "testing" - - "github.com/rotationalio/honu/config" - "github.com/stretchr/testify/require" - ldbopt "github.com/syndtr/goleveldb/leveldb/opt" -) - -func TestConfig(t *testing.T) { - // Test Default Config - conf, err := config.New() - require.NoError(t, err) - require.Equal(t, config.DefaultConfig, conf) - require.NotZero(t, conf.Versions.PID) - require.NotEmpty(t, conf.Versions.Region) - - // Test WithVersions - conf, err = config.New(config.WithReplica(config.ReplicaConfig{8, "us-antarctic-23", "research"})) - require.NoError(t, err) - require.NotEmpty(t, conf.Versions) - require.Equal(t, uint64(8), conf.Versions.PID) - require.Equal(t, "us-antarctic-23", conf.Versions.Region) - require.Equal(t, "research", conf.Versions.Name) - - // Test WithLevelDB Options - conf, err = config.New(config.WithLevelDB(&ldbopt.Options{Strict: ldbopt.StrictJournal})) - require.NoError(t, err) - require.Equal(t, config.DefaultConfig.Versions, conf.Versions) - require.NotNil(t, conf.LDBOptions) - require.Equal(t, conf.LDBOptions.Strict, ldbopt.StrictJournal) -} diff --git a/db/bench_test.go b/db/bench_test.go deleted file mode 100644 index 4f394d4..0000000 --- a/db/bench_test.go +++ /dev/null @@ -1,245 +0,0 @@ -package db_test - -import ( - "crypto/rand" - "os" - "testing" - - pb "github.com/rotationalio/honu/object/v1" - "github.com/stretchr/testify/require" - "github.com/syndtr/goleveldb/leveldb" -) - -// Global variables to prevent compiler optimizations -var ( - gKey []byte - gValue []byte - gErr error - gObj *pb.Object -) - -func setupLevelDB(t testing.TB) (*leveldb.DB, string) { - // Create a new leveldb database in a temporary directory - tmpDir, err := os.MkdirTemp("", "leveldb-*") - require.NoError(t, err) - - // Open a leveldb database directly without honu wrapper - db, err := leveldb.OpenFile(tmpDir, nil) - if err != nil && tmpDir != "" { - os.RemoveAll(tmpDir) - } - require.NoError(t, err) - - t.Cleanup(func() { - db.Close() - os.RemoveAll(tmpDir) - }) - - return db, tmpDir -} - -func BenchmarkHonuGet(b *testing.B) { - db, _ := setupHonuDB(b) - - // Create a key and value - key := []byte("foo") - value := make([]byte, 4096) - _, err := rand.Read(value) - require.NoError(b, err) - - _, err = db.Put(key, value) - require.NoError(b, err) - - // Reset the timer to focus only on the get call - b.ResetTimer() - for i := 0; i < b.N; i++ { - gValue, gErr = db.Get(key) - } - - require.NoError(b, gErr) - require.Equal(b, value, gValue) -} - -func BenchmarkLevelDBGet(b *testing.B) { - db, _ := setupLevelDB(b) - - // Create a key and value - key := []byte("foo") - value := make([]byte, 4096) - _, err := rand.Read(value) - require.NoError(b, err) - - require.NoError(b, db.Put(key, value, nil)) - - // Reset the timer to focus only on the get call - b.ResetTimer() - for i := 0; i < b.N; i++ { - gValue, gErr = db.Get(key, nil) - } - - require.NoError(b, gErr) - require.Equal(b, value, gValue) -} - -func BenchmarkHonuPut(b *testing.B) { - db, _ := setupHonuDB(b) - - // Create a key and value - key := []byte("foo") - value := make([]byte, 4096) - _, err := rand.Read(value) - require.NoError(b, err) - - // Reset the timer to focus only on the get call - b.ResetTimer() - for i := 0; i < b.N; i++ { - _, gErr = db.Put(key, value) - } - - require.NoError(b, gErr) -} - -func BenchmarkLevelDBPut(b *testing.B) { - db, _ := setupLevelDB(b) - - // Create a key and value - key := []byte("foo") - value := make([]byte, 4096) - _, err := rand.Read(value) - require.NoError(b, err) - - // Reset the timer to focus only on the get call - b.ResetTimer() - for i := 0; i < b.N; i++ { - gErr = db.Put(key, value, nil) - } - - require.NoError(b, gErr) -} - -func BenchmarkHonuDelete(b *testing.B) { - db, _ := setupHonuDB(b) - - // Create a key and value - key := []byte("foo") - value := make([]byte, 4096) - _, err := rand.Read(value) - require.NoError(b, err) - - // Reset the timer to focus only on the get call - b.ResetTimer() - for i := 0; i < b.N; i++ { - b.StopTimer() - _, err = db.Put(key, value) - require.NoError(b, err) - b.StartTimer() - _, gErr = db.Delete(key) - } - - require.NoError(b, gErr) -} - -func BenchmarkLevelDBDelete(b *testing.B) { - db, _ := setupLevelDB(b) - - // Create a key and value - key := []byte("foo") - value := make([]byte, 4096) - _, err := rand.Read(value) - require.NoError(b, err) - - // Reset the timer to focus only on the get call - b.ResetTimer() - for i := 0; i < b.N; i++ { - b.StopTimer() - require.NoError(b, db.Put(key, value, nil)) - b.StartTimer() - gErr = db.Delete(key, nil) - } - - require.NoError(b, gErr) -} - -func BenchmarkHonuIter(b *testing.B) { - db, _ := setupHonuDB(b) - - // Create a key and value - for _, key := range []string{"aa", "bb", "cc", "dd", "ee", "ff", "gg", "hh", "ii", "jj"} { - value := make([]byte, 4096) - _, err := rand.Read(value) - require.NoError(b, err) - - _, err = db.Put([]byte(key), value) - require.NoError(b, err) - } - - // Reset the timer to focus only on the get call - b.ResetTimer() - for i := 0; i < b.N; i++ { - iter, err := db.Iter(nil) - require.NoError(b, err) - for iter.Next() { - gKey = iter.Key() - gValue = iter.Value() - } - - gErr = iter.Error() - iter.Release() - } - - require.NoError(b, gErr) - require.Len(b, gKey, 2) - require.Len(b, gValue, 4096) -} - -func BenchmarkLevelDBIter(b *testing.B) { - db, _ := setupLevelDB(b) - - // Create a key and value - for _, key := range []string{"aa", "bb", "cc", "dd", "ee", "ff", "gg", "hh", "ii", "jj"} { - value := make([]byte, 4096) - _, err := rand.Read(value) - require.NoError(b, err) - - require.NoError(b, db.Put([]byte(key), value, nil)) - } - - // Reset the timer to focus only on the get call - b.ResetTimer() - for i := 0; i < b.N; i++ { - iter := db.NewIterator(nil, nil) - for iter.Next() { - gKey = iter.Key() - gValue = iter.Value() - } - - gErr = iter.Error() - iter.Release() - } - - require.NoError(b, gErr) - require.Len(b, gKey, 2) - require.Len(b, gValue, 4096) -} - -func BenchmarkHonuObject(b *testing.B) { - db, _ := setupHonuDB(b) - - // Create a key and value - key := []byte("foo") - value := make([]byte, 4096) - _, err := rand.Read(value) - require.NoError(b, err) - - _, err = db.Put(key, value) - require.NoError(b, err) - - // Reset the timer to focus only on the get call - b.ResetTimer() - for i := 0; i < b.N; i++ { - gObj, gErr = db.Object(key) - } - - require.NoError(b, gErr) - require.NotEmpty(b, gObj) -} diff --git a/db/dsn.go b/db/dsn.go deleted file mode 100644 index 162382d..0000000 --- a/db/dsn.go +++ /dev/null @@ -1,31 +0,0 @@ -package db - -import ( - "errors" - "fmt" - "net/url" - "strings" -) - -// DSN represents the parsed components of an embedded database service. -type DSN struct { - Scheme string - Path string -} - -// ParseDSN converts a database URI or URL string into a structured DSN representation. -func ParseDSN(uri string) (_ *DSN, err error) { - dsn, err := url.Parse(uri) - if err != nil { - return nil, fmt.Errorf("could not parse dsn: %s", err) - } - - if dsn.Scheme == "" || dsn.Path == "" { - return nil, errors.New("could not parse dsn, specify scheme:///relative/path/to/db") - } - - return &DSN{ - Scheme: dsn.Scheme, - Path: strings.TrimPrefix(dsn.Path, "/"), - }, nil -} diff --git a/db/dsn_test.go b/db/dsn_test.go deleted file mode 100644 index f00b634..0000000 --- a/db/dsn_test.go +++ /dev/null @@ -1,33 +0,0 @@ -package db_test - -import ( - "testing" - - . "github.com/rotationalio/honu/db" - "github.com/stretchr/testify/require" -) - -func TestDSNParsing(t *testing.T) { - cases := []struct { - uri string - dsn *DSN - }{ - {"leveldb:///fixtures/db", &DSN{"leveldb", "fixtures/db"}}, - {"sqlite3:///fixtures/db", &DSN{"sqlite3", "fixtures/db"}}, - {"leveldb:////data/db", &DSN{"leveldb", "/data/db"}}, - {"sqlite3:////data/db", &DSN{"sqlite3", "/data/db"}}, - } - - for _, tc := range cases { - dsn, err := ParseDSN(tc.uri) - require.NoError(t, err) - require.Equal(t, tc.dsn, dsn) - } - - // Test error cases - _, err := ParseDSN("foo") - require.Error(t, err) - - _, err = ParseDSN("foo://") - require.Error(t, err) -} diff --git a/db/engines/badger/badger.go b/db/engines/badger/badger.go deleted file mode 100644 index cf224ba..0000000 --- a/db/engines/badger/badger.go +++ /dev/null @@ -1,26 +0,0 @@ -package badger - -import ( - "errors" - - "github.com/rotationalio/honu/config" - engine "github.com/rotationalio/honu/db/engines" -) - -func Open(conf config.Config) (*BadgerEngine, error) { - return &BadgerEngine{}, errors.New("not implemented yet") -} - -type BadgerEngine struct{} - -func (db *BadgerEngine) Engine() string { - return "badger" -} - -func (db *BadgerEngine) Close() error { - return errors.New("not implemented yet") -} - -func (db *BadgerEngine) Begin(readonly bool) (engine.Transaction, error) { - return nil, errors.New("not implemented yet") -} diff --git a/db/engines/engine.go b/db/engines/engine.go deleted file mode 100644 index 2587925..0000000 --- a/db/engines/engine.go +++ /dev/null @@ -1,40 +0,0 @@ -package engine - -import ( - "github.com/rotationalio/honu/iterator" - opts "github.com/rotationalio/honu/options" -) - -// Engines are the disk storage mechanism that Honu wraps. Users may chose different -// engines for a variety of reasons, including variable performance benefits, different -// features, or even implement heterogeneous Honu networks composed of different engines. -type Engine interface { - // Engine returns the engine name and is used for debugging and logging. - Engine() string - - // Close the engine so that it no longer can be accessed. - Close() error - - // Begin a transaction to issue multiple commands (this is an internal transaction - // for Honu-specific version management, not an external interface). - Begin(readonly bool) (tx Transaction, err error) -} - -// Store is a simple key/value interface that allows for Get, Put, and Delete. Nearly -// all engines should support the Store interface. -type Store interface { - Has(key []byte, options *opts.Options) (exists bool, err error) - Get(key []byte, options *opts.Options) (value []byte, err error) - Put(key, value []byte, options *opts.Options) error - Delete(key []byte, options *opts.Options) error -} - -// Iterator engines allow queries that scan a range of consecutive keys. -type Iterator interface { - Iter(prefix []byte, options *opts.Options) (i iterator.Iterator, err error) -} - -type Transaction interface { - Store - Finish() error -} diff --git a/db/engines/errors.go b/db/engines/errors.go deleted file mode 100644 index a1d86b4..0000000 --- a/db/engines/errors.go +++ /dev/null @@ -1,9 +0,0 @@ -package engine - -import "errors" - -var ( - ErrNotFound = errors.New("not found") - ErrReadOnlyTx = errors.New("cannot execute a write operation in a read only transaction") - ErrAlreadyExists = errors.New("specified key already exists in the database") -) diff --git a/db/engines/leveldb/iter.go b/db/engines/leveldb/iter.go deleted file mode 100644 index 2c8add4..0000000 --- a/db/engines/leveldb/iter.go +++ /dev/null @@ -1,112 +0,0 @@ -package leveldb - -import ( - "bytes" - - honuiter "github.com/rotationalio/honu/iterator" - pb "github.com/rotationalio/honu/object/v1" - opts "github.com/rotationalio/honu/options" - "github.com/syndtr/goleveldb/leveldb/iterator" - "google.golang.org/protobuf/proto" -) - -// NewLevelDBIterator creates a new iterator that wraps a leveldb Iterator with object -// management access and Honu-specific serialization. -func NewLevelDBIterator(iter iterator.Iterator, options *opts.Options) honuiter.Iterator { - return &ldbIterator{ldb: iter, options: options} -} - -// Wraps the underlying leveldb iterator to provide object management access. -type ldbIterator struct { - ldb iterator.Iterator - options *opts.Options -} - -// Type check for the ldbIterator -var _ honuiter.Iterator = &ldbIterator{} - -func (i *ldbIterator) Error() error { return i.ldb.Error() } -func (i *ldbIterator) Release() { i.ldb.Release() } - -func (i *ldbIterator) Next() bool { - if ok := i.ldb.Next(); !ok { - return false - } - - // If we aren't including Tombstones, we need to check if the next version is a - // tombstone before we know if we have a next value or not. - if !i.options.Tombstones { - if obj, err := i.Object(); err != nil || obj.Tombstone() { - return i.Next() - } - } - return true -} - -func (i *ldbIterator) Prev() bool { - if ok := i.ldb.Prev(); !ok { - return false - } - - // If we aren't including Tombstones, we need to check if the next version is a - // tombstone before we know if we have a next value or not. - if !i.options.Tombstones { - if obj, err := i.Object(); err != nil || obj.Tombstone() { - return i.Prev() - } - } - return true -} - -func (i *ldbIterator) Seek(key []byte) bool { - // We need to prefix the seek with the correct namespace - if i.options.Namespace != "" { - key = prepend(i.options.Namespace, key) - } - - if ok := i.ldb.Seek(key); !ok { - return false - } - - // If we aren't including Tombstones, we need to check if the check if the current - // version is a tombstone, and if not, continue to the next non-tombstone object - if !i.options.Tombstones { - if obj, err := i.Object(); err != nil || obj.Tombstone() { - return i.Next() - } - } - return true -} - -func (i *ldbIterator) Key() []byte { - // Fetch the key then split the namespace from the key - // Note that because the namespace itself might have colons in it, we - // strip off the namespace prefix then remove any preceding colons. - key := i.ldb.Key() - if i.options.Namespace != "" { - prefix := prepend(i.options.Namespace, nil) - return bytes.TrimPrefix(key, prefix) - } - return key -} - -func (i *ldbIterator) Value() []byte { - obj, err := i.Object() - if err != nil { - // NOTE: if err is not nil, it's up to the caller to get the error from Object - return nil - } - return obj.Data -} - -func (i *ldbIterator) Object() (obj *pb.Object, err error) { - obj = new(pb.Object) - if err = proto.Unmarshal(i.ldb.Value(), obj); err != nil { - return nil, err - } - return obj, nil -} - -func (i *ldbIterator) Namespace() string { - return i.options.Namespace -} diff --git a/db/engines/leveldb/iter_test.go b/db/engines/leveldb/iter_test.go deleted file mode 100644 index c861c23..0000000 --- a/db/engines/leveldb/iter_test.go +++ /dev/null @@ -1,109 +0,0 @@ -package leveldb_test - -import ( - "bytes" - "crypto/rand" - "fmt" - "testing" - - pb "github.com/rotationalio/honu/object/v1" - "github.com/stretchr/testify/require" - "google.golang.org/protobuf/proto" -) - -// This test verifies LevelDB functionality to ensure that our iterator functionality -// matches the expected iterator API for leveldb. -func TestLevelDBFunctionality(t *testing.T) { - // Setup a levelDB Engine and create a bunch of keys. - engine, _ := setupLevelDBEngine(t) - ldb := engine.DB() - - keys := make([][]byte, 0, 100) - for i := 0; i < 100; i++ { - key := []byte(fmt.Sprintf("%04d", i)) - keys = append(keys, key) - require.NoError(t, ldb.Put(key, randomData(192), nil), "could not put fixture data") - } - - // Create an iterator to test Seek/Prev/Next functionality - iter := ldb.NewIterator(nil, nil) - - // When next has not been called, what does Prev do? - require.False(t, iter.Prev(), "if Prev is called before Next, we expect it to return false") - - // If we seek to the first key, the value of the key should be the first key - // If we call Prev, we should get false, because the Seek was to the first key but - // what is the value of the cursor, do we have to call Next again to get back to - // the first key? - require.True(t, iter.Seek(keys[0]), "we should be able to seek to the first key") - require.True(t, bytes.Equal(iter.Key(), keys[0]), "the cursor is now at the first key") - require.False(t, iter.Prev(), "if we're at the first key, prev should be false") - require.Nil(t, iter.Key(), "call Prev moved us behind the first key - so it should now be nil") - require.True(t, iter.Next(), "we should now be able to move back to the first key") - require.True(t, bytes.Equal(iter.Key(), keys[0]), "the cursor is now at the first key") -} - -// Test Honu seek behavior matches LevelDB API -func TestHonuSeek(t *testing.T) { - // Setup a levelDB Engine and create a bunch of keys. - db, _ := setupLevelDBEngine(t) - - keys := make([][]byte, 0, 100) - for i := 0; i < 100; i++ { - key := []byte(fmt.Sprintf("%04d", i)) - keys = append(keys, key) - require.NoError(t, db.Put(key, randomObject(key, 192), nil), "could not put fixture data") - } - - // Create an iterator to test Seek/Prev/Next functionality - iter, err := db.Iter(nil, nil) - require.NoError(t, err, "could not create honu leveldb iterator") - - // When next has not been called, what does Prev do? - require.False(t, iter.Prev(), "if Prev is called before Next, we expect it to return false") - - // If we seek to the first key, the value of the key should be the first key - // If we call Prev, we should get false, because the Seek was to the first key but - // what is the value of the cursor, do we have to call Next again to get back to - // the first key? - require.True(t, iter.Seek(keys[0]), "we should be able to seek to the first key") - require.True(t, bytes.Equal(iter.Key(), keys[0]), "the cursor is now at the first key") - require.False(t, iter.Prev(), "if we're at the first key, prev should be false") - require.Nil(t, iter.Key(), "call Prev moved us behind the first key - so it should now be nil") - require.True(t, iter.Next(), "we should now be able to move back to the first key") - require.True(t, bytes.Equal(iter.Key(), keys[0]), "the cursor is now at the first key") -} - -// Helper function to generate random data -func randomData(len int) []byte { - data := make([]byte, len) - if _, err := rand.Read(data); err != nil { - panic(err) - } - return data -} - -// Helper function to generate a random object data -func randomObject(key []byte, len int) []byte { - obj := &pb.Object{ - Key: key, - Namespace: "default", - Version: &pb.Version{ - Pid: 1, - Version: 1, - Region: "testing", - Parent: nil, - Tombstone: false, - }, - Region: "testing", - Owner: "testing", - Data: randomData(len), - } - - // Marshal the object - data, err := proto.Marshal(obj) - if err != nil { - panic(err) - } - return data -} diff --git a/db/engines/leveldb/leveldb.go b/db/engines/leveldb/leveldb.go deleted file mode 100644 index 410dcf3..0000000 --- a/db/engines/leveldb/leveldb.go +++ /dev/null @@ -1,237 +0,0 @@ -package leveldb - -import ( - "bytes" - "errors" - "sync" - - "github.com/rotationalio/honu/config" - engine "github.com/rotationalio/honu/db/engines" - "github.com/rotationalio/honu/iterator" - opts "github.com/rotationalio/honu/options" - "github.com/syndtr/goleveldb/leveldb" - "github.com/syndtr/goleveldb/leveldb/util" -) - -// Open a leveldb engine as the backend to the Honu database. -func Open(path string, conf config.Config) (_ *LevelDBEngine, err error) { - engine := &LevelDBEngine{} - if engine.ldb, err = leveldb.OpenFile(path, conf.LDBOptions); err != nil { - return nil, err - } - return engine, nil -} - -// LevelDBEngine implements Engine and Store -type LevelDBEngine struct { - sync.RWMutex - ldb *leveldb.DB -} - -// Transaction implements Transaction -type Transaction struct { - db *LevelDBEngine - ro bool -} - -// Returns the underlying database object for direct access by the caller, to enable -// backups, etc. -func (db *LevelDBEngine) DB() *leveldb.DB { - return db.ldb -} - -// Returns the name of the engine type. -func (db *LevelDBEngine) Engine() string { - return "leveldb" -} - -// Close the database and flush all remaining writes to disk. LevelDB requires a close -// for graceful shutdown to ensure there is no data loss. -func (db *LevelDBEngine) Close() error { - return db.ldb.Close() -} - -// Begin a multi-operation transaction (used primarily for Put and Delete) -func (db *LevelDBEngine) Begin(readonly bool) (engine.Transaction, error) { - if readonly { - db.RLock() - } else { - db.Lock() - } - return &Transaction{db: db, ro: readonly}, nil -} - -// Finish a multi-operation transaction -func (tx *Transaction) Finish() error { - if tx.ro { - tx.db.RUnlock() - } else { - tx.db.Unlock() - } - return nil -} - -// Has returns true if the DB does contains the given key. -func (tx *Transaction) Has(key []byte, options *opts.Options) (bool, error) { - return tx.db.has(key, options) -} - -// Has returns true if the DB does contains the given key. -func (db *LevelDBEngine) Has(key []byte, options *opts.Options) (bool, error) { - db.RLock() - defer db.RUnlock() - return db.has(key, options) -} - -// Has returns true if the DB does contains the given key. -func (db *LevelDBEngine) has(key []byte, options *opts.Options) (_ bool, err error) { - // Create a default to prevent panics when accessing options. - if options == nil { - if options, err = opts.New(); err != nil { - return false, err - } - } - - // Namespaces in leveldb are provided not by buckets but by namespace:: prefixed keys - if options.Namespace != "" { - key = prepend(options.Namespace, key) - } - - return db.ldb.Has(key, options.LevelDBRead) -} - -// Get the latest version of the object stored by the key. This is the Transaction Get -// method which can be used in either readonly or write modes. This is the preferred -// mechanism to access the underlying engine. -func (tx *Transaction) Get(key []byte, options *opts.Options) (value []byte, err error) { - return tx.db.get(key, options) -} - -// Get the latest version of the object stored by the key. This is the Store Get method -// which can be used directly without a transaction. It is a unary operation that will -// read lock the database. -func (db *LevelDBEngine) Get(key []byte, options *opts.Options) (value []byte, err error) { - db.RLock() - defer db.RUnlock() - return db.get(key, options) -} - -// Thread-unsafe get that is called both by the Transaction and the Store. -func (db *LevelDBEngine) get(key []byte, options *opts.Options) (value []byte, err error) { - // Create a default to prevent panics when accessing options. - if options == nil { - if options, err = opts.New(); err != nil { - return nil, err - } - } - // Namespaces in leveldb are provided not by buckets but by namespace:: prefixed keys - if options.Namespace != "" { - key = prepend(options.Namespace, key) - } - - if value, err = db.ldb.Get(key, options.LevelDBRead); err != nil && errors.Is(err, leveldb.ErrNotFound) { - return value, engine.ErrNotFound - } - return value, err -} - -// Put a new value to the specified key. This is the Transaction Put method which is -// used by Honu to ensure consistency across version updates and can only be used in a -// write transaction. -func (tx *Transaction) Put(key, value []byte, options *opts.Options) (err error) { - if tx.ro { - return engine.ErrReadOnlyTx - } - return tx.db.put(key, value, options) -} - -// Put a new value to the specified key and update the version. This is the Store Put -// method which can be used directly without a transaction. It is a unary operation that -// will lock the database to synchronize it with respect to other transactions. -func (db *LevelDBEngine) Put(key, value []byte, options *opts.Options) (err error) { - db.Lock() - defer db.Unlock() - return db.put(key, value, options) -} - -// Thread-unsafe put that is called both by the Transaction and the Store. -func (db *LevelDBEngine) put(key, value []byte, options *opts.Options) (err error) { - // Create a default to prevent panics when accessing options. - if options == nil { - if options, err = opts.New(); err != nil { - return err - } - } - // Namespaces in leveldb are provided not by buckets but by namespace:: prefixed keys - if options.Namespace != "" { - key = prepend(options.Namespace, key) - } - return db.ldb.Put(key, value, options.LevelDBWrite) -} - -// Delete the object represented by the key, removing it from the database entirely. -// This is the Transaction Delete method which is used by Honu to clean up and vacuum -// the database or to reset an object back to the first version. Note that normal Honu -// deletes Put a tombstone rather than directly deleting data from the database. -func (tx *Transaction) Delete(key []byte, options *opts.Options) (err error) { - if tx.ro { - return engine.ErrReadOnlyTx - } - return tx.db.delete(key, options) -} - -// Delete the object represented by the key, removing it from the database entirely. -// This is the Store Delete method which can be used directly without a transaction. It -// is a unary operation that will lock the database to synchronize it with respect to -// other transactions. Note that normal Honu deletes Put a tombstone rather than -// directly deleting data from the database. -func (db *LevelDBEngine) Delete(key []byte, options *opts.Options) (err error) { - db.Lock() - defer db.Unlock() - return db.delete(key, options) -} - -// Thread-unsafe delete that is called both by the Transaction and the Store. -func (db *LevelDBEngine) delete(key []byte, options *opts.Options) (err error) { - // Create a default to prevent panics when accessing options. - if options == nil { - if options, err = opts.New(); err != nil { - return err - } - } - // Namespaces in leveldb are provided not by buckets but by namespace:: prefixed keys - if options.Namespace != "" { - key = prepend(options.Namespace, key) - } - return db.ldb.Delete(key, options.LevelDBWrite) -} - -func (db *LevelDBEngine) Iter(prefix []byte, options *opts.Options) (i iterator.Iterator, err error) { - // Create a default to prevent panics when accessing options. - if options == nil { - if options, err = opts.New(); err != nil { - return nil, err - } - } - // Namespaces in leveldb are provided not by buckets but by namespace:: prefixed keys - if options.Namespace != "" { - prefix = prepend(options.Namespace, prefix) - } - var slice *util.Range - if len(prefix) > 0 { - slice = util.BytesPrefix(prefix) - } - return NewLevelDBIterator(db.ldb.NewIterator(slice, options.LevelDBRead), options), nil -} - -var nssep = []byte("::") - -// prepend the namespace to the key -func prepend(namespace string, key []byte) []byte { - return bytes.Join( - [][]byte{ - []byte(namespace), - key, - }, nssep, - ) -} diff --git a/db/engines/leveldb/leveldb_test.go b/db/engines/leveldb/leveldb_test.go deleted file mode 100644 index 7f1b2fd..0000000 --- a/db/engines/leveldb/leveldb_test.go +++ /dev/null @@ -1,241 +0,0 @@ -package leveldb_test - -import ( - "os" - "testing" - - "github.com/rotationalio/honu/config" - engine "github.com/rotationalio/honu/db/engines" - "github.com/rotationalio/honu/db/engines/leveldb" - "github.com/rotationalio/honu/iterator" - pb "github.com/rotationalio/honu/object/v1" - "github.com/rotationalio/honu/options" - "github.com/stretchr/testify/require" - "google.golang.org/protobuf/proto" -) - -// a test set of key/value pairs used to evaluate iteration -// note because :: is the namespace separator in leveldb, we want to ensure that keys -// with colons are correctly iterated on. -var pairs = [][]string{ - {"aa", "first"}, - {"ab", "second"}, - {"b::a", "third"}, - {"b::b", "fourth"}, - {"b::c", "fifth"}, - {"ca", "sixth"}, - {"cb", "seventh"}, -} - -// Returns a constant list of namespace strings. -var testNamespaces = []string{ - "", - "basic", - "namespace with spaces", - "namespace::with::colons", -} - -// Returns a LevelDBEngine and the path where it was created. -func setupLevelDBEngine(t testing.TB) (_ *leveldb.LevelDBEngine, path string) { - tempDir, err := os.MkdirTemp("", "leveldb-*") - require.NoError(t, err) - - conf, _ := config.New() - engine, err := leveldb.Open(tempDir, conf) - if err != nil { - os.RemoveAll(tempDir) - } - require.NoError(t, err) - - // Add a cleanup function to ensure the fixture is deleted after tests - t.Cleanup(func() { - // Teardown after finishing the test - engine.Close() - os.RemoveAll(tempDir) - }) - - return engine, tempDir -} - -// Creates an options.Options struct with namespace set and returns a pointer to it. -func namespaceOpts(namespace string, t *testing.T) *options.Options { - opts, err := options.New(options.WithNamespace(namespace)) - require.NoError(t, err) - return opts -} - -// Wraps engine.Store.Put with testing checks. -func checkPut(ldbStore engine.Store, opts *options.Options, key []byte, value []byte, t *testing.T) { - err := ldbStore.Put(key, value, opts) - require.NoError(t, err) -} - -// Wraps engine.Store.Has with testing checks -func checkHas(ldbStore engine.Store, opts *options.Options, key []byte, assert require.BoolAssertionFunc, t *testing.T) { - exists, err := ldbStore.Has(key, opts) - require.NoError(t, err) - assert(t, exists) -} - -// Wraps engine.Store.Get with testing checks. -func checkGet(ldbStore engine.Store, opts *options.Options, key []byte, expectedValue []byte, t *testing.T) { - getValue, err := ldbStore.Get(key, opts) - require.NoError(t, err) - require.Equal(t, getValue, expectedValue) -} - -// Wraps engine.Store.Delete with testing checks. -func checkDelete(ldbStore engine.Store, opts *options.Options, key []byte, t *testing.T) { - err := ldbStore.Delete(key, opts) - require.NoError(t, err) - - value, err := ldbStore.Get(key, opts) - require.Equal(t, err, engine.ErrNotFound) - require.Empty(t, value) -} - -func TestLevelDBEngine(t *testing.T) { - // Setup a levelDB Engine. - ldbEngine, ldbPath := setupLevelDBEngine(t) - require.Equal(t, "leveldb", ldbEngine.Engine()) - - // Ensure the db was created. - require.DirExists(t, ldbPath) - - // Use a constant key to ensure namespaces - // are working correctly. - key := []byte("foo") - - // Check Put, Get and Delete with a nil namespace. - value := []byte("nil") - checkPut(ldbEngine, nil, key, value, t) - checkGet(ldbEngine, nil, key, value, t) - checkDelete(ldbEngine, nil, key, t) - - // Iterate through a list of namespaces and ensure - // Put, Get and Delete are working. - for _, namespace := range testNamespaces { - opts := namespaceOpts(namespace, t) - value := []byte(namespace) - checkPut(ldbEngine, opts, key, value, t) - checkGet(ldbEngine, opts, key, value, t) - checkDelete(ldbEngine, opts, key, t) - } -} - -func TestLevelDBTransactions(t *testing.T) { - ldbEngine, _ := setupLevelDBEngine(t) - - // Use a constant key to ensure namespaces - // are working correctly. - key := []byte("tx") - - // Iterate through a list of namespaces and ensure - // Put, Get and Delete are working with transactions. - for _, namespace := range testNamespaces { - // Start a transaction with readonly set to false. - tx, err := ldbEngine.Begin(false) - require.NoError(t, err) - - opts, err := options.New(options.WithNamespace(namespace)) - require.NoError(t, err) - value := []byte(namespace) - checkHas(tx, opts, key, require.False, t) - checkPut(tx, opts, key, value, t) - checkHas(tx, opts, key, require.True, t) - checkGet(tx, opts, key, value, t) - checkDelete(tx, opts, key, t) - - // Complete the transaction. - require.NoError(t, tx.Finish()) - } - - // Begin a transaction with readonly set to true. - tx, err := ldbEngine.Begin(true) - require.NoError(t, err) - - // Ensure Put fails with readonly set. - err = tx.Put([]byte("bad"), []byte("write"), nil) - require.Equal(t, err, engine.ErrReadOnlyTx) - err = tx.Delete([]byte("bad"), nil) - require.Equal(t, err, engine.ErrReadOnlyTx) - - // Complete the transaction. - require.NoError(t, tx.Finish()) -} - -func TestLevelDBIter(t *testing.T) { - ldbEngine, _ := setupLevelDBEngine(t) - - for _, namespace := range testNamespaces { - // Add data to the database to iterate over. - opts := namespaceOpts(namespace, t) - - addIterPairsToDB(ldbEngine, opts, pairs, t) - - // Try to iterate over all keys - prefix := []byte("") - iter, err := ldbEngine.Iter(prefix, opts) - require.NoError(t, err) - collected := iterate(iter, prefix, pairs, t) - require.Equal(t, len(pairs), collected) - - // Try to iterate over all keys that start with "b" - prefix = []byte("b") - iter, err = ldbEngine.Iter(prefix, opts) - require.NoError(t, err) - bPairs := [][]string{ - pairs[2], - pairs[3], - pairs[4], - } - collected = iterate(iter, prefix, bPairs, t) - require.Equal(t, 3, collected) - } -} - -// Helper function for TestLevelDBIter that iterates over the keys starting -// with 'prefix' using iter, checking that the values are correct with 'pairs' -// and returns the number of values iterated over. -func iterate(iter iterator.Iterator, prefix []byte, pairs [][]string, t *testing.T) int { - collected := 0 - for iter.Next() { - key := string(iter.Key()) - expectedKey := pairs[collected][0] - require.Equal(t, expectedKey, key) - - value := string(iter.Value()) - expectedValue := pairs[collected][1] - require.Equal(t, expectedValue, value) - - collected++ - } - return collected -} - -// Helper function for TestLevelDBIter that puts a range of data into the database. -func addIterPairsToDB(ldbStore engine.Store, opts *options.Options, pairs [][]string, t *testing.T) { - for _, pair := range pairs { - key := []byte(pair[0]) - value := []byte(pair[1]) - - obj := &pb.Object{ - Key: key, - Namespace: opts.Namespace, - Version: &pb.Version{ - Pid: 1, - Version: 1, - Region: "testing", - Parent: nil, - Tombstone: false, - }, - Region: "testing", - Owner: "testing", - Data: value, - } - - data, err := proto.Marshal(obj) - require.NoError(t, err) - checkPut(ldbStore, opts, key, data, t) - } -} diff --git a/db/engines/pebble/pebble.go b/db/engines/pebble/pebble.go deleted file mode 100644 index f33fd2f..0000000 --- a/db/engines/pebble/pebble.go +++ /dev/null @@ -1,79 +0,0 @@ -package pebble - -import ( - "errors" - - "github.com/cockroachdb/pebble" - "github.com/rotationalio/honu/config" - engine "github.com/rotationalio/honu/db/engines" - "github.com/rotationalio/honu/iterator" - opts "github.com/rotationalio/honu/options" -) - -type PebbleEngine struct { - pebble *pebble.DB -} - -// TODO: Allow Passing Pebble Options -func Open(path string, conf config.Config) (_ *PebbleEngine, err error) { - engine := &PebbleEngine{} - if engine.pebble, err = pebble.Open(path, nil); err != nil { - return nil, err - } - return engine, nil -} - -// Returns a string giving the engine type. -func (db *PebbleEngine) Engine() string { - return "pebble" -} - -// Close the database. -func (db *PebbleEngine) Close() error { - return db.pebble.Close() -} - -func (db *PebbleEngine) Begin(readonly bool) (engine.Transaction, error) { - return nil, errors.New("not implemented yet") -} - -// Get the latest version of the object stored by the key. -func (db *PebbleEngine) Get(key []byte, options ...opts.Option) (value []byte, err error) { - value, closer, err := db.pebble.Get(key) - if err != nil && errors.Is(err, pebble.ErrNotFound) { - return value, engine.ErrNotFound - } - if err := closer.Close(); err != nil { - return nil, err - } - return value, nil -} - -// Put a new value to the specified key and update the version. -func (db *PebbleEngine) Put(key, value []byte, options ...opts.Option) error { - var cfg *opts.Options - cfg.PebbleWrite = nil - for _, setOption := range options { - if err := setOption(cfg); err != nil { - return err - } - } - return db.pebble.Set(key, value, cfg.PebbleWrite) -} - -// Delete the object represented by the key, creating a tombstone object. -func (db *PebbleEngine) Delete(key []byte, options ...opts.Option) error { - var cfg *opts.Options - cfg.PebbleWrite = nil - for _, setOption := range options { - if err := setOption(cfg); err != nil { - return err - } - } - return db.pebble.Delete(key, cfg.PebbleWrite) -} - -// TODO: Implement pebble iteration (engines/pebble/iter.go) -func (db *PebbleEngine) Iter(prefix []byte) (i iterator.Iterator, err error) { - return nil, errors.New("not implemented yet") -} diff --git a/db/honu.go b/db/honu.go deleted file mode 100644 index 13aafea..0000000 --- a/db/honu.go +++ /dev/null @@ -1,394 +0,0 @@ -/* -Package honu provides a thin wrapper over an embedded database (leveldb, sqlite) that -provides version history to object changes and anti-entropy replication. -*/ -package db - -import ( - "errors" - "fmt" - - "github.com/rotationalio/honu/config" - engine "github.com/rotationalio/honu/db/engines" - "github.com/rotationalio/honu/db/engines/badger" - "github.com/rotationalio/honu/db/engines/leveldb" - "github.com/rotationalio/honu/db/engines/pebble" - "github.com/rotationalio/honu/iterator" - pb "github.com/rotationalio/honu/object/v1" - opts "github.com/rotationalio/honu/options" - "github.com/rotationalio/honu/versions" - "google.golang.org/protobuf/proto" - "google.golang.org/protobuf/types/known/timestamppb" -) - -// DB is a Honu embedded database. -// Currently DB simply wraps a leveldb database -type DB struct { - engine engine.Engine - vm *versions.Manager -} - -// Open a replicated embedded database with the specified URI. Database URIs should -// specify protocol:///relative/path/to/db for embedded databases. For absolute paths, -// specify protocol:////absolute/path/to/db. -func Open(uri string, options ...config.Option) (db *DB, err error) { - // Create a configuration from the options passed in. - var conf config.Config - if conf, err = config.New(options...); err != nil { - return nil, err - } - - var dsn *DSN - if dsn, err = ParseDSN(uri); err != nil { - return nil, err - } - - db = &DB{} - if db.vm, err = versions.New(conf.Versions); err != nil { - return nil, err - } - - switch dsn.Scheme { - case "leveldb": - // TODO: multiple leveldb databases for different namespaces - // TODO: transactions that do not lock all namespaces - if db.engine, err = leveldb.Open(dsn.Path, conf); err != nil { - return nil, err - } - case "badger", "badgerdb": - if db.engine, err = badger.Open(conf); err != nil { - return nil, err - } - case "pebble", "pebbledb": - if db.engine, err = pebble.Open(dsn.Path, conf); err != nil { - return nil, err - } - default: - return nil, fmt.Errorf("unhandled database scheme %q", dsn.Scheme) - } - - return db, nil -} - -// Close the database, allowing no further interactions. -func (db *DB) Close() error { - return db.engine.Close() -} - -// Object returns metadata associated with the latest object stored by the key. -// Object is the Get function to use if you want to fetch tombstones, otherwise use Get -// which will return a not found error. -func (db *DB) Object(key []byte, options ...opts.Option) (_ *pb.Object, err error) { - var tx engine.Transaction - if tx, err = db.engine.Begin(true); err != nil { - return nil, err - } - defer tx.Finish() - - // Collect the options - var cfg *opts.Options - if cfg, err = opts.New(options...); err != nil { - return nil, err - } - - // Fetch the value from the database - var value []byte - if value, err = tx.Get(key, cfg); err != nil { - // TODO: should we wrap the leveldb error? - return nil, err - } - - // Parse the object record to extract the value data - obj := new(pb.Object) - if err = proto.Unmarshal(value, obj); err != nil { - // TODO: better error message here - return nil, err - } - return obj, nil -} - -// Get the latest version of the object stored by the key. -func (db *DB) Get(key []byte, options ...opts.Option) (value []byte, err error) { - var obj *pb.Object - if obj, err = db.Object(key, options...); err != nil { - return nil, err - } - - if obj.Tombstone() { - // The object is deleted, so return not found - // TODO: standardize error messages - return nil, engine.ErrNotFound - } - - // Return the wrapped data - return obj.Data, nil -} - -// UpdateType is an intermediate solution to tracking what's happening to the version -// history when direct modifications are applied to the database. -// NOTE: this data type is subject to change in later versions and should be treated -// as a prototype only in production code. -type UpdateType uint8 - -const ( - UpdateNoChange UpdateType = iota // No change occurred (nothing was written to disk) - UpdateForced // The update was forced, so the previous version was not checked - UpdateLinear // The previous version is the parent of the updating version - UpdateStomp // The previous version is concurrent but has a lower precedence than the updating version - UpdateSkip // The previous version is later but is not concurrent nor linear from the updating version - -) - -func (u UpdateType) String() string { - switch u { - case UpdateNoChange: - return "unchanged" - case UpdateForced: - return "forced" - case UpdateLinear: - return "linear" - case UpdateStomp: - return "stomped" - case UpdateSkip: - return "skipped" - default: - return "unknown" - } -} - -// Update an object directly in the database without modifying its version information. -// Update is to Put as Object is to Get - use Update when manually modifying the data -// store, for example during replication, but not for normal DB operations. Update also -// returns the type of update that ocurred, relative to the previous version. -func (db *DB) Update(obj *pb.Object, options ...opts.Option) (update UpdateType, err error) { - var tx engine.Transaction - if tx, err = db.engine.Begin(false); err != nil { - return UpdateNoChange, err - } - defer tx.Finish() - - // Collect the options - var cfg *opts.Options - if cfg, err = opts.New(options...); err != nil { - return UpdateNoChange, err - } - - // If the default namespace is specified use the object's namespace to ensure that - // if the user did not supply Namespace, Update still works. If the object was - // already in the default namespace, this should not cause a change to happen. There - // is an edge case where the user supplies options.WithNamespace("default") and an - // object that is not in the default namespace and the user option will be ignored - // in favor of the object's original namespace; but this is an unlikely case. - if cfg.Namespace == opts.NamespaceDefault { - cfg.Namespace = obj.Namespace - } - - if !cfg.Force { - // Check the namespace and that it matches the object - if cfg.Namespace != obj.Namespace { - return UpdateNoChange, errors.New("options namespace does not match object namespace") - } - - // Check that the version is later than the version being written to disk - var ( - prevData []byte - prev = new(pb.Object) - ) - if prevData, err = tx.Get(obj.Key, cfg); err != nil { - if !errors.Is(err, engine.ErrNotFound) { - return UpdateNoChange, fmt.Errorf("could not check previous version: %v", err) - } - } else { - if err = proto.Unmarshal(prevData, prev); err != nil { - return UpdateNoChange, fmt.Errorf("could not unmarshal previous version: %v", err) - } - } - - if !obj.Version.IsLater(prev.Version) { - return UpdateNoChange, fmt.Errorf("cannot update object, it is not a later version then the current object") - } - - // Determine the update type based on the previous version - // NOTE: all update conditions imply the current version is later than previous - switch { - case obj.Version.Stomps(prev.Version): - update = UpdateStomp - case obj.Version.Skips(prev.Version): - update = UpdateSkip - case obj.Version.LinearFrom(prev.Version): - update = UpdateLinear - default: - return UpdateNoChange, fmt.Errorf("cannot determine update relationship in the version history") - } - - } else { - // Report that the update was forced - update = UpdateForced - } - - // Put the version directly to disk - var data []byte - if data, err = proto.Marshal(obj); err != nil { - return UpdateNoChange, err - } - - if err = tx.Put(obj.Key, data, cfg); err != nil { - return UpdateNoChange, err - } - return update, nil -} - -// Put a new value to the specified key and update the version. -func (db *DB) Put(key, value []byte, options ...opts.Option) (_ *pb.Object, err error) { - var tx engine.Transaction - if tx, err = db.engine.Begin(false); err != nil { - return nil, err - } - defer tx.Finish() - - // Collect the options - var cfg *opts.Options - if cfg, err = opts.New(options...); err != nil { - return nil, err - } - - // Handle existence invariants - if cfg.RequireNotExists || cfg.RequireExists { - var exists bool - if exists, err = tx.Has(key, cfg); err != nil { - return nil, err - } - - if cfg.RequireExists && !exists { - return nil, engine.ErrNotFound - } - - if cfg.RequireNotExists && exists { - return nil, engine.ErrAlreadyExists - } - } - - // Get or Create the previous version - var data []byte - var obj *pb.Object - if data, err = tx.Get(key, cfg); err != nil { - if errors.Is(err, engine.ErrNotFound) { - obj = &pb.Object{ - Key: key, - Namespace: cfg.Namespace, - Created: timestamppb.Now(), - } - } else { - return nil, err - } - } else { - obj = new(pb.Object) - if err = proto.Unmarshal(data, obj); err != nil { - return nil, err - } - } - - // Update the version with the new data - obj.Data = value - if err = db.vm.Update(obj); err != nil { - return nil, err - } - - // Put the version back onto disk - if data, err = proto.Marshal(obj); err != nil { - return nil, err - } - if err = tx.Put(key, data, cfg); err != nil { - return nil, err - } - - // Test to make sure obj.Data is not modified if value is modified. - return obj, nil -} - -// Delete the object represented by the key, creating a tombstone object. -func (db *DB) Delete(key []byte, options ...opts.Option) (_ *pb.Object, err error) { - var tx engine.Transaction - if tx, err = db.engine.Begin(false); err != nil { - return nil, err - } - defer tx.Finish() - - // Collect the options - var cfg *opts.Options - if cfg, err = opts.New(options...); err != nil { - return nil, err - } - - // Handle existence invariants - if cfg.RequireNotExists || cfg.RequireExists { - var exists bool - if exists, err = tx.Has(key, cfg); err != nil { - return nil, err - } - - // Technically duplicates the Get not found but perhaps will speed up the delete - if cfg.RequireExists && !exists { - return nil, engine.ErrNotFound - } - - // Note really sure what this means for Delete but keeping for consistency - if cfg.RequireNotExists && exists { - return nil, engine.ErrAlreadyExists - } - } - - var data []byte - if data, err = tx.Get(key, cfg); err != nil { - if errors.Is(err, engine.ErrNotFound) { - return nil, err - } - return nil, err - } - - // Unmarshal the version information - obj := new(pb.Object) - if err = proto.Unmarshal(data, obj); err != nil { - return nil, err - } - - // Don't save the data back to disk - obj.Data = nil - - // Create a tombstone for the data - if err = db.vm.Delete(obj); err != nil { - return nil, err - } - - // Put the version back onto disk - if data, err = proto.Marshal(obj); err != nil { - return nil, err - } - - if err = tx.Put(key, data, cfg); err != nil { - return nil, err - } - return obj, nil -} - -// Iter over a subset of keys specified by the prefix. -// TODO: provide better mechanisms for iteration. -func (db *DB) Iter(prefix []byte, options ...opts.Option) (i iterator.Iterator, err error) { - // Collect the options - var cfg *opts.Options - if cfg, err = opts.New(options...); err != nil { - return nil, err - } - - // TODO: refactor this into an options slice for faster checking - iter, ok := db.engine.(engine.Iterator) - if !ok { - return nil, errors.New("underlying engine doesn't support Iter accesses") - } - return iter.Iter(prefix, cfg) -} - -// Returns the underlying DB engine for direct access. -func (db *DB) Engine() engine.Engine { - return db.engine -} diff --git a/db/honu_test.go b/db/honu_test.go deleted file mode 100644 index c260ad0..0000000 --- a/db/honu_test.go +++ /dev/null @@ -1,678 +0,0 @@ -package db_test - -import ( - "bytes" - "crypto/rand" - "fmt" - "os" - "testing" - - "github.com/rotationalio/honu/config" - . "github.com/rotationalio/honu/db" - engine "github.com/rotationalio/honu/db/engines" - "github.com/rotationalio/honu/db/engines/leveldb" - "github.com/rotationalio/honu/object/v1" - "github.com/rotationalio/honu/options" - "github.com/stretchr/testify/require" -) - -// a test set of key/value pairs used to evaluate iteration -// note because :: is the namespace separator in leveldb, we want to ensure that keys -// with colons are correctly iterated on. -var pairs = [][]string{ - {"aa", "first"}, - {"ab", "second"}, - {"b::a", "third"}, - {"b::b", "fourth"}, - {"b::c", "fifth"}, - {"ca", "sixth"}, - {"cb", "seventh"}, -} - -// Returns a constant list of namespace strings. -// TODO: Share with engines/leveldb/leveldb_test.go -var testNamespaces = []string{ - "", - "basic", - "namespace with spaces", - "namespace::with::colons", -} - -func setupHonuDB(t testing.TB) (db *DB, tmpDir string) { - // Create a new leveldb database in a temporary directory - tmpDir, err := os.MkdirTemp("", "honudb-*") - require.NoError(t, err) - - // Open a Honu leveldb database with default configuration - uri := fmt.Sprintf("leveldb:///%s", tmpDir) - db, err = Open(uri, config.WithReplica(config.ReplicaConfig{PID: 8, Region: "us-southwest-16", Name: "testing"})) - if err != nil && tmpDir != "" { - os.RemoveAll(tmpDir) - } - require.NoError(t, err) - - t.Cleanup(func() { - db.Close() - os.RemoveAll(tmpDir) - }) - - return db, tmpDir -} - -func TestLevelDBInteractions(t *testing.T) { - db, _ := setupHonuDB(t) - - totalKeys := 0 - for _, namespace := range testNamespaces { - // Use a constant key to ensure namespaces - // are working correctly. - key := []byte("foo") - //append a constant to namespace as the value - //because when the empty namespace is returned - //as a key it is serialized as []byte(nil) - //instead of []byte{} - expectedValue := []byte(namespace + "this is the value of foo") - - // Put a version to the database - obj, err := db.Put(key, expectedValue, options.WithNamespace(namespace)) - require.NoError(t, err) - require.False(t, obj.Tombstone()) - totalKeys++ - - // Get the version of foo from the database - value, err := db.Get(key, options.WithNamespace(namespace)) - require.NoError(t, err) - require.Equal(t, expectedValue, value) - - // Get the meta data from foo - obj, err = db.Object(key, options.WithNamespace(namespace)) - require.NoError(t, err) - require.Equal(t, uint64(1), obj.Version.Version) - require.False(t, obj.Tombstone()) - require.NotEmpty(t, obj.Created) - require.False(t, obj.Created.AsTime().IsZero()) - - // Delete the version from the database and ensure you - // are not able to get the deleted version - _, err = db.Delete(key, options.WithNamespace(namespace)) - require.NoError(t, err) - - value, err = db.Get(key, options.WithNamespace(namespace)) - require.Error(t, err) - require.Empty(t, value) - - // Get the tombstone from the database - obj, err = db.Object(key, options.WithNamespace(namespace)) - require.NoError(t, err) - require.Equal(t, uint64(2), obj.Version.Version) - require.True(t, obj.Tombstone()) - require.Empty(t, obj.Data) - - // Be able to "undelete" a tombstone - undeadValue := []byte("this is the undead foo") - obj, err = db.Put(key, undeadValue, options.WithNamespace(namespace)) - require.NoError(t, err) - require.False(t, obj.Tombstone()) - - // Get the metadata from the database (should no longer be a tombstone) - obj, err = db.Object(key, options.WithNamespace(namespace)) - require.NoError(t, err) - require.Equal(t, uint64(3), obj.Version.Version) - require.False(t, obj.Tombstone()) - - // Attempt to directly update the object in the database with a later version - obj.Data = []byte("directly updated") - obj.Owner = "me" - obj.Version.Parent = nil - obj.Version.Version = 42 - obj.Version.Pid = 93 - obj.Version.Region = "here" - obj.Version.Tombstone = false - _, err = db.Update(obj) - require.NoError(t, err) - - // Put a range of data into the database - for _, pair := range pairs { - key := []byte(pair[0]) - value := []byte(pair[1]) - _, err := db.Put(key, value, options.WithNamespace(namespace)) - require.NoError(t, err) - totalKeys++ - } - - // Iterate over a prefix in the database - iter, err := db.Iter([]byte("b"), options.WithNamespace(namespace)) - require.NoError(t, err) - collected := 0 - for iter.Next() { - key := iter.Key() - require.Equal(t, string(key), pairs[collected+2][0]) - - value := iter.Value() - require.Equal(t, string(value), string(pairs[collected+2][1])) - - obj, err := iter.Object() - require.NoError(t, err) - require.Equal(t, uint64(1), obj.Version.Version) - - collected++ - } - - require.Equal(t, 3, collected) - require.NoError(t, iter.Error()) - iter.Release() - } - - // Test iteration over all the namespaces - _, ok := db.Engine().(*leveldb.LevelDBEngine) - require.True(t, ok, "the engine type returned should be a leveldb.DB") - requireDatabaseLen(t, db, totalKeys) -} - -func TestExistenceInvariants(t *testing.T) { - keysExist := [][]byte{{0x00, 0x00, 0x00, 0xAB}, {0x00, 0x00, 0xEF, 0x99}, {0x63, 0xA1, 0x00, 0x01}, {0xAB, 0xCD, 0xEF, 0x99}} - keysMissing := [][]byte{{0x00, 0x00, 0x00, 0x00}, {0x10, 0x20, 0x30, 0x40}, {0x64, 0xA2, 0x01, 0x02}, {0x99, 0xFE, 0xDC, 0xBA}} - - createFixtures := func(t *testing.T, db *DB) { - for _, namespace := range testNamespaces { - for _, key := range keysExist { - _, err := db.Put(key, randomData(128), options.WithNamespace(namespace)) - require.NoError(t, err, "could not create key fixtures in database") - } - } - } - - t.Run("PutRequireExists", func(t *testing.T) { - // Setup the database - db, _ := setupHonuDB(t) - requireDatabaseLen(t, db, 0) - createFixtures(t, db) - - for _, namespace := range testNamespaces { - for _, key := range keysExist { - obj, err := db.Put(key, randomData(256), options.WithNamespace(namespace), options.WithRequireExists()) - require.NoError(t, err, "expected no error since key exists") - require.Equal(t, uint64(2), obj.Version.Version) - } - - for _, key := range keysMissing { - obj, err := db.Put(key, randomData(256), options.WithNamespace(namespace), options.WithRequireExists()) - require.ErrorIs(t, err, engine.ErrNotFound, "expected not found error when key was missing") - require.Nil(t, obj, "expected no object returned from error call") - } - } - }) - - t.Run("PutRequireNotExists", func(t *testing.T) { - // Setup the database - db, _ := setupHonuDB(t) - requireDatabaseLen(t, db, 0) - createFixtures(t, db) - - for _, namespace := range testNamespaces { - for _, key := range keysMissing { - obj, err := db.Put(key, randomData(256), options.WithNamespace(namespace), options.WithRequireNotExists()) - require.NoError(t, err, "expected no error since key is missing") - require.Equal(t, uint64(1), obj.Version.Version) - } - - for _, key := range keysExist { - obj, err := db.Put(key, randomData(256), options.WithNamespace(namespace), options.WithRequireNotExists()) - require.ErrorIs(t, err, engine.ErrAlreadyExists, "expected already exists error when key exists") - require.Nil(t, obj, "expected no object returned from error call") - } - } - }) - - t.Run("DeleteRequireExists", func(t *testing.T) { - // Setup the database - db, _ := setupHonuDB(t) - requireDatabaseLen(t, db, 0) - createFixtures(t, db) - - for _, namespace := range testNamespaces { - for _, key := range keysExist { - obj, err := db.Delete(key, options.WithNamespace(namespace), options.WithRequireExists()) - require.NoError(t, err, "expected no error since key exists") - require.True(t, obj.Tombstone()) - } - - for _, key := range keysMissing { - obj, err := db.Delete(key, options.WithNamespace(namespace), options.WithRequireExists()) - require.ErrorIs(t, err, engine.ErrNotFound, "expected not found error when key was missing") - require.Nil(t, obj, "expected no object returned from error call") - } - } - }) - - t.Run("DeleteRequireNotExists", func(t *testing.T) { - // Setup the database - db, _ := setupHonuDB(t) - requireDatabaseLen(t, db, 0) - createFixtures(t, db) - - for _, namespace := range testNamespaces { - for _, key := range keysMissing { - obj, err := db.Delete(key, options.WithNamespace(namespace), options.WithRequireNotExists()) - require.ErrorIs(t, err, engine.ErrNotFound, "expected not found error since key is missing") - require.Nil(t, obj, "expeced no object since key is missing") - } - - for _, key := range keysExist { - obj, err := db.Delete(key, options.WithNamespace(namespace), options.WithRequireNotExists()) - require.ErrorIs(t, err, engine.ErrAlreadyExists, "expected already exists error when key exists") - require.Nil(t, obj, "expected no object returned from error call") - } - } - }) - -} - -func TestUpdate(t *testing.T) { - // Create a test database to attempt to update - db, _ := setupHonuDB(t) - - // Create a random object in the database to start update tests on - key := randomData(32) - namespace := "yeti" - root, err := db.Put(key, randomData(96), options.WithNamespace(namespace)) - require.NoError(t, err, "could not put random data") - - // Generate new1 - a linear object from root as though it were from a different replica - new1 := &object.Object{ - Key: key, - Namespace: namespace, - Version: &object.Version{ - Pid: 113, - Version: 2, - Parent: root.Version, - }, - Region: "the-void", - Owner: root.Owner, - Data: randomData(112), - } - - // Should be able to update with no namespace option - update, err := db.Update(new1) - require.NoError(t, err, "could not update db with new1") - require.Equal(t, UpdateLinear, update, "expected new1 update to be linear") - requireObjectEqual(t, db, new1, key, namespace) - - // Should not be be able to update with the same version twice, since it is now no - // longer later than previous version (it is the equal version on disk). - update, err = db.Update(new1) - require.EqualError(t, err, "cannot update object, it is not a later version then the current object") - require.Equal(t, UpdateNoChange, update) - - // Should be able to force the update to apply the same object back to disk. - update, err = db.Update(new1, options.WithForce()) - require.NoError(t, err, "could not force update with new1") - require.Equal(t, UpdateForced, update) - - // Generate new2 - an object stomping new1 as though it were from a different replica - new2 := &object.Object{ - Key: key, - Namespace: namespace, - Version: &object.Version{ - Pid: 42, - Version: 2, - Parent: root.Version, - }, - Region: "the-other-void", - Owner: root.Owner, - Data: randomData(112), - } - - // Update with the wrong namespace should error - update, err = db.Update(new2, options.WithNamespace("this is not the right namespace for sure")) - require.EqualError(t, err, "options namespace does not match object namespace") - require.Equal(t, UpdateNoChange, update) - requireObjectEqual(t, db, new1, key, namespace) - - // Update with the wrong namespace but with force should not error and create a new object - // NOTE: this is kind of a wild force since now the object has the wrong namespace metadata. - update, err = db.Update(new2, options.WithNamespace("trashcan"), options.WithForce()) - require.NoError(t, err) - require.Equal(t, UpdateForced, update) - requireObjectEqual(t, db, new1, key, namespace) - requireObjectEqual(t, db, new2, key, "trashcan") - - // Update with same namespace option should not error. - update, err = db.Update(new2, options.WithNamespace(namespace)) - require.NoError(t, err, "could not update new2") - require.Equal(t, UpdateStomp, update) - requireObjectEqual(t, db, new2, key, namespace) - - // Generate new3 - an object skipping new2 as though it were from the same replica - new3 := &object.Object{ - Key: key, - Namespace: namespace, - Version: &object.Version{ - Pid: 42, - Version: 12, - Parent: root.Version, - }, - Region: "the-other-void", - Owner: root.Owner, - Data: randomData(112), - } - - // Ensure UpdateSkip is returned - update, err = db.Update(new3) - require.NoError(t, err, "could not update new3") - require.Equal(t, UpdateSkip, update) - requireObjectEqual(t, db, new3, key, namespace) - - // Update with an earlier version should error - update, err = db.Update(new1) - require.EqualError(t, err, "cannot update object, it is not a later version then the current object") - require.Equal(t, UpdateNoChange, update) - requireObjectEqual(t, db, new3, key, namespace) - - // Should be able to force the update to apply the earlier object back to disk - update, err = db.Update(new1, options.WithForce()) - require.NoError(t, err, "could not force update with new1") - require.Equal(t, UpdateForced, update) - requireObjectEqual(t, db, new1, key, namespace) - - // Update an object that does not exist should not error. - stranger := &object.Object{ - Key: randomData(18), - Namespace: "default", - Version: &object.Version{ - Pid: 1, - Version: 1, - Parent: nil, - }, - Region: "the-void", - Owner: "me", - Data: randomData(8), - } - - update, err = db.Update(stranger) - require.NoError(t, err) - require.Equal(t, UpdateLinear, update) -} - -func TestTombstones(t *testing.T) { - // Create a test database - db, _ := setupHonuDB(t) - - // Assert that there is nothing in the namespace as an initial check - requireNamespaceLen(t, db, "graveyard", 0) - requireDatabaseLen(t, db, 0) - - // Create a list of keys with integer values - keys := make([][]byte, 0, 20) - for i := 0; i < 20; i++ { - key := []byte(fmt.Sprintf("%04d", i)) - keys = append(keys, key) - } - - // Add data to the database - for _, key := range keys { - db.Put(key, randomData(256), options.WithNamespace("graveyard")) - } - requireNamespaceLen(t, db, "graveyard", 20) - requireDatabaseLen(t, db, 20) - - // Delete all even keys - for i, key := range keys { - if i%2 == 0 { - db.Delete(key, options.WithNamespace("graveyard")) - } - } - - // Ensure that the iterator returns 10 items but that there are still 20 objects - // including tombstones still stored in the database. - requireNamespaceLen(t, db, "graveyard", 10) - requireGraveyardLen(t, db, "graveyard", 20) - requireDatabaseLen(t, db, 20) - - // Sanity check, attempt to get Get all keys and verify tombstones - for i, key := range keys { - if i%2 == 0 { - // This is a tombstone - val, err := db.Get(key, options.WithNamespace("graveyard")) - require.EqualError(t, err, "not found", "tombstone did not return a not found error") - require.Nil(t, val, "tombstone returned a non nil value") - - obj, err := db.Object(key, options.WithNamespace("graveyard")) - require.NoError(t, err, "tombstone did not return an object") - require.True(t, obj.Tombstone()) - } else { - // Not a tombstone - val, err := db.Get(key, options.WithNamespace("graveyard")) - require.NoError(t, err, "a live object returned error on get") - require.Len(t, val, 256) - - obj, err := db.Object(key, options.WithNamespace("graveyard")) - require.NoError(t, err, "live object did not return an object") - require.False(t, obj.Tombstone()) - } - } - - // "Resurrect" every 4th tombstone and give it a new value - for i, key := range keys { - if i%4 == 0 { - db.Put(key, randomData(192), options.WithNamespace("graveyard")) - } - } - - // Ensure that the iterator returns 15 items but that there are still 20 objects - // including tombstones still stored in the database. - requireNamespaceLen(t, db, "graveyard", 15) - requireGraveyardLen(t, db, "graveyard", 20) - requireDatabaseLen(t, db, 20) - - // Sanity check, attempt to get Get all keys and verify tombstones and undead keys - for i, key := range keys { - if i%2 == 0 { - if i%4 == 0 { - // This is an undead version - val, err := db.Get(key, options.WithNamespace("graveyard")) - require.NoError(t, err, "undead object returned error on get") - require.Len(t, val, 192) - - obj, err := db.Object(key, options.WithNamespace("graveyard")) - require.NoError(t, err, "undead object did not return an object") - require.False(t, obj.Tombstone()) - } else { - // This is a tombstone - val, err := db.Get(key, options.WithNamespace("graveyard")) - require.EqualError(t, err, "not found", "tombstone did not return a not found error") - require.Nil(t, val, "tombstone returned a non nil value") - - obj, err := db.Object(key, options.WithNamespace("graveyard")) - require.NoError(t, err, "tombstone did not return an object") - require.True(t, obj.Tombstone()) - } - } else { - // Not a tombstone - val, err := db.Get(key, options.WithNamespace("graveyard")) - require.NoError(t, err, "a live object returned error on get") - require.Len(t, val, 256) - - obj, err := db.Object(key, options.WithNamespace("graveyard")) - require.NoError(t, err, "live object did not return an object") - require.False(t, obj.Tombstone()) - } - } - - // Test Seek, Next, and Prev with and without Tombstones - iter, err := db.Iter(nil, options.WithNamespace("graveyard")) - require.NoError(t, err, "could not create honu iterator") - - itert, err := db.Iter(nil, options.WithNamespace("graveyard"), options.WithTombstones()) - require.NoError(t, err, "could not create honu tombstone iterator") - - // Seek to a non-tombstone key - require.True(t, iter.Seek(keys[9]), "could not seek to a non-tombstone key") - require.True(t, itert.Seek(keys[9]), "could not seek to a non-tombstone key with tombstone iterator") - require.True(t, bytes.Equal(iter.Key(), keys[9]), "unexpected key at iter cursor") - require.True(t, bytes.Equal(itert.Key(), keys[9]), "unexpected key at iter cursor with tombstone iterator") - - // Seek to a tombstone key (move to 15 and 14 respectively) - require.True(t, iter.Seek(keys[14]), "could not seek to a tombstone key") - require.True(t, itert.Seek(keys[14]), "could not seek to a tombstone key with tombstone iterator") - require.True(t, bytes.Equal(iter.Key(), keys[15]), "unexpected key at iter cursor") - require.True(t, bytes.Equal(itert.Key(), keys[14]), "unexpected key at iter cursor with tombstone iterator") - - // Prev should move us to keys[13] for both two iterators - require.True(t, iter.Prev(), "could not prev to a non-tombstone key") - require.True(t, itert.Prev(), "could not prev to a non-tombstone key with tombstone iterator") - require.True(t, bytes.Equal(iter.Key(), keys[13]), "unexpected key at iter cursor") - require.True(t, bytes.Equal(itert.Key(), keys[13]), "unexpected key at iter cursor with tombstone iterator") - - // Next should move us back to 15 and 14 respectively - require.True(t, iter.Next(), "could not next to a non-tombstone key") - require.True(t, itert.Next(), "could not next to a tombstone key with tombstone iterator") - require.True(t, bytes.Equal(iter.Key(), keys[15]), "unexpected key at iter cursor") - require.True(t, bytes.Equal(itert.Key(), keys[14]), "unexpected key at iter cursor with tombstone iterator") -} - -func TestTombstonesMultipleNamespaces(t *testing.T) { - // Create a test database - db, _ := setupHonuDB(t) - namespaces := []string{"graveyard", "cemetery", "catacombs"} - - // Assert that there is nothing in the namespaces as an initial check - for _, ns := range namespaces { - requireNamespaceLen(t, db, ns, 0) - } - requireDatabaseLen(t, db, 0) - - // Create a list of keys with integer values - keys := make([][]byte, 0, 100) - for i := 0; i < 100; i++ { - key := []byte(fmt.Sprintf("%04d", i)) - keys = append(keys, key) - } - - // Add data to the database - for _, key := range keys { - for _, ns := range namespaces { - db.Put(key, randomData(256), options.WithNamespace(ns)) - } - } - - for _, ns := range namespaces { - requireNamespaceLen(t, db, ns, 100) - } - requireDatabaseLen(t, db, 300) - - // Delete all even keys - for i, key := range keys { - if i%2 == 0 { - for _, ns := range namespaces { - db.Delete(key, options.WithNamespace(ns)) - } - } - } - - // Ensure that the iterator returns 50 items but that there are still 100 objects - // including tombstones still stored in the database. Also ensure that the entire - // database still contains 300 objects. - for _, ns := range namespaces { - requireNamespaceLen(t, db, ns, 50) - requireGraveyardLen(t, db, ns, 100) - } - requireDatabaseLen(t, db, 300) - - // "Resurrect" every 4th tombstone and give it a new value - for i, key := range keys { - if i%4 == 0 { - for _, ns := range namespaces { - db.Put(key, randomData(192), options.WithNamespace(ns)) - } - } - } - - // Ensure that the iterator returns 75 items but that there are still 100 objects - // including tombstones still stored in the database. Also ensure that the entire - // database still contains 300 objects. - for _, ns := range namespaces { - requireNamespaceLen(t, db, ns, 75) - requireGraveyardLen(t, db, ns, 100) - } - requireDatabaseLen(t, db, 300) -} - -// Helper assertion function to check to make sure an object matches what is in the database -func requireObjectEqual(t *testing.T, db *DB, expected *object.Object, key []byte, namespace string) { - actual, err := db.Object(key, options.WithNamespace(namespace)) - require.NoError(t, err, "could not fetch expected object from the database") - - // NOTE: we cannot do a require.Equal(t, expected, actual) because the test will hang - // it's not clear if there is a recursive loop with version comparisons or some other - // deep equality is causing the problem. Instead we directly compare the data. - require.True(t, bytes.Equal(expected.Key, actual.Key), "key is not equal") - require.Equal(t, expected.Namespace, actual.Namespace, "namespace not equal") - require.Equal(t, expected.Region, actual.Region, "region not equal") - require.Equal(t, expected.Owner, actual.Owner, "owner not equal") - require.True(t, expected.Version.Equal(actual.Version), "versions not equal") - require.Equal(t, expected.Version.Region, actual.Version.Region, "version region not equal") - require.Equal(t, expected.Version.Tombstone, actual.Version.Tombstone, "version tombstone not the same") - if expected.Version.Parent != nil { - require.True(t, expected.Version.Parent.Equal(actual.Version.Parent), "parents not equal") - require.Equal(t, expected.Version.Parent.Region, actual.Version.Parent.Region, "parent regions not equal") - require.Equal(t, expected.Version.Parent.Tombstone, actual.Version.Parent.Tombstone, "parent tombstone not the same") - } else { - require.Nil(t, actual.Version.Parent, "expected parent is nil") - } - require.True(t, bytes.Equal(expected.Data, actual.Data), "value is not equal") -} - -func requireNamespaceLen(t *testing.T, db *DB, namespace string, expected int) { - iter, err := db.Iter(nil, options.WithNamespace(namespace)) - require.NoError(t, err) - - actual := 0 - for iter.Next() { - actual++ - } - - require.NoError(t, iter.Error()) - iter.Release() - require.Equal(t, expected, actual) -} - -func requireGraveyardLen(t *testing.T, db *DB, namespace string, expected int) { - iter, err := db.Iter(nil, options.WithNamespace(namespace), options.WithTombstones()) - require.NoError(t, err) - - actual := 0 - for iter.Next() { - actual++ - } - - require.NoError(t, iter.Error()) - iter.Release() - require.Equal(t, expected, actual) -} - -func requireDatabaseLen(t *testing.T, db *DB, expected int) { - engine, ok := db.Engine().(*leveldb.LevelDBEngine) - require.True(t, ok, "database len requires a leveldb engine") - ldb := engine.DB() - - actual := 0 - iter := ldb.NewIterator(nil, nil) - for iter.Next() { - actual++ - } - - require.NoError(t, iter.Error(), "could not iterate using leveldb directly") - iter.Release() - - require.Equal(t, expected, actual, "database key count does not match") -} - -// Helper function to generate random data -func randomData(len int) []byte { - data := make([]byte, len) - if _, err := rand.Read(data); err != nil { - panic(err) - } - return data -} diff --git a/doc.go b/doc.go deleted file mode 100644 index ca11150..0000000 --- a/doc.go +++ /dev/null @@ -1,38 +0,0 @@ -// BSD 3-Clause License - -// Copyright (c) 2021, Rotational Labs, Inc. -// All rights reserved. - -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: - -// 1. Redistributions of source code must retain the above copyright notice, this -// list of conditions and the following disclaimer. - -// 2. Redistributions in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. - -// 3. Neither the name of the copyright holder nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. - -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -/* -Package honu is a replicated key-value store intended for large systems that are -distributed globally. Although HonuDB uses an eventually consistent gossip protocol for -replication, it uses reinforcement learning with multi-armed bandits to optimize -replication. Adaptive consistency reduces costs (ingress and egress data transfer) as -well as improves consistency by lowering the likelihood of stale reads or forked writes. -*/ -package honu diff --git a/docs/benchmark.png b/docs/benchmark.png deleted file mode 100644 index dd9da92..0000000 Binary files a/docs/benchmark.png and /dev/null differ diff --git a/go.mod b/go.mod index c1e13d8..38495f3 100644 --- a/go.mod +++ b/go.mod @@ -1,51 +1,23 @@ module github.com/rotationalio/honu -go 1.21 +go 1.23.2 require ( - github.com/cockroachdb/pebble v1.1.1 github.com/joho/godotenv v1.5.1 + github.com/rotationalio/confire v1.1.0 + github.com/rs/zerolog v1.33.0 github.com/stretchr/testify v1.9.0 - github.com/syndtr/goleveldb v1.0.0 - github.com/urfave/cli/v2 v2.27.2 - google.golang.org/grpc v1.64.0 - google.golang.org/protobuf v1.34.2 + github.com/urfave/cli/v2 v2.27.5 ) require ( - github.com/DataDog/zstd v1.5.5 // indirect - github.com/beorn7/perks v1.0.1 // indirect - github.com/cespare/xxhash/v2 v2.3.0 // indirect - github.com/cockroachdb/errors v1.11.3 // indirect - github.com/cockroachdb/fifo v0.0.0-20240616162244-4768e80dfb9a // indirect - github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b // indirect - github.com/cockroachdb/redact v1.1.5 // indirect - github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 // indirect - github.com/cpuguy83/go-md2man/v2 v2.0.4 // indirect + github.com/cpuguy83/go-md2man/v2 v2.0.5 // indirect github.com/davecgh/go-spew v1.1.1 // indirect - github.com/getsentry/sentry-go v0.28.1 // indirect - github.com/gogo/protobuf v1.3.2 // indirect - github.com/golang/protobuf v1.5.4 // indirect - github.com/golang/snappy v0.0.4 // indirect - github.com/klauspost/compress v1.17.9 // indirect - github.com/kr/pretty v0.3.1 // indirect - github.com/kr/text v0.2.0 // indirect - github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect - github.com/onsi/ginkgo v1.13.0 // indirect - github.com/onsi/gomega v1.10.1 // indirect - github.com/pkg/errors v0.9.1 // indirect + github.com/mattn/go-colorable v0.1.13 // indirect + github.com/mattn/go-isatty v0.0.19 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - github.com/prometheus/client_golang v1.19.1 // indirect - github.com/prometheus/client_model v0.6.1 // indirect - github.com/prometheus/common v0.54.0 // indirect - github.com/prometheus/procfs v0.15.1 // indirect - github.com/rogpeppe/go-internal v1.12.0 // indirect github.com/russross/blackfriday/v2 v2.1.0 // indirect github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1 // indirect - golang.org/x/exp v0.0.0-20240613232115-7f521ea00fb8 // indirect - golang.org/x/net v0.26.0 // indirect - golang.org/x/sys v0.21.0 // indirect - golang.org/x/text v0.16.0 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240617180043-68d350f18fd4 // indirect + golang.org/x/sys v0.12.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index e7740b2..89158c5 100644 --- a/go.sum +++ b/go.sum @@ -1,227 +1,37 @@ -github.com/DataDog/zstd v1.5.5 h1:oWf5W7GtOLgp6bciQYDmhHHjdhYkALu6S/5Ni9ZgSvQ= -github.com/DataDog/zstd v1.5.5/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwSAmyw= -github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= -github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= -github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= -github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= -github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/cockroachdb/datadriven v1.0.3-0.20230413201302-be42291fc80f h1:otljaYPt5hWxV3MUfO5dFPFiOXg9CyG5/kCfayTqsJ4= -github.com/cockroachdb/datadriven v1.0.3-0.20230413201302-be42291fc80f/go.mod h1:a9RdTaap04u637JoCzcUoIcDmvwSUtcUFtT/C3kJlTU= -github.com/cockroachdb/errors v1.11.1 h1:xSEW75zKaKCWzR3OfxXUxgrk/NtT4G1MiOv5lWZazG8= -github.com/cockroachdb/errors v1.11.1/go.mod h1:8MUxA3Gi6b25tYlFEBGLf+D8aISL+M4MIpiWMSNRfxw= -github.com/cockroachdb/errors v1.11.3 h1:5bA+k2Y6r+oz/6Z/RFlNeVCesGARKuC6YymtcDrbC/I= -github.com/cockroachdb/errors v1.11.3/go.mod h1:m4UIW4CDjx+R5cybPsNrRbreomiFqt8o1h1wUVazSd8= -github.com/cockroachdb/fifo v0.0.0-20240616162244-4768e80dfb9a h1:f52TdbU4D5nozMAhO9TvTJ2ZMCXtN4VIAmfrrZ0JXQ4= -github.com/cockroachdb/fifo v0.0.0-20240616162244-4768e80dfb9a/go.mod h1:9/y3cnZ5GKakj/H4y9r9GTjCvAFta7KLgSHPJJYc52M= -github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b h1:r6VH0faHjZeQy818SGhaone5OnYfxFR/+AzdY3sf5aE= -github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b/go.mod h1:Vz9DsVWQQhf3vs21MhPMZpMGSht7O/2vFW2xusFUVOs= -github.com/cockroachdb/pebble v0.0.0-20230928194634-aa077af62593 h1:aPEJyR4rPBvDmeyi+l/FS/VtA00IWvjeFvjen1m1l1A= -github.com/cockroachdb/pebble v0.0.0-20230928194634-aa077af62593/go.mod h1:6hk1eMY/u5t+Cf18q5lFMUA1Rc+Sm5I6Ra1QuPyxXCo= -github.com/cockroachdb/pebble v1.1.1 h1:XnKU22oiCLy2Xn8vp1re67cXg4SAasg/WDt1NtcRFaw= -github.com/cockroachdb/pebble v1.1.1/go.mod h1:4exszw1r40423ZsmkG/09AFEG83I0uDgfujJdbL6kYU= -github.com/cockroachdb/redact v1.1.5 h1:u1PMllDkdFfPWaNGMyLD1+so+aq3uUItthCFqzwPJ30= -github.com/cockroachdb/redact v1.1.5/go.mod h1:BVNblN9mBWFyMyqK1k3AAiSxhvhfK2oOZZ2lK+dpvRg= -github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 h1:zuQyyAKVxetITBuuhv3BI9cMrmStnpT18zmgmTxunpo= -github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06/go.mod h1:7nc4anLGjupUW/PeY5qiNYsdNXj7zopG+eqsS7To5IQ= -github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w= -github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= -github.com/cpuguy83/go-md2man/v2 v2.0.4 h1:wfIWP927BUkWJb2NmU/kNDYIBTh/ziUX91+lVfRxZq4= -github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= -github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= +github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= +github.com/cpuguy83/go-md2man/v2 v2.0.5 h1:ZtcqGrnekaHpVLArFSe4HK5DoKx1T0rq2DwVB0alcyc= +github.com/cpuguy83/go-md2man/v2 v2.0.5/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= -github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4= -github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= -github.com/getsentry/sentry-go v0.24.1 h1:W6/0GyTy8J6ge6lVCc94WB6Gx2ZuLrgopnn9w8Hiwuk= -github.com/getsentry/sentry-go v0.24.1/go.mod h1:lc76E2QywIyW8WuBnwl8Lc4bkmQH4+w1gwTf25trprY= -github.com/getsentry/sentry-go v0.28.1 h1:zzaSm/vHmGllRM6Tpx1492r0YDzauArdBfkJRtY6P5k= -github.com/getsentry/sentry-go v0.28.1/go.mod h1:1fQZ+7l7eeJ3wYi82q5Hg8GqAPgefRq+FP/QhafYVgg= -github.com/go-errors/errors v1.4.2 h1:J6MZopCL4uSllY1OfXM374weqZFFItUbrImctkmUxIA= -github.com/go-errors/errors v1.4.2/go.mod h1:sIVyrIiJhuEF+Pj9Ebtd6P/rEYROXFi3BopGUQ5a5Og= -github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= -github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= -github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= -github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= -github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= -github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= -github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= -github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= -github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= -github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= -github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= -github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= -github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= +github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/joho/godotenv v1.5.1 h1:7eLL/+HRGLY0ldzfGMeQkb7vMd0as4CfYvUVzLqw0N0= github.com/joho/godotenv v1.5.1/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4= -github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= -github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/klauspost/compress v1.17.0 h1:Rnbp4K9EjcDuVuHtd0dgA4qNuv9yKDYKK1ulpJwgrqM= -github.com/klauspost/compress v1.17.0/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE= -github.com/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA= -github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= -github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= -github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= -github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo= -github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= -github.com/nxadm/tail v1.4.4 h1:DQuhQpB1tVlglWS2hLQ5OV6B5r8aGxSrPc5Qo6uTN78= -github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= -github.com/nxadm/tail v1.4.11 h1:8feyoE3OzPrcshW5/MJ4sGESc5cqmGkGCWlco4l0bqY= -github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= -github.com/onsi/ginkgo v1.13.0 h1:M76yO2HkZASFjXL0HSoZJ1AYEmQxNJmY41Jx1zNUq1Y= -github.com/onsi/ginkgo v1.13.0/go.mod h1:+REjRxOmWfHCjfv9TTWB1jD1Frx4XydAD3zm1lskyM0= -github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= -github.com/onsi/gomega v1.10.1 h1:o0+MgICZLuZ7xjH7Vx6zS/zcu93/BEp1VwkIW1mEXCE= -github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= -github.com/pingcap/errors v0.11.4 h1:lFuQV/oaUMGcD2tqt+01ROSmJs75VG1ToEOkZIZ4nE4= -github.com/pingcap/errors v0.11.4/go.mod h1:Oi8TUi2kEtXXLMJk9l1cGmz20kV3TaQ0usTwv5KuLY8= -github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= -github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= +github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= +github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= +github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= +github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA= +github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/prometheus/client_golang v1.17.0 h1:rl2sfwZMtSthVU752MqfjQozy7blglC+1SOtjMAMh+Q= -github.com/prometheus/client_golang v1.17.0/go.mod h1:VeL+gMmOAxkS2IqfCq0ZmHSL+LjWfWDUmp1mBz9JgUY= -github.com/prometheus/client_golang v1.19.1 h1:wZWJDwK+NameRJuPGDhlnFgx8e8HN3XHQeLaYJFJBOE= -github.com/prometheus/client_golang v1.19.1/go.mod h1:mP78NwGzrVks5S2H6ab8+ZZGJLZUq1hoULYBAYBw1Ho= -github.com/prometheus/client_model v0.4.1-0.20230718164431-9a2bf3000d16 h1:v7DLqVdK4VrYkVD5diGdl4sxJurKJEMnODWRJlxV9oM= -github.com/prometheus/client_model v0.4.1-0.20230718164431-9a2bf3000d16/go.mod h1:oMQmHW1/JoDwqLtg57MGgP/Fb1CJEYF2imWWhWtMkYU= -github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p8ais2e9E= -github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY= -github.com/prometheus/common v0.44.0 h1:+5BrQJwiBB9xsMygAB3TNvpQKOwlkc25LbISbrdOOfY= -github.com/prometheus/common v0.44.0/go.mod h1:ofAIvZbQ1e/nugmZGz4/qCb9Ap1VoSTIO7x0VV9VvuY= -github.com/prometheus/common v0.54.0 h1:ZlZy0BgJhTwVZUn7dLOkwCZHUkrAqd3WYtcFCWnM1D8= -github.com/prometheus/common v0.54.0/go.mod h1:/TQgMJP5CuVYveyT7n/0Ix8yLNNXy9yRSkhnLTHPDIQ= -github.com/prometheus/procfs v0.12.0 h1:jluTpSng7V9hY0O2R9DzzJHYb2xULk9VTR1V1R/k6Bo= -github.com/prometheus/procfs v0.12.0/go.mod h1:pcuDEFsWDnvcgNzo4EEweacyhjeA9Zk3cnaOZAZEfOo= -github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0learggepc= -github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk= -github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= -github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M= -github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA= -github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= -github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4= +github.com/rotationalio/confire v1.1.0 h1:h10RDxiO/XH6UStfxY+oMJOVxt3Elqociilb7fIfANs= +github.com/rotationalio/confire v1.1.0/go.mod h1:ug7pBDiZZl/4JjXJ2Effmj+L+0T2DBbG+Us1qQcRex0= +github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= +github.com/rs/zerolog v1.33.0 h1:1cU2KZkvPxNyfgEmhHAz/1A9Bz+llsdYzklWFzgp0r8= +github.com/rs/zerolog v1.33.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss= github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/sclevine/agouti v3.0.0+incompatible/go.mod h1:b4WX9W9L1sfQKXeJf1mUTLZKJ48R1S7H23Ji7oFO5Bw= -github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= -github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= -github.com/syndtr/goleveldb v1.0.0 h1:fBdIW9lB4Iz0n9khmH8w27SJ3QEJ7+IgjPEwGSZiFdE= -github.com/syndtr/goleveldb v1.0.0/go.mod h1:ZVVdQEZoIme9iO1Ch2Jdy24qqXrMMOU6lpPAyBWyWuQ= -github.com/urfave/cli/v2 v2.25.7 h1:VAzn5oq403l5pHjc4OhD54+XGO9cdKVL/7lDjF+iKUs= -github.com/urfave/cli/v2 v2.25.7/go.mod h1:8qnjx1vcq5s2/wpsqoZFndg2CE5tNFyrTvS6SinrnYQ= -github.com/urfave/cli/v2 v2.27.2 h1:6e0H+AkS+zDckwPCUrZkKX38mRaau4nL2uipkJpbkcI= -github.com/urfave/cli/v2 v2.27.2/go.mod h1:g0+79LmHHATl7DAcHO99smiR/T7uGLw84w8Y42x+4eM= -github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 h1:bAn7/zixMGCfxrRTfdpNzjtPYqr8smhKouy9mxVdGPU= -github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673/go.mod h1:N3UwUGtsrSj3ccvlPHLoLsHnpR27oXr4ZE984MbSER8= +github.com/urfave/cli/v2 v2.27.5 h1:WoHEJLdsXr6dDWoJgMq/CboDmyY/8HMMH1fTECbih+w= +github.com/urfave/cli/v2 v2.27.5/go.mod h1:3Sevf16NykTbInEnD0yKkjDAeZDS0A6bzhBH5hrMvTQ= github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1 h1:gEOO8jv9F4OT7lGCjxCBTO/36wtF6j2nSip77qHd4x4= github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1/go.mod h1:Ohn+xnUBiLI6FVj/9LpzZWtj1/D6lUovWYBkxHVV3aM= -github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/exp v0.0.0-20230905200255-921286631fa9 h1:GoHiUyI/Tp2nVkLI2mCxVkOjsbSXD66ic0XW0js0R9g= -golang.org/x/exp v0.0.0-20230905200255-921286631fa9/go.mod h1:S2oDrQGGwySpoQPVqRShND87VCbxmc6bL1Yd2oYrm6k= -golang.org/x/exp v0.0.0-20240613232115-7f521ea00fb8 h1:yixxcjnhBmY0nkL253HFVIm0JsFHwrHdT3Yh6szTnfY= -golang.org/x/exp v0.0.0-20240613232115-7f521ea00fb8/go.mod h1:jj3sYF3dwk5D+ghuXyeI3r5MFf+NT2An6/9dOA95KSI= -golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.15.0 h1:ugBLEUaxABaB5AJqW9enI0ACdci2RUd4eP51NTBvuJ8= -golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk= -golang.org/x/net v0.26.0 h1:soB7SVo0PWrY4vPW/+ay0jKDNScG2X9wFeYlXIvJsOQ= -golang.org/x/net v0.26.0/go.mod h1:5YKkiSynbBIh3p6iOc/vibscux0x38BZDkn8sCUPxHE= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E= -golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= -golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o= golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.21.0 h1:rF+pYz3DAGSQAxAu1CbC7catZg4ebC4UIeIhKxBZvws= -golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= -golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= -golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= -golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4= -golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230920204549-e6e6cdab5c13 h1:N3bU/SQDCDyD6R528GJ/PwW9KjYcJA3dgyH+MovAkIM= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230920204549-e6e6cdab5c13/go.mod h1:KSqppvjFjtoCI+KGd4PELB0qLNxdJHRGqRI09mB6pQA= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240617180043-68d350f18fd4 h1:Di6ANFilr+S60a4S61ZM00vLdw0IrQOSMS2/6mrnOU0= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240617180043-68d350f18fd4/go.mod h1:Ue6ibwXGpU+dqIcODieyLOcgj7z8+IcskoNIgZxtrFY= -google.golang.org/grpc v1.58.2 h1:SXUpjxeVF3FKrTYQI4f4KvbGD5u2xccdYdurwowix5I= -google.golang.org/grpc v1.58.2/go.mod h1:tgX3ZQDlNJGU96V6yHh1T/JeoBQ2TXdr43YbYSsCJk0= -google.golang.org/grpc v1.64.0 h1:KH3VH9y/MgNQg1dE7b3XfVK0GsPSIzJwdF617gUSbvY= -google.golang.org/grpc v1.64.0/go.mod h1:oxjF8E3FBnjp+/gVFYdWacaLDx9na1aqy9oovLpxQYg= -google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= -google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= -google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= -google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= -google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= -google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= -google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= -google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= -google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= -gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= -gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= -gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= -gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= -gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/iterator/empty.go b/iterator/empty.go deleted file mode 100644 index 684e781..0000000 --- a/iterator/empty.go +++ /dev/null @@ -1,39 +0,0 @@ -package iterator - -import ( - pb "github.com/rotationalio/honu/object/v1" - "github.com/rotationalio/honu/options" -) - -// NewEmptyIterator creates an empty iterator that returns nothing. The err parameter -// can be nil, but if not nil the given err will be returned by the Error method. -func NewEmptyIterator(err error, namespace string) Iterator { - if namespace == "" { - namespace = options.NamespaceDefault - } - return &emptyIterator{err: err, namespace: namespace} -} - -type emptyIterator struct { - released bool - err error - namespace string -} - -var _ Iterator = &emptyIterator{} - -func (i *emptyIterator) rErr() { - if i.err == nil && i.released { - i.err = ErrIterReleased - } -} - -func (i *emptyIterator) Next() bool { i.rErr(); return false } -func (i *emptyIterator) Prev() bool { i.rErr(); return false } -func (i *emptyIterator) Seek(key []byte) bool { i.rErr(); return false } -func (*emptyIterator) Key() []byte { return nil } -func (*emptyIterator) Value() []byte { return nil } -func (*emptyIterator) Object() (*pb.Object, error) { return nil, nil } -func (i *emptyIterator) Error() error { return i.err } -func (i *emptyIterator) Release() { i.released = true } -func (i *emptyIterator) Namespace() string { return i.namespace } diff --git a/iterator/empty_test.go b/iterator/empty_test.go deleted file mode 100644 index a4d9249..0000000 --- a/iterator/empty_test.go +++ /dev/null @@ -1,60 +0,0 @@ -package iterator_test - -import ( - "errors" - "testing" - - . "github.com/rotationalio/honu/iterator" - "github.com/rotationalio/honu/options" - "github.com/stretchr/testify/require" -) - -func TestEmptyIterator(t *testing.T) { - // Check that the empty iterator returns expected values - iter := NewEmptyIterator(nil, "") - require.False(t, iter.Next()) - require.False(t, iter.Prev()) - require.False(t, iter.Seek([]byte("foo"))) - require.Nil(t, iter.Key()) - require.Nil(t, iter.Value()) - require.NoError(t, iter.Error()) - require.Equal(t, options.NamespaceDefault, iter.Namespace()) - - obj, err := iter.Object() - require.NoError(t, err) - require.Nil(t, obj) - - // After calling release the empty iterator should still have no error - iter.Release() - require.NoError(t, iter.Error()) - - // However if next is called after release, then the iterator should error - require.False(t, iter.Next()) - require.EqualError(t, iter.Error(), ErrIterReleased.Error()) - - // Check that the empty iterator can be initialized with an error - iter = NewEmptyIterator(errors.New("something bad happened"), "foo") - require.EqualError(t, iter.Error(), "something bad happened") - - // Ensure that calling any of the iterator methods do not change the error - require.False(t, iter.Next()) - require.False(t, iter.Prev()) - require.False(t, iter.Seek([]byte("foo"))) - require.Nil(t, iter.Key()) - require.Nil(t, iter.Value()) - require.Equal(t, "foo", iter.Namespace()) - - obj, err = iter.Object() - require.NoError(t, err) - require.Nil(t, obj) - - require.EqualError(t, iter.Error(), "something bad happened") - - // Ensure calling Release doesn't change the error - iter.Release() - require.EqualError(t, iter.Error(), "something bad happened") - - // Ensure calling Next after Release doesn't change the error - iter.Next() - require.EqualError(t, iter.Error(), "something bad happened") -} diff --git a/iterator/iterator.go b/iterator/iterator.go deleted file mode 100644 index acf9eee..0000000 --- a/iterator/iterator.go +++ /dev/null @@ -1,64 +0,0 @@ -/* -Package iterator provides an interface and implementations to traverse over the contents -of an embedded database while maintaining and reading replicated object metadata. -*/ -package iterator - -import ( - "errors" - - pb "github.com/rotationalio/honu/object/v1" -) - -// Standard iterator errors that may be returned for error type checking. -var ( - ErrIterReleased = errors.New("iterator has been released") -) - -// Iterator retrieves multiple results from the underlying database, allowing users to -// loop over the results one at a time in a memory-safe fashion. The iterator may wrap -// a leveldb iterator or a sqlite rows context, fetching one row at a time in a Next -// loop. The Iterator also provides access to the versioned metadata for low-level -// interactions with the replicated data types. -// TODO: Implement IteratorSeeker interface from leveldb -type Iterator interface { - // Next moves the iterator to the next key/value pair or row. - // It returns false if the iterator has been exhausted. - Next() bool - - // Prev moves the iterator to the previous key/value pair or row. - // It returns false if the iterator has been exhausted. - Prev() bool - - // Error returns any accumulated error. Exhausting all rows or key/value pairs is - // not considered to be an error. - Error() error - - // Key returns the key of the current key/value pair, the object key of a row, or - // nil if done. The caller should not modify the contents of the returned slice, and - // its contents may change as the iterator progresses across the database. - Key() []byte - - // Value returns the data of the current key/value pair, the object data of a row, - // or nil if done. The caller should not modify the contents of the returned slice, - // and its contents may change as the iterator progresses across the database. - Value() []byte - - // Object returns the replicated object metadata and version information without - // data. This method can be used to read meta-information and is also used for - // replication. The object's Data property needs to be populated with Value() after - // the object has been loaded from disk. - Object() (*pb.Object, error) - - // When called, Release will close and release any resources associated with the - // iterator. Release can be called multiple times without error but after it has - // been called, no Iterator methods will return data. - Release() - - // Seek moves the iterator to the first key/value pair whose key is greater than or - // equal to the given key. It returns whether such pair exists. - Seek(key []byte) bool - - // Namespace returns the current namespace the iterator is operating on. - Namespace() string -} diff --git a/mimetype/generate.go b/mimetype/generate.go deleted file mode 100644 index 6752d17..0000000 --- a/mimetype/generate.go +++ /dev/null @@ -1,3 +0,0 @@ -package mimetype - -//go:generate bash generate.sh diff --git a/mimetype/generate.sh b/mimetype/generate.sh deleted file mode 100644 index 571a148..0000000 --- a/mimetype/generate.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash - -PROTOS="${GOPATH}/src/github.com/rotationalio/honu/proto" - -if [[ ! -d $PROTOS ]]; then - echo "cannot find ${PROTOS}" - exit 1 -fi - -if [[ ! -d "./v1" ]]; then - mkdir v1 -fi - -MODULE="github.com/rotationalio/honu/mimetype/v1" -MOD="github.com/rotationalio/honu/mimetype/v1;mimetype" - -# Generate the protocol buffers -protoc -I=${PROTOS} \ - --go_out=./v1 \ - --go_opt=module=${MODULE} \ - --go_opt=Mmimetype/v1/mimetype.proto="${MOD}" \ - --go_opt=Mmimetype/v1/charset.proto="${MOD}" \ - mimetype/v1/mimetype.proto \ - mimetype/v1/charset.proto \ No newline at end of file diff --git a/mimetype/v1/charset.pb.go b/mimetype/v1/charset.pb.go deleted file mode 100644 index 35e3b97..0000000 --- a/mimetype/v1/charset.pb.go +++ /dev/null @@ -1,1184 +0,0 @@ -// Code generated by proto/mimetype/v1/generate.go DO NOT EDIT. - -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.34.1 -// protoc v5.26.1 -// source: mimetype/v1/charset.proto - -package mimetype - -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) -) - -// CharSet defines the character set used in text based encoding. If the CharSet is not -// specified, it is assumed to be UTF-8. These CharSets are defined by the IANA -// character set assignments at -// https://www.iana.org/assignments/character-sets/character-sets.xhtml -// -// NOTE: not all character sets may be supported by the server and must be supported by -// clients of the database if an unsupport charset is used. -type CharSet int32 - -const ( - CharSet_UNDEFINED CharSet = 0 - CharSet_US_ASCII CharSet = 3 - CharSet_ISO_8859_1 CharSet = 4 - CharSet_ISO_8859_2 CharSet = 5 - CharSet_ISO_8859_3 CharSet = 6 - CharSet_ISO_8859_4 CharSet = 7 - CharSet_ISO_8859_5 CharSet = 8 - CharSet_ISO_8859_6 CharSet = 9 - CharSet_ISO_8859_7 CharSet = 10 - CharSet_ISO_8859_8 CharSet = 11 - CharSet_ISO_8859_9 CharSet = 12 - CharSet_ISO_8859_10 CharSet = 13 - CharSet_ISO_6937_2_ADD CharSet = 14 - CharSet_JIS_X0201 CharSet = 15 - CharSet_JIS_ENCODING CharSet = 16 - CharSet_SHIFT_JIS CharSet = 17 - CharSet_EUC_JP CharSet = 18 - CharSet_EXTENDED_UNIX_CODE_FIXED_WIDTH_FOR_JAPANESE CharSet = 19 - CharSet_BS_4730 CharSet = 20 - CharSet_SEN_850200_C CharSet = 21 - CharSet_IT CharSet = 22 - CharSet_ES CharSet = 23 - CharSet_DIN_66003 CharSet = 24 - CharSet_NS_4551_1 CharSet = 25 - CharSet_NF_Z_62_010 CharSet = 26 - CharSet_ISO_10646_UTF_1 CharSet = 27 - CharSet_ISO_646_BASIC_1983 CharSet = 28 - CharSet_INVARIANT CharSet = 29 - CharSet_ISO_646_IRV_1983 CharSet = 30 - CharSet_NATS_SEFI CharSet = 31 - CharSet_NATS_SEFI_ADD CharSet = 32 - CharSet_NATS_DANO CharSet = 33 - CharSet_NATS_DANO_ADD CharSet = 34 - CharSet_SEN_850200_B CharSet = 35 - CharSet_KS_C_5601_1987 CharSet = 36 - CharSet_ISO_2022_KR CharSet = 37 - CharSet_EUC_KR CharSet = 38 - CharSet_ISO_2022_JP CharSet = 39 - CharSet_ISO_2022_JP_2 CharSet = 40 - CharSet_JIS_C6220_1969_JP CharSet = 41 - CharSet_JIS_C6220_1969_RO CharSet = 42 - CharSet_PT CharSet = 43 - CharSet_GREEK7_OLD CharSet = 44 - CharSet_LATIN_GREEK CharSet = 45 - CharSet_NF_Z_62_010_1973 CharSet = 46 - CharSet_LATIN_GREEK_1 CharSet = 47 - CharSet_ISO_5427 CharSet = 48 - CharSet_JIS_C6226_1978 CharSet = 49 - CharSet_BS_VIEWDATA CharSet = 50 - CharSet_INIS CharSet = 51 - CharSet_INIS_8 CharSet = 52 - CharSet_INIS_CYRILLIC CharSet = 53 - CharSet_ISO_5427_1981 CharSet = 54 - CharSet_ISO_5428_1980 CharSet = 55 - CharSet_GB_1988_80 CharSet = 56 - CharSet_GB_2312_80 CharSet = 57 - CharSet_NS_4551_2 CharSet = 58 - CharSet_VIDEOTEX_SUPPL CharSet = 59 - CharSet_PT2 CharSet = 60 - CharSet_ES2 CharSet = 61 - CharSet_MSZ_7795_3 CharSet = 62 - CharSet_JIS_C6226_1983 CharSet = 63 - CharSet_GREEK7 CharSet = 64 - CharSet_ASMO_449 CharSet = 65 - CharSet_ISO_IR_90 CharSet = 66 - CharSet_JIS_C6229_1984_A CharSet = 67 - CharSet_JIS_C6229_1984_B CharSet = 68 - CharSet_JIS_C6229_1984_B_ADD CharSet = 69 - CharSet_JIS_C6229_1984_HAND CharSet = 70 - CharSet_JIS_C6229_1984_HAND_ADD CharSet = 71 - CharSet_JIS_C6229_1984_KANA CharSet = 72 - CharSet_ISO_2033_1983 CharSet = 73 - CharSet_ANSI_X3_110_1983 CharSet = 74 - CharSet_T_61_7BIT CharSet = 75 - CharSet_T_61_8BIT CharSet = 76 - CharSet_ECMA_CYRILLIC CharSet = 77 - CharSet_CSA_Z243_4_1985_1 CharSet = 78 - CharSet_CSA_Z243_4_1985_2 CharSet = 79 - CharSet_CSA_Z243_4_1985_GR CharSet = 80 - CharSet_ISO_8859_6_E CharSet = 81 - CharSet_ISO_8859_6_I CharSet = 82 - CharSet_T_101_G2 CharSet = 83 - CharSet_ISO_8859_8_E CharSet = 84 - CharSet_ISO_8859_8_I CharSet = 85 - CharSet_CSN_369103 CharSet = 86 - CharSet_JUS_I_B1_002 CharSet = 87 - CharSet_IEC_P27_1 CharSet = 88 - CharSet_JUS_I_B1_003_SERB CharSet = 89 - CharSet_JUS_I_B1_003_MAC CharSet = 90 - CharSet_GREEK_CCITT CharSet = 91 - CharSet_NC_NC00_10_81 CharSet = 92 - CharSet_ISO_6937_2_25 CharSet = 93 - CharSet_GOST_19768_74 CharSet = 94 - CharSet_ISO_8859_SUPP CharSet = 95 - CharSet_ISO_10367_BOX CharSet = 96 - CharSet_LATIN_LAP CharSet = 97 - CharSet_JIS_X0212_1990 CharSet = 98 - CharSet_DS_2089 CharSet = 99 - CharSet_US_DK CharSet = 100 - CharSet_DK_US CharSet = 101 - CharSet_KSC5636 CharSet = 102 - CharSet_UNICODE_1_1_UTF_7 CharSet = 103 - CharSet_ISO_2022_CN CharSet = 104 - CharSet_ISO_2022_CN_EXT CharSet = 105 - CharSet_UTF_8 CharSet = 106 - CharSet_ISO_8859_13 CharSet = 109 - CharSet_ISO_8859_14 CharSet = 110 - CharSet_ISO_8859_15 CharSet = 111 - CharSet_ISO_8859_16 CharSet = 112 - CharSet_GBK CharSet = 113 - CharSet_GB18030 CharSet = 114 - CharSet_OSD_EBCDIC_DF04_15 CharSet = 115 - CharSet_OSD_EBCDIC_DF03_IRV CharSet = 116 - CharSet_OSD_EBCDIC_DF04_1 CharSet = 117 - CharSet_ISO_11548_1 CharSet = 118 - CharSet_KZ_1048 CharSet = 119 - CharSet_ISO_10646_UCS_2 CharSet = 1000 - CharSet_ISO_10646_UCS_4 CharSet = 1001 - CharSet_ISO_10646_UCS_BASIC CharSet = 1002 - CharSet_ISO_10646_UNICODE_LATIN1 CharSet = 1003 - CharSet_ISO_10646_J_1 CharSet = 1004 - CharSet_ISO_UNICODE_IBM_1261 CharSet = 1005 - CharSet_ISO_UNICODE_IBM_1268 CharSet = 1006 - CharSet_ISO_UNICODE_IBM_1276 CharSet = 1007 - CharSet_ISO_UNICODE_IBM_1264 CharSet = 1008 - CharSet_ISO_UNICODE_IBM_1265 CharSet = 1009 - CharSet_UNICODE_1_1 CharSet = 1010 - CharSet_SCSU CharSet = 1011 - CharSet_UTF_7 CharSet = 1012 - CharSet_UTF_16BE CharSet = 1013 - CharSet_UTF_16LE CharSet = 1014 - CharSet_UTF_16 CharSet = 1015 - CharSet_CESU_8 CharSet = 1016 - CharSet_UTF_32 CharSet = 1017 - CharSet_UTF_32BE CharSet = 1018 - CharSet_UTF_32LE CharSet = 1019 - CharSet_BOCU_1 CharSet = 1020 - CharSet_UTF_7_IMAP CharSet = 1021 - CharSet_ISO_8859_1_WINDOWS_3_0_LATIN_1 CharSet = 2000 - CharSet_ISO_8859_1_WINDOWS_3_1_LATIN_1 CharSet = 2001 - CharSet_ISO_8859_2_WINDOWS_LATIN_2 CharSet = 2002 - CharSet_ISO_8859_9_WINDOWS_LATIN_5 CharSet = 2003 - CharSet_HP_ROMAN8 CharSet = 2004 - CharSet_ADOBE_STANDARD_ENCODING CharSet = 2005 - CharSet_VENTURA_US CharSet = 2006 - CharSet_VENTURA_INTERNATIONAL CharSet = 2007 - CharSet_DEC_MCS CharSet = 2008 - CharSet_IBM850 CharSet = 2009 - CharSet_PC8_DANISH_NORWEGIAN CharSet = 2012 - CharSet_IBM862 CharSet = 2013 - CharSet_PC8_TURKISH CharSet = 2014 - CharSet_IBM_SYMBOLS CharSet = 2015 - CharSet_IBM_THAI CharSet = 2016 - CharSet_HP_LEGAL CharSet = 2017 - CharSet_HP_PI_FONT CharSet = 2018 - CharSet_HP_MATH8 CharSet = 2019 - CharSet_ADOBE_SYMBOL_ENCODING CharSet = 2020 - CharSet_HP_DESKTOP CharSet = 2021 - CharSet_VENTURA_MATH CharSet = 2022 - CharSet_MICROSOFT_PUBLISHING CharSet = 2023 - CharSet_WINDOWS_31J CharSet = 2024 - CharSet_GB2312 CharSet = 2025 - CharSet_BIG5 CharSet = 2026 - CharSet_MACINTOSH CharSet = 2027 - CharSet_IBM037 CharSet = 2028 - CharSet_IBM038 CharSet = 2029 - CharSet_IBM273 CharSet = 2030 - CharSet_IBM274 CharSet = 2031 - CharSet_IBM275 CharSet = 2032 - CharSet_IBM277 CharSet = 2033 - CharSet_IBM278 CharSet = 2034 - CharSet_IBM280 CharSet = 2035 - CharSet_IBM281 CharSet = 2036 - CharSet_IBM284 CharSet = 2037 - CharSet_IBM285 CharSet = 2038 - CharSet_IBM290 CharSet = 2039 - CharSet_IBM297 CharSet = 2040 - CharSet_IBM420 CharSet = 2041 - CharSet_IBM423 CharSet = 2042 - CharSet_IBM424 CharSet = 2043 - CharSet_IBM437 CharSet = 2011 - CharSet_IBM500 CharSet = 2044 - CharSet_IBM851 CharSet = 2045 - CharSet_IBM852 CharSet = 2010 - CharSet_IBM855 CharSet = 2046 - CharSet_IBM857 CharSet = 2047 - CharSet_IBM860 CharSet = 2048 - CharSet_IBM861 CharSet = 2049 - CharSet_IBM863 CharSet = 2050 - CharSet_IBM864 CharSet = 2051 - CharSet_IBM865 CharSet = 2052 - CharSet_IBM868 CharSet = 2053 - CharSet_IBM869 CharSet = 2054 - CharSet_IBM870 CharSet = 2055 - CharSet_IBM871 CharSet = 2056 - CharSet_IBM880 CharSet = 2057 - CharSet_IBM891 CharSet = 2058 - CharSet_IBM903 CharSet = 2059 - CharSet_IBM904 CharSet = 2060 - CharSet_IBM905 CharSet = 2061 - CharSet_IBM918 CharSet = 2062 - CharSet_IBM1026 CharSet = 2063 - CharSet_EBCDIC_AT_DE CharSet = 2064 - CharSet_EBCDIC_AT_DE_A CharSet = 2065 - CharSet_EBCDIC_CA_FR CharSet = 2066 - CharSet_EBCDIC_DK_NO CharSet = 2067 - CharSet_EBCDIC_DK_NO_A CharSet = 2068 - CharSet_EBCDIC_FI_SE CharSet = 2069 - CharSet_EBCDIC_FI_SE_A CharSet = 2070 - CharSet_EBCDIC_FR CharSet = 2071 - CharSet_EBCDIC_IT CharSet = 2072 - CharSet_EBCDIC_PT CharSet = 2073 - CharSet_EBCDIC_ES CharSet = 2074 - CharSet_EBCDIC_ES_A CharSet = 2075 - CharSet_EBCDIC_ES_S CharSet = 2076 - CharSet_EBCDIC_UK CharSet = 2077 - CharSet_EBCDIC_US CharSet = 2078 - CharSet_UNKNOWN_8BIT CharSet = 2079 - CharSet_MNEMONIC CharSet = 2080 - CharSet_MNEM CharSet = 2081 - CharSet_VISCII CharSet = 2082 - CharSet_VIQR CharSet = 2083 - CharSet_KOI8_R CharSet = 2084 - CharSet_HZ_GB_2312 CharSet = 2085 - CharSet_IBM866 CharSet = 2086 - CharSet_IBM775 CharSet = 2087 - CharSet_KOI8_U CharSet = 2088 - CharSet_IBM00858 CharSet = 2089 - CharSet_IBM00924 CharSet = 2090 - CharSet_IBM01140 CharSet = 2091 - CharSet_IBM01141 CharSet = 2092 - CharSet_IBM01142 CharSet = 2093 - CharSet_IBM01143 CharSet = 2094 - CharSet_IBM01144 CharSet = 2095 - CharSet_IBM01145 CharSet = 2096 - CharSet_IBM01146 CharSet = 2097 - CharSet_IBM01147 CharSet = 2098 - CharSet_IBM01148 CharSet = 2099 - CharSet_IBM01149 CharSet = 2100 - CharSet_BIG5_HKSCS CharSet = 2101 - CharSet_IBM1047 CharSet = 2102 - CharSet_PTCP154 CharSet = 2103 - CharSet_AMIGA_1251 CharSet = 2104 - CharSet_KOI7_SWITCHED CharSet = 2105 - CharSet_BRF CharSet = 2106 - CharSet_TSCII CharSet = 2107 - CharSet_CP51932 CharSet = 2108 - CharSet_WINDOWS_874 CharSet = 2109 - CharSet_WINDOWS_1250 CharSet = 2250 - CharSet_WINDOWS_1251 CharSet = 2251 - CharSet_WINDOWS_1252 CharSet = 2252 - CharSet_WINDOWS_1253 CharSet = 2253 - CharSet_WINDOWS_1254 CharSet = 2254 - CharSet_WINDOWS_1255 CharSet = 2255 - CharSet_WINDOWS_1256 CharSet = 2256 - CharSet_WINDOWS_1257 CharSet = 2257 - CharSet_WINDOWS_1258 CharSet = 2258 - CharSet_TIS_620 CharSet = 2259 - CharSet_CP50220 CharSet = 2260 -) - -// Enum value maps for CharSet. -var ( - CharSet_name = map[int32]string{ - 0: "UNDEFINED", - 3: "US_ASCII", - 4: "ISO_8859_1", - 5: "ISO_8859_2", - 6: "ISO_8859_3", - 7: "ISO_8859_4", - 8: "ISO_8859_5", - 9: "ISO_8859_6", - 10: "ISO_8859_7", - 11: "ISO_8859_8", - 12: "ISO_8859_9", - 13: "ISO_8859_10", - 14: "ISO_6937_2_ADD", - 15: "JIS_X0201", - 16: "JIS_ENCODING", - 17: "SHIFT_JIS", - 18: "EUC_JP", - 19: "EXTENDED_UNIX_CODE_FIXED_WIDTH_FOR_JAPANESE", - 20: "BS_4730", - 21: "SEN_850200_C", - 22: "IT", - 23: "ES", - 24: "DIN_66003", - 25: "NS_4551_1", - 26: "NF_Z_62_010", - 27: "ISO_10646_UTF_1", - 28: "ISO_646_BASIC_1983", - 29: "INVARIANT", - 30: "ISO_646_IRV_1983", - 31: "NATS_SEFI", - 32: "NATS_SEFI_ADD", - 33: "NATS_DANO", - 34: "NATS_DANO_ADD", - 35: "SEN_850200_B", - 36: "KS_C_5601_1987", - 37: "ISO_2022_KR", - 38: "EUC_KR", - 39: "ISO_2022_JP", - 40: "ISO_2022_JP_2", - 41: "JIS_C6220_1969_JP", - 42: "JIS_C6220_1969_RO", - 43: "PT", - 44: "GREEK7_OLD", - 45: "LATIN_GREEK", - 46: "NF_Z_62_010_1973", - 47: "LATIN_GREEK_1", - 48: "ISO_5427", - 49: "JIS_C6226_1978", - 50: "BS_VIEWDATA", - 51: "INIS", - 52: "INIS_8", - 53: "INIS_CYRILLIC", - 54: "ISO_5427_1981", - 55: "ISO_5428_1980", - 56: "GB_1988_80", - 57: "GB_2312_80", - 58: "NS_4551_2", - 59: "VIDEOTEX_SUPPL", - 60: "PT2", - 61: "ES2", - 62: "MSZ_7795_3", - 63: "JIS_C6226_1983", - 64: "GREEK7", - 65: "ASMO_449", - 66: "ISO_IR_90", - 67: "JIS_C6229_1984_A", - 68: "JIS_C6229_1984_B", - 69: "JIS_C6229_1984_B_ADD", - 70: "JIS_C6229_1984_HAND", - 71: "JIS_C6229_1984_HAND_ADD", - 72: "JIS_C6229_1984_KANA", - 73: "ISO_2033_1983", - 74: "ANSI_X3_110_1983", - 75: "T_61_7BIT", - 76: "T_61_8BIT", - 77: "ECMA_CYRILLIC", - 78: "CSA_Z243_4_1985_1", - 79: "CSA_Z243_4_1985_2", - 80: "CSA_Z243_4_1985_GR", - 81: "ISO_8859_6_E", - 82: "ISO_8859_6_I", - 83: "T_101_G2", - 84: "ISO_8859_8_E", - 85: "ISO_8859_8_I", - 86: "CSN_369103", - 87: "JUS_I_B1_002", - 88: "IEC_P27_1", - 89: "JUS_I_B1_003_SERB", - 90: "JUS_I_B1_003_MAC", - 91: "GREEK_CCITT", - 92: "NC_NC00_10_81", - 93: "ISO_6937_2_25", - 94: "GOST_19768_74", - 95: "ISO_8859_SUPP", - 96: "ISO_10367_BOX", - 97: "LATIN_LAP", - 98: "JIS_X0212_1990", - 99: "DS_2089", - 100: "US_DK", - 101: "DK_US", - 102: "KSC5636", - 103: "UNICODE_1_1_UTF_7", - 104: "ISO_2022_CN", - 105: "ISO_2022_CN_EXT", - 106: "UTF_8", - 109: "ISO_8859_13", - 110: "ISO_8859_14", - 111: "ISO_8859_15", - 112: "ISO_8859_16", - 113: "GBK", - 114: "GB18030", - 115: "OSD_EBCDIC_DF04_15", - 116: "OSD_EBCDIC_DF03_IRV", - 117: "OSD_EBCDIC_DF04_1", - 118: "ISO_11548_1", - 119: "KZ_1048", - 1000: "ISO_10646_UCS_2", - 1001: "ISO_10646_UCS_4", - 1002: "ISO_10646_UCS_BASIC", - 1003: "ISO_10646_UNICODE_LATIN1", - 1004: "ISO_10646_J_1", - 1005: "ISO_UNICODE_IBM_1261", - 1006: "ISO_UNICODE_IBM_1268", - 1007: "ISO_UNICODE_IBM_1276", - 1008: "ISO_UNICODE_IBM_1264", - 1009: "ISO_UNICODE_IBM_1265", - 1010: "UNICODE_1_1", - 1011: "SCSU", - 1012: "UTF_7", - 1013: "UTF_16BE", - 1014: "UTF_16LE", - 1015: "UTF_16", - 1016: "CESU_8", - 1017: "UTF_32", - 1018: "UTF_32BE", - 1019: "UTF_32LE", - 1020: "BOCU_1", - 1021: "UTF_7_IMAP", - 2000: "ISO_8859_1_WINDOWS_3_0_LATIN_1", - 2001: "ISO_8859_1_WINDOWS_3_1_LATIN_1", - 2002: "ISO_8859_2_WINDOWS_LATIN_2", - 2003: "ISO_8859_9_WINDOWS_LATIN_5", - 2004: "HP_ROMAN8", - 2005: "ADOBE_STANDARD_ENCODING", - 2006: "VENTURA_US", - 2007: "VENTURA_INTERNATIONAL", - 2008: "DEC_MCS", - 2009: "IBM850", - 2012: "PC8_DANISH_NORWEGIAN", - 2013: "IBM862", - 2014: "PC8_TURKISH", - 2015: "IBM_SYMBOLS", - 2016: "IBM_THAI", - 2017: "HP_LEGAL", - 2018: "HP_PI_FONT", - 2019: "HP_MATH8", - 2020: "ADOBE_SYMBOL_ENCODING", - 2021: "HP_DESKTOP", - 2022: "VENTURA_MATH", - 2023: "MICROSOFT_PUBLISHING", - 2024: "WINDOWS_31J", - 2025: "GB2312", - 2026: "BIG5", - 2027: "MACINTOSH", - 2028: "IBM037", - 2029: "IBM038", - 2030: "IBM273", - 2031: "IBM274", - 2032: "IBM275", - 2033: "IBM277", - 2034: "IBM278", - 2035: "IBM280", - 2036: "IBM281", - 2037: "IBM284", - 2038: "IBM285", - 2039: "IBM290", - 2040: "IBM297", - 2041: "IBM420", - 2042: "IBM423", - 2043: "IBM424", - 2011: "IBM437", - 2044: "IBM500", - 2045: "IBM851", - 2010: "IBM852", - 2046: "IBM855", - 2047: "IBM857", - 2048: "IBM860", - 2049: "IBM861", - 2050: "IBM863", - 2051: "IBM864", - 2052: "IBM865", - 2053: "IBM868", - 2054: "IBM869", - 2055: "IBM870", - 2056: "IBM871", - 2057: "IBM880", - 2058: "IBM891", - 2059: "IBM903", - 2060: "IBM904", - 2061: "IBM905", - 2062: "IBM918", - 2063: "IBM1026", - 2064: "EBCDIC_AT_DE", - 2065: "EBCDIC_AT_DE_A", - 2066: "EBCDIC_CA_FR", - 2067: "EBCDIC_DK_NO", - 2068: "EBCDIC_DK_NO_A", - 2069: "EBCDIC_FI_SE", - 2070: "EBCDIC_FI_SE_A", - 2071: "EBCDIC_FR", - 2072: "EBCDIC_IT", - 2073: "EBCDIC_PT", - 2074: "EBCDIC_ES", - 2075: "EBCDIC_ES_A", - 2076: "EBCDIC_ES_S", - 2077: "EBCDIC_UK", - 2078: "EBCDIC_US", - 2079: "UNKNOWN_8BIT", - 2080: "MNEMONIC", - 2081: "MNEM", - 2082: "VISCII", - 2083: "VIQR", - 2084: "KOI8_R", - 2085: "HZ_GB_2312", - 2086: "IBM866", - 2087: "IBM775", - 2088: "KOI8_U", - 2089: "IBM00858", - 2090: "IBM00924", - 2091: "IBM01140", - 2092: "IBM01141", - 2093: "IBM01142", - 2094: "IBM01143", - 2095: "IBM01144", - 2096: "IBM01145", - 2097: "IBM01146", - 2098: "IBM01147", - 2099: "IBM01148", - 2100: "IBM01149", - 2101: "BIG5_HKSCS", - 2102: "IBM1047", - 2103: "PTCP154", - 2104: "AMIGA_1251", - 2105: "KOI7_SWITCHED", - 2106: "BRF", - 2107: "TSCII", - 2108: "CP51932", - 2109: "WINDOWS_874", - 2250: "WINDOWS_1250", - 2251: "WINDOWS_1251", - 2252: "WINDOWS_1252", - 2253: "WINDOWS_1253", - 2254: "WINDOWS_1254", - 2255: "WINDOWS_1255", - 2256: "WINDOWS_1256", - 2257: "WINDOWS_1257", - 2258: "WINDOWS_1258", - 2259: "TIS_620", - 2260: "CP50220", - } - CharSet_value = map[string]int32{ - "UNDEFINED": 0, - "US_ASCII": 3, - "ISO_8859_1": 4, - "ISO_8859_2": 5, - "ISO_8859_3": 6, - "ISO_8859_4": 7, - "ISO_8859_5": 8, - "ISO_8859_6": 9, - "ISO_8859_7": 10, - "ISO_8859_8": 11, - "ISO_8859_9": 12, - "ISO_8859_10": 13, - "ISO_6937_2_ADD": 14, - "JIS_X0201": 15, - "JIS_ENCODING": 16, - "SHIFT_JIS": 17, - "EUC_JP": 18, - "EXTENDED_UNIX_CODE_FIXED_WIDTH_FOR_JAPANESE": 19, - "BS_4730": 20, - "SEN_850200_C": 21, - "IT": 22, - "ES": 23, - "DIN_66003": 24, - "NS_4551_1": 25, - "NF_Z_62_010": 26, - "ISO_10646_UTF_1": 27, - "ISO_646_BASIC_1983": 28, - "INVARIANT": 29, - "ISO_646_IRV_1983": 30, - "NATS_SEFI": 31, - "NATS_SEFI_ADD": 32, - "NATS_DANO": 33, - "NATS_DANO_ADD": 34, - "SEN_850200_B": 35, - "KS_C_5601_1987": 36, - "ISO_2022_KR": 37, - "EUC_KR": 38, - "ISO_2022_JP": 39, - "ISO_2022_JP_2": 40, - "JIS_C6220_1969_JP": 41, - "JIS_C6220_1969_RO": 42, - "PT": 43, - "GREEK7_OLD": 44, - "LATIN_GREEK": 45, - "NF_Z_62_010_1973": 46, - "LATIN_GREEK_1": 47, - "ISO_5427": 48, - "JIS_C6226_1978": 49, - "BS_VIEWDATA": 50, - "INIS": 51, - "INIS_8": 52, - "INIS_CYRILLIC": 53, - "ISO_5427_1981": 54, - "ISO_5428_1980": 55, - "GB_1988_80": 56, - "GB_2312_80": 57, - "NS_4551_2": 58, - "VIDEOTEX_SUPPL": 59, - "PT2": 60, - "ES2": 61, - "MSZ_7795_3": 62, - "JIS_C6226_1983": 63, - "GREEK7": 64, - "ASMO_449": 65, - "ISO_IR_90": 66, - "JIS_C6229_1984_A": 67, - "JIS_C6229_1984_B": 68, - "JIS_C6229_1984_B_ADD": 69, - "JIS_C6229_1984_HAND": 70, - "JIS_C6229_1984_HAND_ADD": 71, - "JIS_C6229_1984_KANA": 72, - "ISO_2033_1983": 73, - "ANSI_X3_110_1983": 74, - "T_61_7BIT": 75, - "T_61_8BIT": 76, - "ECMA_CYRILLIC": 77, - "CSA_Z243_4_1985_1": 78, - "CSA_Z243_4_1985_2": 79, - "CSA_Z243_4_1985_GR": 80, - "ISO_8859_6_E": 81, - "ISO_8859_6_I": 82, - "T_101_G2": 83, - "ISO_8859_8_E": 84, - "ISO_8859_8_I": 85, - "CSN_369103": 86, - "JUS_I_B1_002": 87, - "IEC_P27_1": 88, - "JUS_I_B1_003_SERB": 89, - "JUS_I_B1_003_MAC": 90, - "GREEK_CCITT": 91, - "NC_NC00_10_81": 92, - "ISO_6937_2_25": 93, - "GOST_19768_74": 94, - "ISO_8859_SUPP": 95, - "ISO_10367_BOX": 96, - "LATIN_LAP": 97, - "JIS_X0212_1990": 98, - "DS_2089": 99, - "US_DK": 100, - "DK_US": 101, - "KSC5636": 102, - "UNICODE_1_1_UTF_7": 103, - "ISO_2022_CN": 104, - "ISO_2022_CN_EXT": 105, - "UTF_8": 106, - "ISO_8859_13": 109, - "ISO_8859_14": 110, - "ISO_8859_15": 111, - "ISO_8859_16": 112, - "GBK": 113, - "GB18030": 114, - "OSD_EBCDIC_DF04_15": 115, - "OSD_EBCDIC_DF03_IRV": 116, - "OSD_EBCDIC_DF04_1": 117, - "ISO_11548_1": 118, - "KZ_1048": 119, - "ISO_10646_UCS_2": 1000, - "ISO_10646_UCS_4": 1001, - "ISO_10646_UCS_BASIC": 1002, - "ISO_10646_UNICODE_LATIN1": 1003, - "ISO_10646_J_1": 1004, - "ISO_UNICODE_IBM_1261": 1005, - "ISO_UNICODE_IBM_1268": 1006, - "ISO_UNICODE_IBM_1276": 1007, - "ISO_UNICODE_IBM_1264": 1008, - "ISO_UNICODE_IBM_1265": 1009, - "UNICODE_1_1": 1010, - "SCSU": 1011, - "UTF_7": 1012, - "UTF_16BE": 1013, - "UTF_16LE": 1014, - "UTF_16": 1015, - "CESU_8": 1016, - "UTF_32": 1017, - "UTF_32BE": 1018, - "UTF_32LE": 1019, - "BOCU_1": 1020, - "UTF_7_IMAP": 1021, - "ISO_8859_1_WINDOWS_3_0_LATIN_1": 2000, - "ISO_8859_1_WINDOWS_3_1_LATIN_1": 2001, - "ISO_8859_2_WINDOWS_LATIN_2": 2002, - "ISO_8859_9_WINDOWS_LATIN_5": 2003, - "HP_ROMAN8": 2004, - "ADOBE_STANDARD_ENCODING": 2005, - "VENTURA_US": 2006, - "VENTURA_INTERNATIONAL": 2007, - "DEC_MCS": 2008, - "IBM850": 2009, - "PC8_DANISH_NORWEGIAN": 2012, - "IBM862": 2013, - "PC8_TURKISH": 2014, - "IBM_SYMBOLS": 2015, - "IBM_THAI": 2016, - "HP_LEGAL": 2017, - "HP_PI_FONT": 2018, - "HP_MATH8": 2019, - "ADOBE_SYMBOL_ENCODING": 2020, - "HP_DESKTOP": 2021, - "VENTURA_MATH": 2022, - "MICROSOFT_PUBLISHING": 2023, - "WINDOWS_31J": 2024, - "GB2312": 2025, - "BIG5": 2026, - "MACINTOSH": 2027, - "IBM037": 2028, - "IBM038": 2029, - "IBM273": 2030, - "IBM274": 2031, - "IBM275": 2032, - "IBM277": 2033, - "IBM278": 2034, - "IBM280": 2035, - "IBM281": 2036, - "IBM284": 2037, - "IBM285": 2038, - "IBM290": 2039, - "IBM297": 2040, - "IBM420": 2041, - "IBM423": 2042, - "IBM424": 2043, - "IBM437": 2011, - "IBM500": 2044, - "IBM851": 2045, - "IBM852": 2010, - "IBM855": 2046, - "IBM857": 2047, - "IBM860": 2048, - "IBM861": 2049, - "IBM863": 2050, - "IBM864": 2051, - "IBM865": 2052, - "IBM868": 2053, - "IBM869": 2054, - "IBM870": 2055, - "IBM871": 2056, - "IBM880": 2057, - "IBM891": 2058, - "IBM903": 2059, - "IBM904": 2060, - "IBM905": 2061, - "IBM918": 2062, - "IBM1026": 2063, - "EBCDIC_AT_DE": 2064, - "EBCDIC_AT_DE_A": 2065, - "EBCDIC_CA_FR": 2066, - "EBCDIC_DK_NO": 2067, - "EBCDIC_DK_NO_A": 2068, - "EBCDIC_FI_SE": 2069, - "EBCDIC_FI_SE_A": 2070, - "EBCDIC_FR": 2071, - "EBCDIC_IT": 2072, - "EBCDIC_PT": 2073, - "EBCDIC_ES": 2074, - "EBCDIC_ES_A": 2075, - "EBCDIC_ES_S": 2076, - "EBCDIC_UK": 2077, - "EBCDIC_US": 2078, - "UNKNOWN_8BIT": 2079, - "MNEMONIC": 2080, - "MNEM": 2081, - "VISCII": 2082, - "VIQR": 2083, - "KOI8_R": 2084, - "HZ_GB_2312": 2085, - "IBM866": 2086, - "IBM775": 2087, - "KOI8_U": 2088, - "IBM00858": 2089, - "IBM00924": 2090, - "IBM01140": 2091, - "IBM01141": 2092, - "IBM01142": 2093, - "IBM01143": 2094, - "IBM01144": 2095, - "IBM01145": 2096, - "IBM01146": 2097, - "IBM01147": 2098, - "IBM01148": 2099, - "IBM01149": 2100, - "BIG5_HKSCS": 2101, - "IBM1047": 2102, - "PTCP154": 2103, - "AMIGA_1251": 2104, - "KOI7_SWITCHED": 2105, - "BRF": 2106, - "TSCII": 2107, - "CP51932": 2108, - "WINDOWS_874": 2109, - "WINDOWS_1250": 2250, - "WINDOWS_1251": 2251, - "WINDOWS_1252": 2252, - "WINDOWS_1253": 2253, - "WINDOWS_1254": 2254, - "WINDOWS_1255": 2255, - "WINDOWS_1256": 2256, - "WINDOWS_1257": 2257, - "WINDOWS_1258": 2258, - "TIS_620": 2259, - "CP50220": 2260, - } -) - -func (x CharSet) Enum() *CharSet { - p := new(CharSet) - *p = x - return p -} - -func (x CharSet) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (CharSet) Descriptor() protoreflect.EnumDescriptor { - return file_mimetype_v1_charset_proto_enumTypes[0].Descriptor() -} - -func (CharSet) Type() protoreflect.EnumType { - return &file_mimetype_v1_charset_proto_enumTypes[0] -} - -func (x CharSet) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use CharSet.Descriptor instead. -func (CharSet) EnumDescriptor() ([]byte, []int) { - return file_mimetype_v1_charset_proto_rawDescGZIP(), []int{0} -} - -var File_mimetype_v1_charset_proto protoreflect.FileDescriptor - -var file_mimetype_v1_charset_proto_rawDesc = []byte{ - 0x0a, 0x19, 0x6d, 0x69, 0x6d, 0x65, 0x74, 0x79, 0x70, 0x65, 0x2f, 0x76, 0x31, 0x2f, 0x63, 0x68, - 0x61, 0x72, 0x73, 0x65, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0b, 0x6d, 0x69, 0x6d, - 0x65, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x76, 0x31, 0x2a, 0xd1, 0x22, 0x0a, 0x07, 0x43, 0x68, 0x61, - 0x72, 0x53, 0x65, 0x74, 0x12, 0x0d, 0x0a, 0x09, 0x55, 0x4e, 0x44, 0x45, 0x46, 0x49, 0x4e, 0x45, - 0x44, 0x10, 0x00, 0x12, 0x0c, 0x0a, 0x08, 0x55, 0x53, 0x5f, 0x41, 0x53, 0x43, 0x49, 0x49, 0x10, - 0x03, 0x12, 0x0e, 0x0a, 0x0a, 0x49, 0x53, 0x4f, 0x5f, 0x38, 0x38, 0x35, 0x39, 0x5f, 0x31, 0x10, - 0x04, 0x12, 0x0e, 0x0a, 0x0a, 0x49, 0x53, 0x4f, 0x5f, 0x38, 0x38, 0x35, 0x39, 0x5f, 0x32, 0x10, - 0x05, 0x12, 0x0e, 0x0a, 0x0a, 0x49, 0x53, 0x4f, 0x5f, 0x38, 0x38, 0x35, 0x39, 0x5f, 0x33, 0x10, - 0x06, 0x12, 0x0e, 0x0a, 0x0a, 0x49, 0x53, 0x4f, 0x5f, 0x38, 0x38, 0x35, 0x39, 0x5f, 0x34, 0x10, - 0x07, 0x12, 0x0e, 0x0a, 0x0a, 0x49, 0x53, 0x4f, 0x5f, 0x38, 0x38, 0x35, 0x39, 0x5f, 0x35, 0x10, - 0x08, 0x12, 0x0e, 0x0a, 0x0a, 0x49, 0x53, 0x4f, 0x5f, 0x38, 0x38, 0x35, 0x39, 0x5f, 0x36, 0x10, - 0x09, 0x12, 0x0e, 0x0a, 0x0a, 0x49, 0x53, 0x4f, 0x5f, 0x38, 0x38, 0x35, 0x39, 0x5f, 0x37, 0x10, - 0x0a, 0x12, 0x0e, 0x0a, 0x0a, 0x49, 0x53, 0x4f, 0x5f, 0x38, 0x38, 0x35, 0x39, 0x5f, 0x38, 0x10, - 0x0b, 0x12, 0x0e, 0x0a, 0x0a, 0x49, 0x53, 0x4f, 0x5f, 0x38, 0x38, 0x35, 0x39, 0x5f, 0x39, 0x10, - 0x0c, 0x12, 0x0f, 0x0a, 0x0b, 0x49, 0x53, 0x4f, 0x5f, 0x38, 0x38, 0x35, 0x39, 0x5f, 0x31, 0x30, - 0x10, 0x0d, 0x12, 0x12, 0x0a, 0x0e, 0x49, 0x53, 0x4f, 0x5f, 0x36, 0x39, 0x33, 0x37, 0x5f, 0x32, - 0x5f, 0x41, 0x44, 0x44, 0x10, 0x0e, 0x12, 0x0d, 0x0a, 0x09, 0x4a, 0x49, 0x53, 0x5f, 0x58, 0x30, - 0x32, 0x30, 0x31, 0x10, 0x0f, 0x12, 0x10, 0x0a, 0x0c, 0x4a, 0x49, 0x53, 0x5f, 0x45, 0x4e, 0x43, - 0x4f, 0x44, 0x49, 0x4e, 0x47, 0x10, 0x10, 0x12, 0x0d, 0x0a, 0x09, 0x53, 0x48, 0x49, 0x46, 0x54, - 0x5f, 0x4a, 0x49, 0x53, 0x10, 0x11, 0x12, 0x0a, 0x0a, 0x06, 0x45, 0x55, 0x43, 0x5f, 0x4a, 0x50, - 0x10, 0x12, 0x12, 0x2f, 0x0a, 0x2b, 0x45, 0x58, 0x54, 0x45, 0x4e, 0x44, 0x45, 0x44, 0x5f, 0x55, - 0x4e, 0x49, 0x58, 0x5f, 0x43, 0x4f, 0x44, 0x45, 0x5f, 0x46, 0x49, 0x58, 0x45, 0x44, 0x5f, 0x57, - 0x49, 0x44, 0x54, 0x48, 0x5f, 0x46, 0x4f, 0x52, 0x5f, 0x4a, 0x41, 0x50, 0x41, 0x4e, 0x45, 0x53, - 0x45, 0x10, 0x13, 0x12, 0x0b, 0x0a, 0x07, 0x42, 0x53, 0x5f, 0x34, 0x37, 0x33, 0x30, 0x10, 0x14, - 0x12, 0x10, 0x0a, 0x0c, 0x53, 0x45, 0x4e, 0x5f, 0x38, 0x35, 0x30, 0x32, 0x30, 0x30, 0x5f, 0x43, - 0x10, 0x15, 0x12, 0x06, 0x0a, 0x02, 0x49, 0x54, 0x10, 0x16, 0x12, 0x06, 0x0a, 0x02, 0x45, 0x53, - 0x10, 0x17, 0x12, 0x0d, 0x0a, 0x09, 0x44, 0x49, 0x4e, 0x5f, 0x36, 0x36, 0x30, 0x30, 0x33, 0x10, - 0x18, 0x12, 0x0d, 0x0a, 0x09, 0x4e, 0x53, 0x5f, 0x34, 0x35, 0x35, 0x31, 0x5f, 0x31, 0x10, 0x19, - 0x12, 0x0f, 0x0a, 0x0b, 0x4e, 0x46, 0x5f, 0x5a, 0x5f, 0x36, 0x32, 0x5f, 0x30, 0x31, 0x30, 0x10, - 0x1a, 0x12, 0x13, 0x0a, 0x0f, 0x49, 0x53, 0x4f, 0x5f, 0x31, 0x30, 0x36, 0x34, 0x36, 0x5f, 0x55, - 0x54, 0x46, 0x5f, 0x31, 0x10, 0x1b, 0x12, 0x16, 0x0a, 0x12, 0x49, 0x53, 0x4f, 0x5f, 0x36, 0x34, - 0x36, 0x5f, 0x42, 0x41, 0x53, 0x49, 0x43, 0x5f, 0x31, 0x39, 0x38, 0x33, 0x10, 0x1c, 0x12, 0x0d, - 0x0a, 0x09, 0x49, 0x4e, 0x56, 0x41, 0x52, 0x49, 0x41, 0x4e, 0x54, 0x10, 0x1d, 0x12, 0x14, 0x0a, - 0x10, 0x49, 0x53, 0x4f, 0x5f, 0x36, 0x34, 0x36, 0x5f, 0x49, 0x52, 0x56, 0x5f, 0x31, 0x39, 0x38, - 0x33, 0x10, 0x1e, 0x12, 0x0d, 0x0a, 0x09, 0x4e, 0x41, 0x54, 0x53, 0x5f, 0x53, 0x45, 0x46, 0x49, - 0x10, 0x1f, 0x12, 0x11, 0x0a, 0x0d, 0x4e, 0x41, 0x54, 0x53, 0x5f, 0x53, 0x45, 0x46, 0x49, 0x5f, - 0x41, 0x44, 0x44, 0x10, 0x20, 0x12, 0x0d, 0x0a, 0x09, 0x4e, 0x41, 0x54, 0x53, 0x5f, 0x44, 0x41, - 0x4e, 0x4f, 0x10, 0x21, 0x12, 0x11, 0x0a, 0x0d, 0x4e, 0x41, 0x54, 0x53, 0x5f, 0x44, 0x41, 0x4e, - 0x4f, 0x5f, 0x41, 0x44, 0x44, 0x10, 0x22, 0x12, 0x10, 0x0a, 0x0c, 0x53, 0x45, 0x4e, 0x5f, 0x38, - 0x35, 0x30, 0x32, 0x30, 0x30, 0x5f, 0x42, 0x10, 0x23, 0x12, 0x12, 0x0a, 0x0e, 0x4b, 0x53, 0x5f, - 0x43, 0x5f, 0x35, 0x36, 0x30, 0x31, 0x5f, 0x31, 0x39, 0x38, 0x37, 0x10, 0x24, 0x12, 0x0f, 0x0a, - 0x0b, 0x49, 0x53, 0x4f, 0x5f, 0x32, 0x30, 0x32, 0x32, 0x5f, 0x4b, 0x52, 0x10, 0x25, 0x12, 0x0a, - 0x0a, 0x06, 0x45, 0x55, 0x43, 0x5f, 0x4b, 0x52, 0x10, 0x26, 0x12, 0x0f, 0x0a, 0x0b, 0x49, 0x53, - 0x4f, 0x5f, 0x32, 0x30, 0x32, 0x32, 0x5f, 0x4a, 0x50, 0x10, 0x27, 0x12, 0x11, 0x0a, 0x0d, 0x49, - 0x53, 0x4f, 0x5f, 0x32, 0x30, 0x32, 0x32, 0x5f, 0x4a, 0x50, 0x5f, 0x32, 0x10, 0x28, 0x12, 0x15, - 0x0a, 0x11, 0x4a, 0x49, 0x53, 0x5f, 0x43, 0x36, 0x32, 0x32, 0x30, 0x5f, 0x31, 0x39, 0x36, 0x39, - 0x5f, 0x4a, 0x50, 0x10, 0x29, 0x12, 0x15, 0x0a, 0x11, 0x4a, 0x49, 0x53, 0x5f, 0x43, 0x36, 0x32, - 0x32, 0x30, 0x5f, 0x31, 0x39, 0x36, 0x39, 0x5f, 0x52, 0x4f, 0x10, 0x2a, 0x12, 0x06, 0x0a, 0x02, - 0x50, 0x54, 0x10, 0x2b, 0x12, 0x0e, 0x0a, 0x0a, 0x47, 0x52, 0x45, 0x45, 0x4b, 0x37, 0x5f, 0x4f, - 0x4c, 0x44, 0x10, 0x2c, 0x12, 0x0f, 0x0a, 0x0b, 0x4c, 0x41, 0x54, 0x49, 0x4e, 0x5f, 0x47, 0x52, - 0x45, 0x45, 0x4b, 0x10, 0x2d, 0x12, 0x14, 0x0a, 0x10, 0x4e, 0x46, 0x5f, 0x5a, 0x5f, 0x36, 0x32, - 0x5f, 0x30, 0x31, 0x30, 0x5f, 0x31, 0x39, 0x37, 0x33, 0x10, 0x2e, 0x12, 0x11, 0x0a, 0x0d, 0x4c, - 0x41, 0x54, 0x49, 0x4e, 0x5f, 0x47, 0x52, 0x45, 0x45, 0x4b, 0x5f, 0x31, 0x10, 0x2f, 0x12, 0x0c, - 0x0a, 0x08, 0x49, 0x53, 0x4f, 0x5f, 0x35, 0x34, 0x32, 0x37, 0x10, 0x30, 0x12, 0x12, 0x0a, 0x0e, - 0x4a, 0x49, 0x53, 0x5f, 0x43, 0x36, 0x32, 0x32, 0x36, 0x5f, 0x31, 0x39, 0x37, 0x38, 0x10, 0x31, - 0x12, 0x0f, 0x0a, 0x0b, 0x42, 0x53, 0x5f, 0x56, 0x49, 0x45, 0x57, 0x44, 0x41, 0x54, 0x41, 0x10, - 0x32, 0x12, 0x08, 0x0a, 0x04, 0x49, 0x4e, 0x49, 0x53, 0x10, 0x33, 0x12, 0x0a, 0x0a, 0x06, 0x49, - 0x4e, 0x49, 0x53, 0x5f, 0x38, 0x10, 0x34, 0x12, 0x11, 0x0a, 0x0d, 0x49, 0x4e, 0x49, 0x53, 0x5f, - 0x43, 0x59, 0x52, 0x49, 0x4c, 0x4c, 0x49, 0x43, 0x10, 0x35, 0x12, 0x11, 0x0a, 0x0d, 0x49, 0x53, - 0x4f, 0x5f, 0x35, 0x34, 0x32, 0x37, 0x5f, 0x31, 0x39, 0x38, 0x31, 0x10, 0x36, 0x12, 0x11, 0x0a, - 0x0d, 0x49, 0x53, 0x4f, 0x5f, 0x35, 0x34, 0x32, 0x38, 0x5f, 0x31, 0x39, 0x38, 0x30, 0x10, 0x37, - 0x12, 0x0e, 0x0a, 0x0a, 0x47, 0x42, 0x5f, 0x31, 0x39, 0x38, 0x38, 0x5f, 0x38, 0x30, 0x10, 0x38, - 0x12, 0x0e, 0x0a, 0x0a, 0x47, 0x42, 0x5f, 0x32, 0x33, 0x31, 0x32, 0x5f, 0x38, 0x30, 0x10, 0x39, - 0x12, 0x0d, 0x0a, 0x09, 0x4e, 0x53, 0x5f, 0x34, 0x35, 0x35, 0x31, 0x5f, 0x32, 0x10, 0x3a, 0x12, - 0x12, 0x0a, 0x0e, 0x56, 0x49, 0x44, 0x45, 0x4f, 0x54, 0x45, 0x58, 0x5f, 0x53, 0x55, 0x50, 0x50, - 0x4c, 0x10, 0x3b, 0x12, 0x07, 0x0a, 0x03, 0x50, 0x54, 0x32, 0x10, 0x3c, 0x12, 0x07, 0x0a, 0x03, - 0x45, 0x53, 0x32, 0x10, 0x3d, 0x12, 0x0e, 0x0a, 0x0a, 0x4d, 0x53, 0x5a, 0x5f, 0x37, 0x37, 0x39, - 0x35, 0x5f, 0x33, 0x10, 0x3e, 0x12, 0x12, 0x0a, 0x0e, 0x4a, 0x49, 0x53, 0x5f, 0x43, 0x36, 0x32, - 0x32, 0x36, 0x5f, 0x31, 0x39, 0x38, 0x33, 0x10, 0x3f, 0x12, 0x0a, 0x0a, 0x06, 0x47, 0x52, 0x45, - 0x45, 0x4b, 0x37, 0x10, 0x40, 0x12, 0x0c, 0x0a, 0x08, 0x41, 0x53, 0x4d, 0x4f, 0x5f, 0x34, 0x34, - 0x39, 0x10, 0x41, 0x12, 0x0d, 0x0a, 0x09, 0x49, 0x53, 0x4f, 0x5f, 0x49, 0x52, 0x5f, 0x39, 0x30, - 0x10, 0x42, 0x12, 0x14, 0x0a, 0x10, 0x4a, 0x49, 0x53, 0x5f, 0x43, 0x36, 0x32, 0x32, 0x39, 0x5f, - 0x31, 0x39, 0x38, 0x34, 0x5f, 0x41, 0x10, 0x43, 0x12, 0x14, 0x0a, 0x10, 0x4a, 0x49, 0x53, 0x5f, - 0x43, 0x36, 0x32, 0x32, 0x39, 0x5f, 0x31, 0x39, 0x38, 0x34, 0x5f, 0x42, 0x10, 0x44, 0x12, 0x18, - 0x0a, 0x14, 0x4a, 0x49, 0x53, 0x5f, 0x43, 0x36, 0x32, 0x32, 0x39, 0x5f, 0x31, 0x39, 0x38, 0x34, - 0x5f, 0x42, 0x5f, 0x41, 0x44, 0x44, 0x10, 0x45, 0x12, 0x17, 0x0a, 0x13, 0x4a, 0x49, 0x53, 0x5f, - 0x43, 0x36, 0x32, 0x32, 0x39, 0x5f, 0x31, 0x39, 0x38, 0x34, 0x5f, 0x48, 0x41, 0x4e, 0x44, 0x10, - 0x46, 0x12, 0x1b, 0x0a, 0x17, 0x4a, 0x49, 0x53, 0x5f, 0x43, 0x36, 0x32, 0x32, 0x39, 0x5f, 0x31, - 0x39, 0x38, 0x34, 0x5f, 0x48, 0x41, 0x4e, 0x44, 0x5f, 0x41, 0x44, 0x44, 0x10, 0x47, 0x12, 0x17, - 0x0a, 0x13, 0x4a, 0x49, 0x53, 0x5f, 0x43, 0x36, 0x32, 0x32, 0x39, 0x5f, 0x31, 0x39, 0x38, 0x34, - 0x5f, 0x4b, 0x41, 0x4e, 0x41, 0x10, 0x48, 0x12, 0x11, 0x0a, 0x0d, 0x49, 0x53, 0x4f, 0x5f, 0x32, - 0x30, 0x33, 0x33, 0x5f, 0x31, 0x39, 0x38, 0x33, 0x10, 0x49, 0x12, 0x14, 0x0a, 0x10, 0x41, 0x4e, - 0x53, 0x49, 0x5f, 0x58, 0x33, 0x5f, 0x31, 0x31, 0x30, 0x5f, 0x31, 0x39, 0x38, 0x33, 0x10, 0x4a, - 0x12, 0x0d, 0x0a, 0x09, 0x54, 0x5f, 0x36, 0x31, 0x5f, 0x37, 0x42, 0x49, 0x54, 0x10, 0x4b, 0x12, - 0x0d, 0x0a, 0x09, 0x54, 0x5f, 0x36, 0x31, 0x5f, 0x38, 0x42, 0x49, 0x54, 0x10, 0x4c, 0x12, 0x11, - 0x0a, 0x0d, 0x45, 0x43, 0x4d, 0x41, 0x5f, 0x43, 0x59, 0x52, 0x49, 0x4c, 0x4c, 0x49, 0x43, 0x10, - 0x4d, 0x12, 0x15, 0x0a, 0x11, 0x43, 0x53, 0x41, 0x5f, 0x5a, 0x32, 0x34, 0x33, 0x5f, 0x34, 0x5f, - 0x31, 0x39, 0x38, 0x35, 0x5f, 0x31, 0x10, 0x4e, 0x12, 0x15, 0x0a, 0x11, 0x43, 0x53, 0x41, 0x5f, - 0x5a, 0x32, 0x34, 0x33, 0x5f, 0x34, 0x5f, 0x31, 0x39, 0x38, 0x35, 0x5f, 0x32, 0x10, 0x4f, 0x12, - 0x16, 0x0a, 0x12, 0x43, 0x53, 0x41, 0x5f, 0x5a, 0x32, 0x34, 0x33, 0x5f, 0x34, 0x5f, 0x31, 0x39, - 0x38, 0x35, 0x5f, 0x47, 0x52, 0x10, 0x50, 0x12, 0x10, 0x0a, 0x0c, 0x49, 0x53, 0x4f, 0x5f, 0x38, - 0x38, 0x35, 0x39, 0x5f, 0x36, 0x5f, 0x45, 0x10, 0x51, 0x12, 0x10, 0x0a, 0x0c, 0x49, 0x53, 0x4f, - 0x5f, 0x38, 0x38, 0x35, 0x39, 0x5f, 0x36, 0x5f, 0x49, 0x10, 0x52, 0x12, 0x0c, 0x0a, 0x08, 0x54, - 0x5f, 0x31, 0x30, 0x31, 0x5f, 0x47, 0x32, 0x10, 0x53, 0x12, 0x10, 0x0a, 0x0c, 0x49, 0x53, 0x4f, - 0x5f, 0x38, 0x38, 0x35, 0x39, 0x5f, 0x38, 0x5f, 0x45, 0x10, 0x54, 0x12, 0x10, 0x0a, 0x0c, 0x49, - 0x53, 0x4f, 0x5f, 0x38, 0x38, 0x35, 0x39, 0x5f, 0x38, 0x5f, 0x49, 0x10, 0x55, 0x12, 0x0e, 0x0a, - 0x0a, 0x43, 0x53, 0x4e, 0x5f, 0x33, 0x36, 0x39, 0x31, 0x30, 0x33, 0x10, 0x56, 0x12, 0x10, 0x0a, - 0x0c, 0x4a, 0x55, 0x53, 0x5f, 0x49, 0x5f, 0x42, 0x31, 0x5f, 0x30, 0x30, 0x32, 0x10, 0x57, 0x12, - 0x0d, 0x0a, 0x09, 0x49, 0x45, 0x43, 0x5f, 0x50, 0x32, 0x37, 0x5f, 0x31, 0x10, 0x58, 0x12, 0x15, - 0x0a, 0x11, 0x4a, 0x55, 0x53, 0x5f, 0x49, 0x5f, 0x42, 0x31, 0x5f, 0x30, 0x30, 0x33, 0x5f, 0x53, - 0x45, 0x52, 0x42, 0x10, 0x59, 0x12, 0x14, 0x0a, 0x10, 0x4a, 0x55, 0x53, 0x5f, 0x49, 0x5f, 0x42, - 0x31, 0x5f, 0x30, 0x30, 0x33, 0x5f, 0x4d, 0x41, 0x43, 0x10, 0x5a, 0x12, 0x0f, 0x0a, 0x0b, 0x47, - 0x52, 0x45, 0x45, 0x4b, 0x5f, 0x43, 0x43, 0x49, 0x54, 0x54, 0x10, 0x5b, 0x12, 0x11, 0x0a, 0x0d, - 0x4e, 0x43, 0x5f, 0x4e, 0x43, 0x30, 0x30, 0x5f, 0x31, 0x30, 0x5f, 0x38, 0x31, 0x10, 0x5c, 0x12, - 0x11, 0x0a, 0x0d, 0x49, 0x53, 0x4f, 0x5f, 0x36, 0x39, 0x33, 0x37, 0x5f, 0x32, 0x5f, 0x32, 0x35, - 0x10, 0x5d, 0x12, 0x11, 0x0a, 0x0d, 0x47, 0x4f, 0x53, 0x54, 0x5f, 0x31, 0x39, 0x37, 0x36, 0x38, - 0x5f, 0x37, 0x34, 0x10, 0x5e, 0x12, 0x11, 0x0a, 0x0d, 0x49, 0x53, 0x4f, 0x5f, 0x38, 0x38, 0x35, - 0x39, 0x5f, 0x53, 0x55, 0x50, 0x50, 0x10, 0x5f, 0x12, 0x11, 0x0a, 0x0d, 0x49, 0x53, 0x4f, 0x5f, - 0x31, 0x30, 0x33, 0x36, 0x37, 0x5f, 0x42, 0x4f, 0x58, 0x10, 0x60, 0x12, 0x0d, 0x0a, 0x09, 0x4c, - 0x41, 0x54, 0x49, 0x4e, 0x5f, 0x4c, 0x41, 0x50, 0x10, 0x61, 0x12, 0x12, 0x0a, 0x0e, 0x4a, 0x49, - 0x53, 0x5f, 0x58, 0x30, 0x32, 0x31, 0x32, 0x5f, 0x31, 0x39, 0x39, 0x30, 0x10, 0x62, 0x12, 0x0b, - 0x0a, 0x07, 0x44, 0x53, 0x5f, 0x32, 0x30, 0x38, 0x39, 0x10, 0x63, 0x12, 0x09, 0x0a, 0x05, 0x55, - 0x53, 0x5f, 0x44, 0x4b, 0x10, 0x64, 0x12, 0x09, 0x0a, 0x05, 0x44, 0x4b, 0x5f, 0x55, 0x53, 0x10, - 0x65, 0x12, 0x0b, 0x0a, 0x07, 0x4b, 0x53, 0x43, 0x35, 0x36, 0x33, 0x36, 0x10, 0x66, 0x12, 0x15, - 0x0a, 0x11, 0x55, 0x4e, 0x49, 0x43, 0x4f, 0x44, 0x45, 0x5f, 0x31, 0x5f, 0x31, 0x5f, 0x55, 0x54, - 0x46, 0x5f, 0x37, 0x10, 0x67, 0x12, 0x0f, 0x0a, 0x0b, 0x49, 0x53, 0x4f, 0x5f, 0x32, 0x30, 0x32, - 0x32, 0x5f, 0x43, 0x4e, 0x10, 0x68, 0x12, 0x13, 0x0a, 0x0f, 0x49, 0x53, 0x4f, 0x5f, 0x32, 0x30, - 0x32, 0x32, 0x5f, 0x43, 0x4e, 0x5f, 0x45, 0x58, 0x54, 0x10, 0x69, 0x12, 0x09, 0x0a, 0x05, 0x55, - 0x54, 0x46, 0x5f, 0x38, 0x10, 0x6a, 0x12, 0x0f, 0x0a, 0x0b, 0x49, 0x53, 0x4f, 0x5f, 0x38, 0x38, - 0x35, 0x39, 0x5f, 0x31, 0x33, 0x10, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x49, 0x53, 0x4f, 0x5f, 0x38, - 0x38, 0x35, 0x39, 0x5f, 0x31, 0x34, 0x10, 0x6e, 0x12, 0x0f, 0x0a, 0x0b, 0x49, 0x53, 0x4f, 0x5f, - 0x38, 0x38, 0x35, 0x39, 0x5f, 0x31, 0x35, 0x10, 0x6f, 0x12, 0x0f, 0x0a, 0x0b, 0x49, 0x53, 0x4f, - 0x5f, 0x38, 0x38, 0x35, 0x39, 0x5f, 0x31, 0x36, 0x10, 0x70, 0x12, 0x07, 0x0a, 0x03, 0x47, 0x42, - 0x4b, 0x10, 0x71, 0x12, 0x0b, 0x0a, 0x07, 0x47, 0x42, 0x31, 0x38, 0x30, 0x33, 0x30, 0x10, 0x72, - 0x12, 0x16, 0x0a, 0x12, 0x4f, 0x53, 0x44, 0x5f, 0x45, 0x42, 0x43, 0x44, 0x49, 0x43, 0x5f, 0x44, - 0x46, 0x30, 0x34, 0x5f, 0x31, 0x35, 0x10, 0x73, 0x12, 0x17, 0x0a, 0x13, 0x4f, 0x53, 0x44, 0x5f, - 0x45, 0x42, 0x43, 0x44, 0x49, 0x43, 0x5f, 0x44, 0x46, 0x30, 0x33, 0x5f, 0x49, 0x52, 0x56, 0x10, - 0x74, 0x12, 0x15, 0x0a, 0x11, 0x4f, 0x53, 0x44, 0x5f, 0x45, 0x42, 0x43, 0x44, 0x49, 0x43, 0x5f, - 0x44, 0x46, 0x30, 0x34, 0x5f, 0x31, 0x10, 0x75, 0x12, 0x0f, 0x0a, 0x0b, 0x49, 0x53, 0x4f, 0x5f, - 0x31, 0x31, 0x35, 0x34, 0x38, 0x5f, 0x31, 0x10, 0x76, 0x12, 0x0b, 0x0a, 0x07, 0x4b, 0x5a, 0x5f, - 0x31, 0x30, 0x34, 0x38, 0x10, 0x77, 0x12, 0x14, 0x0a, 0x0f, 0x49, 0x53, 0x4f, 0x5f, 0x31, 0x30, - 0x36, 0x34, 0x36, 0x5f, 0x55, 0x43, 0x53, 0x5f, 0x32, 0x10, 0xe8, 0x07, 0x12, 0x14, 0x0a, 0x0f, - 0x49, 0x53, 0x4f, 0x5f, 0x31, 0x30, 0x36, 0x34, 0x36, 0x5f, 0x55, 0x43, 0x53, 0x5f, 0x34, 0x10, - 0xe9, 0x07, 0x12, 0x18, 0x0a, 0x13, 0x49, 0x53, 0x4f, 0x5f, 0x31, 0x30, 0x36, 0x34, 0x36, 0x5f, - 0x55, 0x43, 0x53, 0x5f, 0x42, 0x41, 0x53, 0x49, 0x43, 0x10, 0xea, 0x07, 0x12, 0x1d, 0x0a, 0x18, - 0x49, 0x53, 0x4f, 0x5f, 0x31, 0x30, 0x36, 0x34, 0x36, 0x5f, 0x55, 0x4e, 0x49, 0x43, 0x4f, 0x44, - 0x45, 0x5f, 0x4c, 0x41, 0x54, 0x49, 0x4e, 0x31, 0x10, 0xeb, 0x07, 0x12, 0x12, 0x0a, 0x0d, 0x49, - 0x53, 0x4f, 0x5f, 0x31, 0x30, 0x36, 0x34, 0x36, 0x5f, 0x4a, 0x5f, 0x31, 0x10, 0xec, 0x07, 0x12, - 0x19, 0x0a, 0x14, 0x49, 0x53, 0x4f, 0x5f, 0x55, 0x4e, 0x49, 0x43, 0x4f, 0x44, 0x45, 0x5f, 0x49, - 0x42, 0x4d, 0x5f, 0x31, 0x32, 0x36, 0x31, 0x10, 0xed, 0x07, 0x12, 0x19, 0x0a, 0x14, 0x49, 0x53, - 0x4f, 0x5f, 0x55, 0x4e, 0x49, 0x43, 0x4f, 0x44, 0x45, 0x5f, 0x49, 0x42, 0x4d, 0x5f, 0x31, 0x32, - 0x36, 0x38, 0x10, 0xee, 0x07, 0x12, 0x19, 0x0a, 0x14, 0x49, 0x53, 0x4f, 0x5f, 0x55, 0x4e, 0x49, - 0x43, 0x4f, 0x44, 0x45, 0x5f, 0x49, 0x42, 0x4d, 0x5f, 0x31, 0x32, 0x37, 0x36, 0x10, 0xef, 0x07, - 0x12, 0x19, 0x0a, 0x14, 0x49, 0x53, 0x4f, 0x5f, 0x55, 0x4e, 0x49, 0x43, 0x4f, 0x44, 0x45, 0x5f, - 0x49, 0x42, 0x4d, 0x5f, 0x31, 0x32, 0x36, 0x34, 0x10, 0xf0, 0x07, 0x12, 0x19, 0x0a, 0x14, 0x49, - 0x53, 0x4f, 0x5f, 0x55, 0x4e, 0x49, 0x43, 0x4f, 0x44, 0x45, 0x5f, 0x49, 0x42, 0x4d, 0x5f, 0x31, - 0x32, 0x36, 0x35, 0x10, 0xf1, 0x07, 0x12, 0x10, 0x0a, 0x0b, 0x55, 0x4e, 0x49, 0x43, 0x4f, 0x44, - 0x45, 0x5f, 0x31, 0x5f, 0x31, 0x10, 0xf2, 0x07, 0x12, 0x09, 0x0a, 0x04, 0x53, 0x43, 0x53, 0x55, - 0x10, 0xf3, 0x07, 0x12, 0x0a, 0x0a, 0x05, 0x55, 0x54, 0x46, 0x5f, 0x37, 0x10, 0xf4, 0x07, 0x12, - 0x0d, 0x0a, 0x08, 0x55, 0x54, 0x46, 0x5f, 0x31, 0x36, 0x42, 0x45, 0x10, 0xf5, 0x07, 0x12, 0x0d, - 0x0a, 0x08, 0x55, 0x54, 0x46, 0x5f, 0x31, 0x36, 0x4c, 0x45, 0x10, 0xf6, 0x07, 0x12, 0x0b, 0x0a, - 0x06, 0x55, 0x54, 0x46, 0x5f, 0x31, 0x36, 0x10, 0xf7, 0x07, 0x12, 0x0b, 0x0a, 0x06, 0x43, 0x45, - 0x53, 0x55, 0x5f, 0x38, 0x10, 0xf8, 0x07, 0x12, 0x0b, 0x0a, 0x06, 0x55, 0x54, 0x46, 0x5f, 0x33, - 0x32, 0x10, 0xf9, 0x07, 0x12, 0x0d, 0x0a, 0x08, 0x55, 0x54, 0x46, 0x5f, 0x33, 0x32, 0x42, 0x45, - 0x10, 0xfa, 0x07, 0x12, 0x0d, 0x0a, 0x08, 0x55, 0x54, 0x46, 0x5f, 0x33, 0x32, 0x4c, 0x45, 0x10, - 0xfb, 0x07, 0x12, 0x0b, 0x0a, 0x06, 0x42, 0x4f, 0x43, 0x55, 0x5f, 0x31, 0x10, 0xfc, 0x07, 0x12, - 0x0f, 0x0a, 0x0a, 0x55, 0x54, 0x46, 0x5f, 0x37, 0x5f, 0x49, 0x4d, 0x41, 0x50, 0x10, 0xfd, 0x07, - 0x12, 0x23, 0x0a, 0x1e, 0x49, 0x53, 0x4f, 0x5f, 0x38, 0x38, 0x35, 0x39, 0x5f, 0x31, 0x5f, 0x57, - 0x49, 0x4e, 0x44, 0x4f, 0x57, 0x53, 0x5f, 0x33, 0x5f, 0x30, 0x5f, 0x4c, 0x41, 0x54, 0x49, 0x4e, - 0x5f, 0x31, 0x10, 0xd0, 0x0f, 0x12, 0x23, 0x0a, 0x1e, 0x49, 0x53, 0x4f, 0x5f, 0x38, 0x38, 0x35, - 0x39, 0x5f, 0x31, 0x5f, 0x57, 0x49, 0x4e, 0x44, 0x4f, 0x57, 0x53, 0x5f, 0x33, 0x5f, 0x31, 0x5f, - 0x4c, 0x41, 0x54, 0x49, 0x4e, 0x5f, 0x31, 0x10, 0xd1, 0x0f, 0x12, 0x1f, 0x0a, 0x1a, 0x49, 0x53, - 0x4f, 0x5f, 0x38, 0x38, 0x35, 0x39, 0x5f, 0x32, 0x5f, 0x57, 0x49, 0x4e, 0x44, 0x4f, 0x57, 0x53, - 0x5f, 0x4c, 0x41, 0x54, 0x49, 0x4e, 0x5f, 0x32, 0x10, 0xd2, 0x0f, 0x12, 0x1f, 0x0a, 0x1a, 0x49, - 0x53, 0x4f, 0x5f, 0x38, 0x38, 0x35, 0x39, 0x5f, 0x39, 0x5f, 0x57, 0x49, 0x4e, 0x44, 0x4f, 0x57, - 0x53, 0x5f, 0x4c, 0x41, 0x54, 0x49, 0x4e, 0x5f, 0x35, 0x10, 0xd3, 0x0f, 0x12, 0x0e, 0x0a, 0x09, - 0x48, 0x50, 0x5f, 0x52, 0x4f, 0x4d, 0x41, 0x4e, 0x38, 0x10, 0xd4, 0x0f, 0x12, 0x1c, 0x0a, 0x17, - 0x41, 0x44, 0x4f, 0x42, 0x45, 0x5f, 0x53, 0x54, 0x41, 0x4e, 0x44, 0x41, 0x52, 0x44, 0x5f, 0x45, - 0x4e, 0x43, 0x4f, 0x44, 0x49, 0x4e, 0x47, 0x10, 0xd5, 0x0f, 0x12, 0x0f, 0x0a, 0x0a, 0x56, 0x45, - 0x4e, 0x54, 0x55, 0x52, 0x41, 0x5f, 0x55, 0x53, 0x10, 0xd6, 0x0f, 0x12, 0x1a, 0x0a, 0x15, 0x56, - 0x45, 0x4e, 0x54, 0x55, 0x52, 0x41, 0x5f, 0x49, 0x4e, 0x54, 0x45, 0x52, 0x4e, 0x41, 0x54, 0x49, - 0x4f, 0x4e, 0x41, 0x4c, 0x10, 0xd7, 0x0f, 0x12, 0x0c, 0x0a, 0x07, 0x44, 0x45, 0x43, 0x5f, 0x4d, - 0x43, 0x53, 0x10, 0xd8, 0x0f, 0x12, 0x0b, 0x0a, 0x06, 0x49, 0x42, 0x4d, 0x38, 0x35, 0x30, 0x10, - 0xd9, 0x0f, 0x12, 0x19, 0x0a, 0x14, 0x50, 0x43, 0x38, 0x5f, 0x44, 0x41, 0x4e, 0x49, 0x53, 0x48, - 0x5f, 0x4e, 0x4f, 0x52, 0x57, 0x45, 0x47, 0x49, 0x41, 0x4e, 0x10, 0xdc, 0x0f, 0x12, 0x0b, 0x0a, - 0x06, 0x49, 0x42, 0x4d, 0x38, 0x36, 0x32, 0x10, 0xdd, 0x0f, 0x12, 0x10, 0x0a, 0x0b, 0x50, 0x43, - 0x38, 0x5f, 0x54, 0x55, 0x52, 0x4b, 0x49, 0x53, 0x48, 0x10, 0xde, 0x0f, 0x12, 0x10, 0x0a, 0x0b, - 0x49, 0x42, 0x4d, 0x5f, 0x53, 0x59, 0x4d, 0x42, 0x4f, 0x4c, 0x53, 0x10, 0xdf, 0x0f, 0x12, 0x0d, - 0x0a, 0x08, 0x49, 0x42, 0x4d, 0x5f, 0x54, 0x48, 0x41, 0x49, 0x10, 0xe0, 0x0f, 0x12, 0x0d, 0x0a, - 0x08, 0x48, 0x50, 0x5f, 0x4c, 0x45, 0x47, 0x41, 0x4c, 0x10, 0xe1, 0x0f, 0x12, 0x0f, 0x0a, 0x0a, - 0x48, 0x50, 0x5f, 0x50, 0x49, 0x5f, 0x46, 0x4f, 0x4e, 0x54, 0x10, 0xe2, 0x0f, 0x12, 0x0d, 0x0a, - 0x08, 0x48, 0x50, 0x5f, 0x4d, 0x41, 0x54, 0x48, 0x38, 0x10, 0xe3, 0x0f, 0x12, 0x1a, 0x0a, 0x15, - 0x41, 0x44, 0x4f, 0x42, 0x45, 0x5f, 0x53, 0x59, 0x4d, 0x42, 0x4f, 0x4c, 0x5f, 0x45, 0x4e, 0x43, - 0x4f, 0x44, 0x49, 0x4e, 0x47, 0x10, 0xe4, 0x0f, 0x12, 0x0f, 0x0a, 0x0a, 0x48, 0x50, 0x5f, 0x44, - 0x45, 0x53, 0x4b, 0x54, 0x4f, 0x50, 0x10, 0xe5, 0x0f, 0x12, 0x11, 0x0a, 0x0c, 0x56, 0x45, 0x4e, - 0x54, 0x55, 0x52, 0x41, 0x5f, 0x4d, 0x41, 0x54, 0x48, 0x10, 0xe6, 0x0f, 0x12, 0x19, 0x0a, 0x14, - 0x4d, 0x49, 0x43, 0x52, 0x4f, 0x53, 0x4f, 0x46, 0x54, 0x5f, 0x50, 0x55, 0x42, 0x4c, 0x49, 0x53, - 0x48, 0x49, 0x4e, 0x47, 0x10, 0xe7, 0x0f, 0x12, 0x10, 0x0a, 0x0b, 0x57, 0x49, 0x4e, 0x44, 0x4f, - 0x57, 0x53, 0x5f, 0x33, 0x31, 0x4a, 0x10, 0xe8, 0x0f, 0x12, 0x0b, 0x0a, 0x06, 0x47, 0x42, 0x32, - 0x33, 0x31, 0x32, 0x10, 0xe9, 0x0f, 0x12, 0x09, 0x0a, 0x04, 0x42, 0x49, 0x47, 0x35, 0x10, 0xea, - 0x0f, 0x12, 0x0e, 0x0a, 0x09, 0x4d, 0x41, 0x43, 0x49, 0x4e, 0x54, 0x4f, 0x53, 0x48, 0x10, 0xeb, - 0x0f, 0x12, 0x0b, 0x0a, 0x06, 0x49, 0x42, 0x4d, 0x30, 0x33, 0x37, 0x10, 0xec, 0x0f, 0x12, 0x0b, - 0x0a, 0x06, 0x49, 0x42, 0x4d, 0x30, 0x33, 0x38, 0x10, 0xed, 0x0f, 0x12, 0x0b, 0x0a, 0x06, 0x49, - 0x42, 0x4d, 0x32, 0x37, 0x33, 0x10, 0xee, 0x0f, 0x12, 0x0b, 0x0a, 0x06, 0x49, 0x42, 0x4d, 0x32, - 0x37, 0x34, 0x10, 0xef, 0x0f, 0x12, 0x0b, 0x0a, 0x06, 0x49, 0x42, 0x4d, 0x32, 0x37, 0x35, 0x10, - 0xf0, 0x0f, 0x12, 0x0b, 0x0a, 0x06, 0x49, 0x42, 0x4d, 0x32, 0x37, 0x37, 0x10, 0xf1, 0x0f, 0x12, - 0x0b, 0x0a, 0x06, 0x49, 0x42, 0x4d, 0x32, 0x37, 0x38, 0x10, 0xf2, 0x0f, 0x12, 0x0b, 0x0a, 0x06, - 0x49, 0x42, 0x4d, 0x32, 0x38, 0x30, 0x10, 0xf3, 0x0f, 0x12, 0x0b, 0x0a, 0x06, 0x49, 0x42, 0x4d, - 0x32, 0x38, 0x31, 0x10, 0xf4, 0x0f, 0x12, 0x0b, 0x0a, 0x06, 0x49, 0x42, 0x4d, 0x32, 0x38, 0x34, - 0x10, 0xf5, 0x0f, 0x12, 0x0b, 0x0a, 0x06, 0x49, 0x42, 0x4d, 0x32, 0x38, 0x35, 0x10, 0xf6, 0x0f, - 0x12, 0x0b, 0x0a, 0x06, 0x49, 0x42, 0x4d, 0x32, 0x39, 0x30, 0x10, 0xf7, 0x0f, 0x12, 0x0b, 0x0a, - 0x06, 0x49, 0x42, 0x4d, 0x32, 0x39, 0x37, 0x10, 0xf8, 0x0f, 0x12, 0x0b, 0x0a, 0x06, 0x49, 0x42, - 0x4d, 0x34, 0x32, 0x30, 0x10, 0xf9, 0x0f, 0x12, 0x0b, 0x0a, 0x06, 0x49, 0x42, 0x4d, 0x34, 0x32, - 0x33, 0x10, 0xfa, 0x0f, 0x12, 0x0b, 0x0a, 0x06, 0x49, 0x42, 0x4d, 0x34, 0x32, 0x34, 0x10, 0xfb, - 0x0f, 0x12, 0x0b, 0x0a, 0x06, 0x49, 0x42, 0x4d, 0x34, 0x33, 0x37, 0x10, 0xdb, 0x0f, 0x12, 0x0b, - 0x0a, 0x06, 0x49, 0x42, 0x4d, 0x35, 0x30, 0x30, 0x10, 0xfc, 0x0f, 0x12, 0x0b, 0x0a, 0x06, 0x49, - 0x42, 0x4d, 0x38, 0x35, 0x31, 0x10, 0xfd, 0x0f, 0x12, 0x0b, 0x0a, 0x06, 0x49, 0x42, 0x4d, 0x38, - 0x35, 0x32, 0x10, 0xda, 0x0f, 0x12, 0x0b, 0x0a, 0x06, 0x49, 0x42, 0x4d, 0x38, 0x35, 0x35, 0x10, - 0xfe, 0x0f, 0x12, 0x0b, 0x0a, 0x06, 0x49, 0x42, 0x4d, 0x38, 0x35, 0x37, 0x10, 0xff, 0x0f, 0x12, - 0x0b, 0x0a, 0x06, 0x49, 0x42, 0x4d, 0x38, 0x36, 0x30, 0x10, 0x80, 0x10, 0x12, 0x0b, 0x0a, 0x06, - 0x49, 0x42, 0x4d, 0x38, 0x36, 0x31, 0x10, 0x81, 0x10, 0x12, 0x0b, 0x0a, 0x06, 0x49, 0x42, 0x4d, - 0x38, 0x36, 0x33, 0x10, 0x82, 0x10, 0x12, 0x0b, 0x0a, 0x06, 0x49, 0x42, 0x4d, 0x38, 0x36, 0x34, - 0x10, 0x83, 0x10, 0x12, 0x0b, 0x0a, 0x06, 0x49, 0x42, 0x4d, 0x38, 0x36, 0x35, 0x10, 0x84, 0x10, - 0x12, 0x0b, 0x0a, 0x06, 0x49, 0x42, 0x4d, 0x38, 0x36, 0x38, 0x10, 0x85, 0x10, 0x12, 0x0b, 0x0a, - 0x06, 0x49, 0x42, 0x4d, 0x38, 0x36, 0x39, 0x10, 0x86, 0x10, 0x12, 0x0b, 0x0a, 0x06, 0x49, 0x42, - 0x4d, 0x38, 0x37, 0x30, 0x10, 0x87, 0x10, 0x12, 0x0b, 0x0a, 0x06, 0x49, 0x42, 0x4d, 0x38, 0x37, - 0x31, 0x10, 0x88, 0x10, 0x12, 0x0b, 0x0a, 0x06, 0x49, 0x42, 0x4d, 0x38, 0x38, 0x30, 0x10, 0x89, - 0x10, 0x12, 0x0b, 0x0a, 0x06, 0x49, 0x42, 0x4d, 0x38, 0x39, 0x31, 0x10, 0x8a, 0x10, 0x12, 0x0b, - 0x0a, 0x06, 0x49, 0x42, 0x4d, 0x39, 0x30, 0x33, 0x10, 0x8b, 0x10, 0x12, 0x0b, 0x0a, 0x06, 0x49, - 0x42, 0x4d, 0x39, 0x30, 0x34, 0x10, 0x8c, 0x10, 0x12, 0x0b, 0x0a, 0x06, 0x49, 0x42, 0x4d, 0x39, - 0x30, 0x35, 0x10, 0x8d, 0x10, 0x12, 0x0b, 0x0a, 0x06, 0x49, 0x42, 0x4d, 0x39, 0x31, 0x38, 0x10, - 0x8e, 0x10, 0x12, 0x0c, 0x0a, 0x07, 0x49, 0x42, 0x4d, 0x31, 0x30, 0x32, 0x36, 0x10, 0x8f, 0x10, - 0x12, 0x11, 0x0a, 0x0c, 0x45, 0x42, 0x43, 0x44, 0x49, 0x43, 0x5f, 0x41, 0x54, 0x5f, 0x44, 0x45, - 0x10, 0x90, 0x10, 0x12, 0x13, 0x0a, 0x0e, 0x45, 0x42, 0x43, 0x44, 0x49, 0x43, 0x5f, 0x41, 0x54, - 0x5f, 0x44, 0x45, 0x5f, 0x41, 0x10, 0x91, 0x10, 0x12, 0x11, 0x0a, 0x0c, 0x45, 0x42, 0x43, 0x44, - 0x49, 0x43, 0x5f, 0x43, 0x41, 0x5f, 0x46, 0x52, 0x10, 0x92, 0x10, 0x12, 0x11, 0x0a, 0x0c, 0x45, - 0x42, 0x43, 0x44, 0x49, 0x43, 0x5f, 0x44, 0x4b, 0x5f, 0x4e, 0x4f, 0x10, 0x93, 0x10, 0x12, 0x13, - 0x0a, 0x0e, 0x45, 0x42, 0x43, 0x44, 0x49, 0x43, 0x5f, 0x44, 0x4b, 0x5f, 0x4e, 0x4f, 0x5f, 0x41, - 0x10, 0x94, 0x10, 0x12, 0x11, 0x0a, 0x0c, 0x45, 0x42, 0x43, 0x44, 0x49, 0x43, 0x5f, 0x46, 0x49, - 0x5f, 0x53, 0x45, 0x10, 0x95, 0x10, 0x12, 0x13, 0x0a, 0x0e, 0x45, 0x42, 0x43, 0x44, 0x49, 0x43, - 0x5f, 0x46, 0x49, 0x5f, 0x53, 0x45, 0x5f, 0x41, 0x10, 0x96, 0x10, 0x12, 0x0e, 0x0a, 0x09, 0x45, - 0x42, 0x43, 0x44, 0x49, 0x43, 0x5f, 0x46, 0x52, 0x10, 0x97, 0x10, 0x12, 0x0e, 0x0a, 0x09, 0x45, - 0x42, 0x43, 0x44, 0x49, 0x43, 0x5f, 0x49, 0x54, 0x10, 0x98, 0x10, 0x12, 0x0e, 0x0a, 0x09, 0x45, - 0x42, 0x43, 0x44, 0x49, 0x43, 0x5f, 0x50, 0x54, 0x10, 0x99, 0x10, 0x12, 0x0e, 0x0a, 0x09, 0x45, - 0x42, 0x43, 0x44, 0x49, 0x43, 0x5f, 0x45, 0x53, 0x10, 0x9a, 0x10, 0x12, 0x10, 0x0a, 0x0b, 0x45, - 0x42, 0x43, 0x44, 0x49, 0x43, 0x5f, 0x45, 0x53, 0x5f, 0x41, 0x10, 0x9b, 0x10, 0x12, 0x10, 0x0a, - 0x0b, 0x45, 0x42, 0x43, 0x44, 0x49, 0x43, 0x5f, 0x45, 0x53, 0x5f, 0x53, 0x10, 0x9c, 0x10, 0x12, - 0x0e, 0x0a, 0x09, 0x45, 0x42, 0x43, 0x44, 0x49, 0x43, 0x5f, 0x55, 0x4b, 0x10, 0x9d, 0x10, 0x12, - 0x0e, 0x0a, 0x09, 0x45, 0x42, 0x43, 0x44, 0x49, 0x43, 0x5f, 0x55, 0x53, 0x10, 0x9e, 0x10, 0x12, - 0x11, 0x0a, 0x0c, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x5f, 0x38, 0x42, 0x49, 0x54, 0x10, - 0x9f, 0x10, 0x12, 0x0d, 0x0a, 0x08, 0x4d, 0x4e, 0x45, 0x4d, 0x4f, 0x4e, 0x49, 0x43, 0x10, 0xa0, - 0x10, 0x12, 0x09, 0x0a, 0x04, 0x4d, 0x4e, 0x45, 0x4d, 0x10, 0xa1, 0x10, 0x12, 0x0b, 0x0a, 0x06, - 0x56, 0x49, 0x53, 0x43, 0x49, 0x49, 0x10, 0xa2, 0x10, 0x12, 0x09, 0x0a, 0x04, 0x56, 0x49, 0x51, - 0x52, 0x10, 0xa3, 0x10, 0x12, 0x0b, 0x0a, 0x06, 0x4b, 0x4f, 0x49, 0x38, 0x5f, 0x52, 0x10, 0xa4, - 0x10, 0x12, 0x0f, 0x0a, 0x0a, 0x48, 0x5a, 0x5f, 0x47, 0x42, 0x5f, 0x32, 0x33, 0x31, 0x32, 0x10, - 0xa5, 0x10, 0x12, 0x0b, 0x0a, 0x06, 0x49, 0x42, 0x4d, 0x38, 0x36, 0x36, 0x10, 0xa6, 0x10, 0x12, - 0x0b, 0x0a, 0x06, 0x49, 0x42, 0x4d, 0x37, 0x37, 0x35, 0x10, 0xa7, 0x10, 0x12, 0x0b, 0x0a, 0x06, - 0x4b, 0x4f, 0x49, 0x38, 0x5f, 0x55, 0x10, 0xa8, 0x10, 0x12, 0x0d, 0x0a, 0x08, 0x49, 0x42, 0x4d, - 0x30, 0x30, 0x38, 0x35, 0x38, 0x10, 0xa9, 0x10, 0x12, 0x0d, 0x0a, 0x08, 0x49, 0x42, 0x4d, 0x30, - 0x30, 0x39, 0x32, 0x34, 0x10, 0xaa, 0x10, 0x12, 0x0d, 0x0a, 0x08, 0x49, 0x42, 0x4d, 0x30, 0x31, - 0x31, 0x34, 0x30, 0x10, 0xab, 0x10, 0x12, 0x0d, 0x0a, 0x08, 0x49, 0x42, 0x4d, 0x30, 0x31, 0x31, - 0x34, 0x31, 0x10, 0xac, 0x10, 0x12, 0x0d, 0x0a, 0x08, 0x49, 0x42, 0x4d, 0x30, 0x31, 0x31, 0x34, - 0x32, 0x10, 0xad, 0x10, 0x12, 0x0d, 0x0a, 0x08, 0x49, 0x42, 0x4d, 0x30, 0x31, 0x31, 0x34, 0x33, - 0x10, 0xae, 0x10, 0x12, 0x0d, 0x0a, 0x08, 0x49, 0x42, 0x4d, 0x30, 0x31, 0x31, 0x34, 0x34, 0x10, - 0xaf, 0x10, 0x12, 0x0d, 0x0a, 0x08, 0x49, 0x42, 0x4d, 0x30, 0x31, 0x31, 0x34, 0x35, 0x10, 0xb0, - 0x10, 0x12, 0x0d, 0x0a, 0x08, 0x49, 0x42, 0x4d, 0x30, 0x31, 0x31, 0x34, 0x36, 0x10, 0xb1, 0x10, - 0x12, 0x0d, 0x0a, 0x08, 0x49, 0x42, 0x4d, 0x30, 0x31, 0x31, 0x34, 0x37, 0x10, 0xb2, 0x10, 0x12, - 0x0d, 0x0a, 0x08, 0x49, 0x42, 0x4d, 0x30, 0x31, 0x31, 0x34, 0x38, 0x10, 0xb3, 0x10, 0x12, 0x0d, - 0x0a, 0x08, 0x49, 0x42, 0x4d, 0x30, 0x31, 0x31, 0x34, 0x39, 0x10, 0xb4, 0x10, 0x12, 0x0f, 0x0a, - 0x0a, 0x42, 0x49, 0x47, 0x35, 0x5f, 0x48, 0x4b, 0x53, 0x43, 0x53, 0x10, 0xb5, 0x10, 0x12, 0x0c, - 0x0a, 0x07, 0x49, 0x42, 0x4d, 0x31, 0x30, 0x34, 0x37, 0x10, 0xb6, 0x10, 0x12, 0x0c, 0x0a, 0x07, - 0x50, 0x54, 0x43, 0x50, 0x31, 0x35, 0x34, 0x10, 0xb7, 0x10, 0x12, 0x0f, 0x0a, 0x0a, 0x41, 0x4d, - 0x49, 0x47, 0x41, 0x5f, 0x31, 0x32, 0x35, 0x31, 0x10, 0xb8, 0x10, 0x12, 0x12, 0x0a, 0x0d, 0x4b, - 0x4f, 0x49, 0x37, 0x5f, 0x53, 0x57, 0x49, 0x54, 0x43, 0x48, 0x45, 0x44, 0x10, 0xb9, 0x10, 0x12, - 0x08, 0x0a, 0x03, 0x42, 0x52, 0x46, 0x10, 0xba, 0x10, 0x12, 0x0a, 0x0a, 0x05, 0x54, 0x53, 0x43, - 0x49, 0x49, 0x10, 0xbb, 0x10, 0x12, 0x0c, 0x0a, 0x07, 0x43, 0x50, 0x35, 0x31, 0x39, 0x33, 0x32, - 0x10, 0xbc, 0x10, 0x12, 0x10, 0x0a, 0x0b, 0x57, 0x49, 0x4e, 0x44, 0x4f, 0x57, 0x53, 0x5f, 0x38, - 0x37, 0x34, 0x10, 0xbd, 0x10, 0x12, 0x11, 0x0a, 0x0c, 0x57, 0x49, 0x4e, 0x44, 0x4f, 0x57, 0x53, - 0x5f, 0x31, 0x32, 0x35, 0x30, 0x10, 0xca, 0x11, 0x12, 0x11, 0x0a, 0x0c, 0x57, 0x49, 0x4e, 0x44, - 0x4f, 0x57, 0x53, 0x5f, 0x31, 0x32, 0x35, 0x31, 0x10, 0xcb, 0x11, 0x12, 0x11, 0x0a, 0x0c, 0x57, - 0x49, 0x4e, 0x44, 0x4f, 0x57, 0x53, 0x5f, 0x31, 0x32, 0x35, 0x32, 0x10, 0xcc, 0x11, 0x12, 0x11, - 0x0a, 0x0c, 0x57, 0x49, 0x4e, 0x44, 0x4f, 0x57, 0x53, 0x5f, 0x31, 0x32, 0x35, 0x33, 0x10, 0xcd, - 0x11, 0x12, 0x11, 0x0a, 0x0c, 0x57, 0x49, 0x4e, 0x44, 0x4f, 0x57, 0x53, 0x5f, 0x31, 0x32, 0x35, - 0x34, 0x10, 0xce, 0x11, 0x12, 0x11, 0x0a, 0x0c, 0x57, 0x49, 0x4e, 0x44, 0x4f, 0x57, 0x53, 0x5f, - 0x31, 0x32, 0x35, 0x35, 0x10, 0xcf, 0x11, 0x12, 0x11, 0x0a, 0x0c, 0x57, 0x49, 0x4e, 0x44, 0x4f, - 0x57, 0x53, 0x5f, 0x31, 0x32, 0x35, 0x36, 0x10, 0xd0, 0x11, 0x12, 0x11, 0x0a, 0x0c, 0x57, 0x49, - 0x4e, 0x44, 0x4f, 0x57, 0x53, 0x5f, 0x31, 0x32, 0x35, 0x37, 0x10, 0xd1, 0x11, 0x12, 0x11, 0x0a, - 0x0c, 0x57, 0x49, 0x4e, 0x44, 0x4f, 0x57, 0x53, 0x5f, 0x31, 0x32, 0x35, 0x38, 0x10, 0xd2, 0x11, - 0x12, 0x0c, 0x0a, 0x07, 0x54, 0x49, 0x53, 0x5f, 0x36, 0x32, 0x30, 0x10, 0xd3, 0x11, 0x12, 0x0c, - 0x0a, 0x07, 0x43, 0x50, 0x35, 0x30, 0x32, 0x32, 0x30, 0x10, 0xd4, 0x11, 0x42, 0x27, 0x5a, 0x25, - 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x72, 0x6f, 0x74, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x69, 0x6f, 0x2f, 0x68, 0x6f, 0x6e, 0x75, 0x2f, 0x6d, 0x69, 0x6d, - 0x65, 0x74, 0x79, 0x70, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_mimetype_v1_charset_proto_rawDescOnce sync.Once - file_mimetype_v1_charset_proto_rawDescData = file_mimetype_v1_charset_proto_rawDesc -) - -func file_mimetype_v1_charset_proto_rawDescGZIP() []byte { - file_mimetype_v1_charset_proto_rawDescOnce.Do(func() { - file_mimetype_v1_charset_proto_rawDescData = protoimpl.X.CompressGZIP(file_mimetype_v1_charset_proto_rawDescData) - }) - return file_mimetype_v1_charset_proto_rawDescData -} - -var file_mimetype_v1_charset_proto_enumTypes = make([]protoimpl.EnumInfo, 1) -var file_mimetype_v1_charset_proto_goTypes = []interface{}{ - (CharSet)(0), // 0: mimetype.v1.CharSet -} -var file_mimetype_v1_charset_proto_depIdxs = []int32{ - 0, // [0:0] is the sub-list for method output_type - 0, // [0:0] is the sub-list for method input_type - 0, // [0:0] is the sub-list for extension type_name - 0, // [0:0] is the sub-list for extension extendee - 0, // [0:0] is the sub-list for field type_name -} - -func init() { file_mimetype_v1_charset_proto_init() } -func file_mimetype_v1_charset_proto_init() { - if File_mimetype_v1_charset_proto != nil { - return - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_mimetype_v1_charset_proto_rawDesc, - NumEnums: 1, - NumMessages: 0, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_mimetype_v1_charset_proto_goTypes, - DependencyIndexes: file_mimetype_v1_charset_proto_depIdxs, - EnumInfos: file_mimetype_v1_charset_proto_enumTypes, - }.Build() - File_mimetype_v1_charset_proto = out.File - file_mimetype_v1_charset_proto_rawDesc = nil - file_mimetype_v1_charset_proto_goTypes = nil - file_mimetype_v1_charset_proto_depIdxs = nil -} diff --git a/mimetype/v1/mimetype.pb.go b/mimetype/v1/mimetype.pb.go deleted file mode 100644 index 7a3e6d8..0000000 --- a/mimetype/v1/mimetype.pb.go +++ /dev/null @@ -1,373 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.34.1 -// protoc v5.26.1 -// source: mimetype/v1/mimetype.proto - -package mimetype - -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) -) - -// MIME stands for multipurpose internet mail extensions and is a standardized method -// for defining the formatting of files and data of different types. In Honu, the -// mimetype is used to identify and deserialize object data. -// -// Typically, mimetypes are strings, e.g. "application/json" and can even flexibly -// define encodings such as "application/json; charset=utf-8"; these ensure that -// mimetypes are flexible and can be extended without changing protocols. However, using -// string encoding for objects results in a lot of duplication and data size should be as -// small as possible when there are numerous objects in the system. -// -// To reduce the size of object metadata, this package defines mimetypes as an enum. This -// ensures that only 4 bytes maximum are used for the mimetype, but also means that the -// mimetypes are not as flexible and adding new mimetypes requires adding enum values to -// this package. If your mimetype is not listed here, please submit a pull request to -// honu to get it added! -// -// TODO: generate mimetype list from IANA like we're doing with charsets: -// https://www.iana.org/assignments/media-types/media-types.xhtml -type MIME int32 - -const ( - MIME_UNSPECIFIED MIME = 0 - MIME_UNKNOWN MIME = 0 - // Default value for textual files that are human-readable and do not contain binary data. - MIME_TEXT_PLAIN MIME = 1 - // Plain text data-containing types - MIME_TEXT_CSV MIME = 2 - MIME_TEXT_HTML MIME = 3 - MIME_TEXT_CALENDAR MIME = 4 - // Default value for all non-text data types (alias for UNSPECIFIED) - MIME_APPLICATION_OCTET_STREAM MIME = 0 - // Application data-containing types - MIME_APPLICATION_JSON MIME = 50 - MIME_APPLICATION_JSON_UTF8 MIME = 50 - MIME_APPLICATION_JSON_LD MIME = 51 - MIME_APPLICATION_JSON_LINES MIME = 52 - MIME_APPLICATION_UBJSON MIME = 53 - MIME_APPLICATION_BSON MIME = 54 - MIME_APPLICATION_XML MIME = 100 - MIME_APPLICATION_ATOM MIME = 101 - // Binary application data-containing types - MIME_APPLICATION_MSGPACK MIME = 252 - MIME_APPLICATION_PARQUET MIME = 253 - MIME_APPLICATION_AVRO MIME = 254 - MIME_APPLICATION_PROTOBUF MIME = 255 - // Other miscellaneous application types - MIME_APPLICATION_PDF MIME = 512 - MIME_APPLICATION_JAVA_ARCHIVE MIME = 513 - MIME_APPLICATION_PYTHON_PICKLE MIME = 514 - // User-specified mimetypes allow the user to distinguish mimetypes in their - // applications without specifically setting a mimetype. - MIME_USER_SPECIFIED0 MIME = 1000 - MIME_USER_SPECIFIED1 MIME = 1001 - MIME_USER_SPECIFIED2 MIME = 1002 - MIME_USER_SPECIFIED3 MIME = 1003 - MIME_USER_SPECIFIED4 MIME = 1004 - MIME_USER_SPECIFIED5 MIME = 1005 - MIME_USER_SPECIFIED6 MIME = 1006 - MIME_USER_SPECIFIED7 MIME = 1007 - MIME_USER_SPECIFIED8 MIME = 1008 - MIME_USER_SPECIFIED9 MIME = 1009 -) - -// Enum value maps for MIME. -var ( - MIME_name = map[int32]string{ - 0: "UNSPECIFIED", - // Duplicate value: 0: "UNKNOWN", - 1: "TEXT_PLAIN", - 2: "TEXT_CSV", - 3: "TEXT_HTML", - 4: "TEXT_CALENDAR", - // Duplicate value: 0: "APPLICATION_OCTET_STREAM", - 50: "APPLICATION_JSON", - // Duplicate value: 50: "APPLICATION_JSON_UTF8", - 51: "APPLICATION_JSON_LD", - 52: "APPLICATION_JSON_LINES", - 53: "APPLICATION_UBJSON", - 54: "APPLICATION_BSON", - 100: "APPLICATION_XML", - 101: "APPLICATION_ATOM", - 252: "APPLICATION_MSGPACK", - 253: "APPLICATION_PARQUET", - 254: "APPLICATION_AVRO", - 255: "APPLICATION_PROTOBUF", - 512: "APPLICATION_PDF", - 513: "APPLICATION_JAVA_ARCHIVE", - 514: "APPLICATION_PYTHON_PICKLE", - 1000: "USER_SPECIFIED0", - 1001: "USER_SPECIFIED1", - 1002: "USER_SPECIFIED2", - 1003: "USER_SPECIFIED3", - 1004: "USER_SPECIFIED4", - 1005: "USER_SPECIFIED5", - 1006: "USER_SPECIFIED6", - 1007: "USER_SPECIFIED7", - 1008: "USER_SPECIFIED8", - 1009: "USER_SPECIFIED9", - } - MIME_value = map[string]int32{ - "UNSPECIFIED": 0, - "UNKNOWN": 0, - "TEXT_PLAIN": 1, - "TEXT_CSV": 2, - "TEXT_HTML": 3, - "TEXT_CALENDAR": 4, - "APPLICATION_OCTET_STREAM": 0, - "APPLICATION_JSON": 50, - "APPLICATION_JSON_UTF8": 50, - "APPLICATION_JSON_LD": 51, - "APPLICATION_JSON_LINES": 52, - "APPLICATION_UBJSON": 53, - "APPLICATION_BSON": 54, - "APPLICATION_XML": 100, - "APPLICATION_ATOM": 101, - "APPLICATION_MSGPACK": 252, - "APPLICATION_PARQUET": 253, - "APPLICATION_AVRO": 254, - "APPLICATION_PROTOBUF": 255, - "APPLICATION_PDF": 512, - "APPLICATION_JAVA_ARCHIVE": 513, - "APPLICATION_PYTHON_PICKLE": 514, - "USER_SPECIFIED0": 1000, - "USER_SPECIFIED1": 1001, - "USER_SPECIFIED2": 1002, - "USER_SPECIFIED3": 1003, - "USER_SPECIFIED4": 1004, - "USER_SPECIFIED5": 1005, - "USER_SPECIFIED6": 1006, - "USER_SPECIFIED7": 1007, - "USER_SPECIFIED8": 1008, - "USER_SPECIFIED9": 1009, - } -) - -func (x MIME) Enum() *MIME { - p := new(MIME) - *p = x - return p -} - -func (x MIME) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (MIME) Descriptor() protoreflect.EnumDescriptor { - return file_mimetype_v1_mimetype_proto_enumTypes[0].Descriptor() -} - -func (MIME) Type() protoreflect.EnumType { - return &file_mimetype_v1_mimetype_proto_enumTypes[0] -} - -func (x MIME) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use MIME.Descriptor instead. -func (MIME) EnumDescriptor() ([]byte, []int) { - return file_mimetype_v1_mimetype_proto_rawDescGZIP(), []int{0} -} - -type Mimetype struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Mime MIME `protobuf:"varint,1,opt,name=mime,proto3,enum=mimetype.v1.MIME" json:"mime,omitempty"` - Charset CharSet `protobuf:"varint,2,opt,name=charset,proto3,enum=mimetype.v1.CharSet" json:"charset,omitempty"` -} - -func (x *Mimetype) Reset() { - *x = Mimetype{} - if protoimpl.UnsafeEnabled { - mi := &file_mimetype_v1_mimetype_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Mimetype) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Mimetype) ProtoMessage() {} - -func (x *Mimetype) ProtoReflect() protoreflect.Message { - mi := &file_mimetype_v1_mimetype_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) -} - -// Deprecated: Use Mimetype.ProtoReflect.Descriptor instead. -func (*Mimetype) Descriptor() ([]byte, []int) { - return file_mimetype_v1_mimetype_proto_rawDescGZIP(), []int{0} -} - -func (x *Mimetype) GetMime() MIME { - if x != nil { - return x.Mime - } - return MIME_UNSPECIFIED -} - -func (x *Mimetype) GetCharset() CharSet { - if x != nil { - return x.Charset - } - return CharSet_UNDEFINED -} - -var File_mimetype_v1_mimetype_proto protoreflect.FileDescriptor - -var file_mimetype_v1_mimetype_proto_rawDesc = []byte{ - 0x0a, 0x1a, 0x6d, 0x69, 0x6d, 0x65, 0x74, 0x79, 0x70, 0x65, 0x2f, 0x76, 0x31, 0x2f, 0x6d, 0x69, - 0x6d, 0x65, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0b, 0x6d, 0x69, - 0x6d, 0x65, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x76, 0x31, 0x1a, 0x19, 0x6d, 0x69, 0x6d, 0x65, 0x74, - 0x79, 0x70, 0x65, 0x2f, 0x76, 0x31, 0x2f, 0x63, 0x68, 0x61, 0x72, 0x73, 0x65, 0x74, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x61, 0x0a, 0x08, 0x4d, 0x69, 0x6d, 0x65, 0x74, 0x79, 0x70, 0x65, - 0x12, 0x25, 0x0a, 0x04, 0x6d, 0x69, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x11, - 0x2e, 0x6d, 0x69, 0x6d, 0x65, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x49, 0x4d, - 0x45, 0x52, 0x04, 0x6d, 0x69, 0x6d, 0x65, 0x12, 0x2e, 0x0a, 0x07, 0x63, 0x68, 0x61, 0x72, 0x73, - 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x14, 0x2e, 0x6d, 0x69, 0x6d, 0x65, 0x74, - 0x79, 0x70, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x68, 0x61, 0x72, 0x53, 0x65, 0x74, 0x52, 0x07, - 0x63, 0x68, 0x61, 0x72, 0x73, 0x65, 0x74, 0x2a, 0xdc, 0x05, 0x0a, 0x04, 0x4d, 0x49, 0x4d, 0x45, - 0x12, 0x0f, 0x0a, 0x0b, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, - 0x00, 0x12, 0x0b, 0x0a, 0x07, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x0e, - 0x0a, 0x0a, 0x54, 0x45, 0x58, 0x54, 0x5f, 0x50, 0x4c, 0x41, 0x49, 0x4e, 0x10, 0x01, 0x12, 0x0c, - 0x0a, 0x08, 0x54, 0x45, 0x58, 0x54, 0x5f, 0x43, 0x53, 0x56, 0x10, 0x02, 0x12, 0x0d, 0x0a, 0x09, - 0x54, 0x45, 0x58, 0x54, 0x5f, 0x48, 0x54, 0x4d, 0x4c, 0x10, 0x03, 0x12, 0x11, 0x0a, 0x0d, 0x54, - 0x45, 0x58, 0x54, 0x5f, 0x43, 0x41, 0x4c, 0x45, 0x4e, 0x44, 0x41, 0x52, 0x10, 0x04, 0x12, 0x1c, - 0x0a, 0x18, 0x41, 0x50, 0x50, 0x4c, 0x49, 0x43, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x4f, 0x43, - 0x54, 0x45, 0x54, 0x5f, 0x53, 0x54, 0x52, 0x45, 0x41, 0x4d, 0x10, 0x00, 0x12, 0x14, 0x0a, 0x10, - 0x41, 0x50, 0x50, 0x4c, 0x49, 0x43, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x4a, 0x53, 0x4f, 0x4e, - 0x10, 0x32, 0x12, 0x19, 0x0a, 0x15, 0x41, 0x50, 0x50, 0x4c, 0x49, 0x43, 0x41, 0x54, 0x49, 0x4f, - 0x4e, 0x5f, 0x4a, 0x53, 0x4f, 0x4e, 0x5f, 0x55, 0x54, 0x46, 0x38, 0x10, 0x32, 0x12, 0x17, 0x0a, - 0x13, 0x41, 0x50, 0x50, 0x4c, 0x49, 0x43, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x4a, 0x53, 0x4f, - 0x4e, 0x5f, 0x4c, 0x44, 0x10, 0x33, 0x12, 0x1a, 0x0a, 0x16, 0x41, 0x50, 0x50, 0x4c, 0x49, 0x43, - 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x4a, 0x53, 0x4f, 0x4e, 0x5f, 0x4c, 0x49, 0x4e, 0x45, 0x53, - 0x10, 0x34, 0x12, 0x16, 0x0a, 0x12, 0x41, 0x50, 0x50, 0x4c, 0x49, 0x43, 0x41, 0x54, 0x49, 0x4f, - 0x4e, 0x5f, 0x55, 0x42, 0x4a, 0x53, 0x4f, 0x4e, 0x10, 0x35, 0x12, 0x14, 0x0a, 0x10, 0x41, 0x50, - 0x50, 0x4c, 0x49, 0x43, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x42, 0x53, 0x4f, 0x4e, 0x10, 0x36, - 0x12, 0x13, 0x0a, 0x0f, 0x41, 0x50, 0x50, 0x4c, 0x49, 0x43, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, - 0x58, 0x4d, 0x4c, 0x10, 0x64, 0x12, 0x14, 0x0a, 0x10, 0x41, 0x50, 0x50, 0x4c, 0x49, 0x43, 0x41, - 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x41, 0x54, 0x4f, 0x4d, 0x10, 0x65, 0x12, 0x18, 0x0a, 0x13, 0x41, - 0x50, 0x50, 0x4c, 0x49, 0x43, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x4d, 0x53, 0x47, 0x50, 0x41, - 0x43, 0x4b, 0x10, 0xfc, 0x01, 0x12, 0x18, 0x0a, 0x13, 0x41, 0x50, 0x50, 0x4c, 0x49, 0x43, 0x41, - 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x50, 0x41, 0x52, 0x51, 0x55, 0x45, 0x54, 0x10, 0xfd, 0x01, 0x12, - 0x15, 0x0a, 0x10, 0x41, 0x50, 0x50, 0x4c, 0x49, 0x43, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x41, - 0x56, 0x52, 0x4f, 0x10, 0xfe, 0x01, 0x12, 0x19, 0x0a, 0x14, 0x41, 0x50, 0x50, 0x4c, 0x49, 0x43, - 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x50, 0x52, 0x4f, 0x54, 0x4f, 0x42, 0x55, 0x46, 0x10, 0xff, - 0x01, 0x12, 0x14, 0x0a, 0x0f, 0x41, 0x50, 0x50, 0x4c, 0x49, 0x43, 0x41, 0x54, 0x49, 0x4f, 0x4e, - 0x5f, 0x50, 0x44, 0x46, 0x10, 0x80, 0x04, 0x12, 0x1d, 0x0a, 0x18, 0x41, 0x50, 0x50, 0x4c, 0x49, - 0x43, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x4a, 0x41, 0x56, 0x41, 0x5f, 0x41, 0x52, 0x43, 0x48, - 0x49, 0x56, 0x45, 0x10, 0x81, 0x04, 0x12, 0x1e, 0x0a, 0x19, 0x41, 0x50, 0x50, 0x4c, 0x49, 0x43, - 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x50, 0x59, 0x54, 0x48, 0x4f, 0x4e, 0x5f, 0x50, 0x49, 0x43, - 0x4b, 0x4c, 0x45, 0x10, 0x82, 0x04, 0x12, 0x14, 0x0a, 0x0f, 0x55, 0x53, 0x45, 0x52, 0x5f, 0x53, - 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x30, 0x10, 0xe8, 0x07, 0x12, 0x14, 0x0a, 0x0f, - 0x55, 0x53, 0x45, 0x52, 0x5f, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x31, 0x10, - 0xe9, 0x07, 0x12, 0x14, 0x0a, 0x0f, 0x55, 0x53, 0x45, 0x52, 0x5f, 0x53, 0x50, 0x45, 0x43, 0x49, - 0x46, 0x49, 0x45, 0x44, 0x32, 0x10, 0xea, 0x07, 0x12, 0x14, 0x0a, 0x0f, 0x55, 0x53, 0x45, 0x52, - 0x5f, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x33, 0x10, 0xeb, 0x07, 0x12, 0x14, - 0x0a, 0x0f, 0x55, 0x53, 0x45, 0x52, 0x5f, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, - 0x34, 0x10, 0xec, 0x07, 0x12, 0x14, 0x0a, 0x0f, 0x55, 0x53, 0x45, 0x52, 0x5f, 0x53, 0x50, 0x45, - 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x35, 0x10, 0xed, 0x07, 0x12, 0x14, 0x0a, 0x0f, 0x55, 0x53, - 0x45, 0x52, 0x5f, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x36, 0x10, 0xee, 0x07, - 0x12, 0x14, 0x0a, 0x0f, 0x55, 0x53, 0x45, 0x52, 0x5f, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, - 0x45, 0x44, 0x37, 0x10, 0xef, 0x07, 0x12, 0x14, 0x0a, 0x0f, 0x55, 0x53, 0x45, 0x52, 0x5f, 0x53, - 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x38, 0x10, 0xf0, 0x07, 0x12, 0x14, 0x0a, 0x0f, - 0x55, 0x53, 0x45, 0x52, 0x5f, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x39, 0x10, - 0xf1, 0x07, 0x1a, 0x02, 0x10, 0x01, 0x42, 0x27, 0x5a, 0x25, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, - 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x72, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x69, - 0x6f, 0x2f, 0x68, 0x6f, 0x6e, 0x75, 0x2f, 0x6d, 0x69, 0x6d, 0x65, 0x74, 0x79, 0x70, 0x65, 0x62, - 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_mimetype_v1_mimetype_proto_rawDescOnce sync.Once - file_mimetype_v1_mimetype_proto_rawDescData = file_mimetype_v1_mimetype_proto_rawDesc -) - -func file_mimetype_v1_mimetype_proto_rawDescGZIP() []byte { - file_mimetype_v1_mimetype_proto_rawDescOnce.Do(func() { - file_mimetype_v1_mimetype_proto_rawDescData = protoimpl.X.CompressGZIP(file_mimetype_v1_mimetype_proto_rawDescData) - }) - return file_mimetype_v1_mimetype_proto_rawDescData -} - -var file_mimetype_v1_mimetype_proto_enumTypes = make([]protoimpl.EnumInfo, 1) -var file_mimetype_v1_mimetype_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_mimetype_v1_mimetype_proto_goTypes = []interface{}{ - (MIME)(0), // 0: mimetype.v1.MIME - (*Mimetype)(nil), // 1: mimetype.v1.Mimetype - (CharSet)(0), // 2: mimetype.v1.CharSet -} -var file_mimetype_v1_mimetype_proto_depIdxs = []int32{ - 0, // 0: mimetype.v1.Mimetype.mime:type_name -> mimetype.v1.MIME - 2, // 1: mimetype.v1.Mimetype.charset:type_name -> mimetype.v1.CharSet - 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 -} - -func init() { file_mimetype_v1_mimetype_proto_init() } -func file_mimetype_v1_mimetype_proto_init() { - if File_mimetype_v1_mimetype_proto != nil { - return - } - file_mimetype_v1_charset_proto_init() - if !protoimpl.UnsafeEnabled { - file_mimetype_v1_mimetype_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Mimetype); 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_mimetype_v1_mimetype_proto_rawDesc, - NumEnums: 1, - NumMessages: 1, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_mimetype_v1_mimetype_proto_goTypes, - DependencyIndexes: file_mimetype_v1_mimetype_proto_depIdxs, - EnumInfos: file_mimetype_v1_mimetype_proto_enumTypes, - MessageInfos: file_mimetype_v1_mimetype_proto_msgTypes, - }.Build() - File_mimetype_v1_mimetype_proto = out.File - file_mimetype_v1_mimetype_proto_rawDesc = nil - file_mimetype_v1_mimetype_proto_goTypes = nil - file_mimetype_v1_mimetype_proto_depIdxs = nil -} diff --git a/object/generate.go b/object/generate.go deleted file mode 100644 index 16281af..0000000 --- a/object/generate.go +++ /dev/null @@ -1,3 +0,0 @@ -package object - -//go:generate bash generate.sh diff --git a/object/generate.sh b/object/generate.sh deleted file mode 100644 index e65a6a4..0000000 --- a/object/generate.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash - -PROTOS="${GOPATH}/src/github.com/rotationalio/honu/proto" - -if [[ ! -d $PROTOS ]]; then - echo "cannot find ${PROTOS}" - exit 1 -fi - -if [[ ! -d "./v1" ]]; then - mkdir v1 -fi - -MODULE="github.com/rotationalio/honu/object/v1" -MOD="github.com/rotationalio/honu/object/v1;object" - -# Generate the protocol buffers -protoc -I=${PROTOS} \ - --go_out=./v1 \ - --go_opt=module=${MODULE} \ - --go_opt=Mobject/v1/object.proto="${MOD}" \ - object/v1/object.proto \ No newline at end of file diff --git a/object/v1/object.go b/object/v1/object.go deleted file mode 100644 index 352be02..0000000 --- a/object/v1/object.go +++ /dev/null @@ -1,132 +0,0 @@ -package object - -import ( - "time" - - "google.golang.org/protobuf/types/known/timestamppb" -) - -var VersionZero = Version{} - -// Tombstone returns true if the version of the object is a Tombstone (for a deleted object) -func (o *Object) Tombstone() bool { - if o.Version == nil { - panic("object improperly initialized without version") - } - return o.Version.Tombstone -} - -func (o *Object) CreatedAt() time.Time { - return o.Created.AsTime() -} - -func (o *Object) ModifiedAt() time.Time { - if o.Version == nil { - panic("object improperly initialized without version") - } - return o.Version.Modified.AsTime() -} - -// IsZero determines if the version is zero valued (e.g. the PID and Version are zero). -// Note that zero-valuation does not check parent or region. -func (v *Version) IsZero() bool { - return v.Pid == 0 && v.Version == 0 -} - -// IsLater returns true if the specified version is later than the other version. It -// returns false if the other version is later or equal to the specified version. If -// other is nil, it is considered equivalent to the zero-valued version. -// -// Versions are Lamport Scalars composed of a monotonically increasing scalar component -// along with a tiebreaking component called the PID (the process ID of a replica). If -// the scalar is greater than the other scaler, then the Version is later. If the -// scalars are equal, then the version with the lower PID has higher precedence. -// Versions are conflict free so long as the processes that increment the scalar have a -// unique PID. E.g. if two processes concurrently increment the scalar to the same value -// then unique PIDs guarantee that one of those processes will have precedence. Lower -// PIDs are used for the higher precedence because of the PIDs are assigned in -// increasing order, then the lower PIDs are older replicas. -func (v *Version) IsLater(other *Version) bool { - // If other is nil, then we assume it represents the zero-valued version. - if other == nil { - other = &VersionZero - } - - // Version is monotonically increasing, if it's greater than the other, then this - // version is later than the other. - if v.Version > other.Version { - return true - } - - // If the versions are equal, then the version with the lower PID has higher precedence - if v.Version == other.Version && v.Pid < other.Pid { - return true - } - - // Either v.Version < other.Version, other.Pid > v.Pid, or the versions are equal. - return false -} - -// Equal returns true if and only if the Version scalars and PIDs are equal. Nil is -// considered to be the zero valued Version. -func (v *Version) Equal(other *Version) bool { - // If other is nil, then we assume it represents the zero-valued version. - if other == nil { - other = &VersionZero - } - return v.Version == other.Version && v.Pid == other.Pid -} - -// Concurrent returns true if and only if the Version scalars are equal but the PIDs are -// not equal. Nil is considered to be the zero valued Version. -func (v *Version) Concurrent(other *Version) bool { - // If other is nil, then we assume it represents the zero-valued version. - if other == nil { - other = &VersionZero - } - return v.Version == other.Version && v.Pid != other.Pid -} - -// LinearFrom returns true if and only if the the parent of this version is equal to the -// other version. E.g. is this version created from the other version (a child of). -// LinearFrom implies that this version is later than the other version so long as the -// child is always later than the parent version. -// -// NOTE: this method cannot detect a linear chain through multiple ancestors to the -// current version - it is a direct relationship only. A complete version history is -// required to compute a longer linear chain and branch points. -func (v *Version) LinearFrom(other *Version) bool { - // Handle the case of the root version (no parent) - if v.Parent == nil { - return other == nil || other.IsZero() - } - return v.Parent.Equal(other) -} - -// Stomps returns true if and only if this version is both concurrent and later than the -// other version; e.g. this version is concurrent and would have precedence. -func (v *Version) Stomps(other *Version) bool { - return v.Concurrent(other) && v.IsLater(other) -} - -// Skips returns true if and only if this version is later, is not concurrent (e.g. is -// not a stomp) and is not linear from the other version, e.g. this version is at least -// one version farther in the version history than the other version. Skips does not -// imply a stomp, though a stomp is possible in the version chain between the skip. -// Skips really mean that the replica does not have enough information to determine if -// a stomp has occurred or if we've just moved forward in a linear chain. -func (v *Version) Skips(other *Version) bool { - return v.IsLater(other) && !v.Concurrent(other) && !v.LinearFrom(other) -} - -// Copies the child's attributes before updating to the parent. -func (v *Version) Clone() *Version { - parent := &Version{ - Pid: v.Pid, - Version: v.Version, - Region: v.Region, - Tombstone: v.Tombstone, - Modified: timestamppb.New(v.Modified.AsTime()), - } - return parent -} diff --git a/object/v1/object.pb.go b/object/v1/object.pb.go deleted file mode 100644 index bf8a93b..0000000 --- a/object/v1/object.pb.go +++ /dev/null @@ -1,343 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.34.1 -// protoc v5.26.1 -// source: object/v1/object.proto - -package object - -import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - timestamppb "google.golang.org/protobuf/types/known/timestamppb" - 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) -) - -// An Object is a generic representation of a replicated piece of data. At the top level -// it contains enough metadata in order to detect changes during anti-entropy, -// specifically, given two objects, which is the later object (or does it need to be -// created or deleted). When used in VersionVectors only the metadata of the object is -// supplied. When passed via Updates, then the full data of the object is populated. -// -// For research purposes, this anti-entropy mechanism tracks the region and owner of -// each object to determine provinence and global interactions. Because this is side -// channel information that may not necessarily be stored with the object data, it is -// recommended that an objects table be kept for fast lookups of object versions. -// Additionally, it is recommended that a history table be maintained locally so that -// Object versions can be rolled back to previous states where necessary. -type Object struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The object metadata that must be populated on both VersionVectors and Updates - Key []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` // A unique key/id that represents the object across the namespace of the object type - Namespace string `protobuf:"bytes,2,opt,name=namespace,proto3" json:"namespace,omitempty"` // The namespace of the object, used to disambiguate keys or different object types - Version *Version `protobuf:"bytes,3,opt,name=version,proto3" json:"version,omitempty"` // A version vector representing this objects current or latest version - Region string `protobuf:"bytes,4,opt,name=region,proto3" json:"region,omitempty"` // The region code where the data originated - Owner string `protobuf:"bytes,5,opt,name=owner,proto3" json:"owner,omitempty"` // The replica that created the object (identified as "pid:name" if name exists) - // The object data that is only populated on Updates. - Data []byte `protobuf:"bytes,10,opt,name=data,proto3" json:"data,omitempty"` - // The timestamp that the object was created (modified timestamps are on versions). - Created *timestamppb.Timestamp `protobuf:"bytes,15,opt,name=created,proto3" json:"created,omitempty"` -} - -func (x *Object) Reset() { - *x = Object{} - if protoimpl.UnsafeEnabled { - mi := &file_object_v1_object_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Object) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Object) ProtoMessage() {} - -func (x *Object) ProtoReflect() protoreflect.Message { - mi := &file_object_v1_object_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) -} - -// Deprecated: Use Object.ProtoReflect.Descriptor instead. -func (*Object) Descriptor() ([]byte, []int) { - return file_object_v1_object_proto_rawDescGZIP(), []int{0} -} - -func (x *Object) GetKey() []byte { - if x != nil { - return x.Key - } - return nil -} - -func (x *Object) GetNamespace() string { - if x != nil { - return x.Namespace - } - return "" -} - -func (x *Object) GetVersion() *Version { - if x != nil { - return x.Version - } - return nil -} - -func (x *Object) GetRegion() string { - if x != nil { - return x.Region - } - return "" -} - -func (x *Object) GetOwner() string { - if x != nil { - return x.Owner - } - return "" -} - -func (x *Object) GetData() []byte { - if x != nil { - return x.Data - } - return nil -} - -func (x *Object) GetCreated() *timestamppb.Timestamp { - if x != nil { - return x.Created - } - return nil -} - -// Implements a geo-distributed version as a Lamport Scalar -type Version struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Pid uint64 `protobuf:"varint,1,opt,name=pid,proto3" json:"pid,omitempty"` // Process ID - used to deconflict ties in the version number. - Version uint64 `protobuf:"varint,2,opt,name=version,proto3" json:"version,omitempty"` // Montonically increasing version number. - Region string `protobuf:"bytes,3,opt,name=region,proto3" json:"region,omitempty"` // The region where the change occurred to track multi-region handling. - Parent *Version `protobuf:"bytes,4,opt,name=parent,proto3" json:"parent,omitempty"` // In order to get a complete version history, identify the predessor; for compact data transfer parent should not be defined in parent version. - Tombstone bool `protobuf:"varint,5,opt,name=tombstone,proto3" json:"tombstone,omitempty"` // Set to true in order to mark the object as deleted - // The timestamp that the version was created (e.g. the last modified date). - Modified *timestamppb.Timestamp `protobuf:"bytes,15,opt,name=modified,proto3" json:"modified,omitempty"` -} - -func (x *Version) Reset() { - *x = Version{} - if protoimpl.UnsafeEnabled { - mi := &file_object_v1_object_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Version) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Version) ProtoMessage() {} - -func (x *Version) ProtoReflect() protoreflect.Message { - mi := &file_object_v1_object_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) -} - -// Deprecated: Use Version.ProtoReflect.Descriptor instead. -func (*Version) Descriptor() ([]byte, []int) { - return file_object_v1_object_proto_rawDescGZIP(), []int{1} -} - -func (x *Version) GetPid() uint64 { - if x != nil { - return x.Pid - } - return 0 -} - -func (x *Version) GetVersion() uint64 { - if x != nil { - return x.Version - } - return 0 -} - -func (x *Version) GetRegion() string { - if x != nil { - return x.Region - } - return "" -} - -func (x *Version) GetParent() *Version { - if x != nil { - return x.Parent - } - return nil -} - -func (x *Version) GetTombstone() bool { - if x != nil { - return x.Tombstone - } - return false -} - -func (x *Version) GetModified() *timestamppb.Timestamp { - if x != nil { - return x.Modified - } - return nil -} - -var File_object_v1_object_proto protoreflect.FileDescriptor - -var file_object_v1_object_proto_rawDesc = []byte{ - 0x0a, 0x16, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2f, 0x76, 0x31, 0x2f, 0x6f, 0x62, 0x6a, 0x65, - 0x63, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0e, 0x68, 0x6f, 0x6e, 0x75, 0x2e, 0x6f, - 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x76, 0x31, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, - 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, - 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xe3, 0x01, 0x0a, 0x06, 0x4f, 0x62, - 0x6a, 0x65, 0x63, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0c, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x1c, 0x0a, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, - 0x61, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, - 0x70, 0x61, 0x63, 0x65, 0x12, 0x31, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x68, 0x6f, 0x6e, 0x75, 0x2e, 0x6f, 0x62, 0x6a, - 0x65, 0x63, 0x74, 0x2e, 0x76, 0x31, 0x2e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x07, - 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x72, 0x65, 0x67, 0x69, 0x6f, - 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x72, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x12, - 0x14, 0x0a, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, - 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x0a, 0x20, - 0x01, 0x28, 0x0c, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x12, 0x34, 0x0a, 0x07, 0x63, 0x72, 0x65, - 0x61, 0x74, 0x65, 0x64, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, - 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, - 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x07, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x22, - 0xd4, 0x01, 0x0a, 0x07, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x10, 0x0a, 0x03, 0x70, - 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x03, 0x70, 0x69, 0x64, 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, 0x16, 0x0a, 0x06, 0x72, 0x65, 0x67, 0x69, 0x6f, - 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x72, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x12, - 0x2f, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x17, 0x2e, 0x68, 0x6f, 0x6e, 0x75, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x76, 0x31, - 0x2e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x06, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, - 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x6f, 0x6d, 0x62, 0x73, 0x74, 0x6f, 0x6e, 0x65, 0x18, 0x05, 0x20, - 0x01, 0x28, 0x08, 0x52, 0x09, 0x74, 0x6f, 0x6d, 0x62, 0x73, 0x74, 0x6f, 0x6e, 0x65, 0x12, 0x36, - 0x0a, 0x08, 0x6d, 0x6f, 0x64, 0x69, 0x66, 0x69, 0x65, 0x64, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, - 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x08, 0x6d, 0x6f, - 0x64, 0x69, 0x66, 0x69, 0x65, 0x64, 0x42, 0x25, 0x5a, 0x23, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, - 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x72, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x69, - 0x6f, 0x2f, 0x68, 0x6f, 0x6e, 0x75, 0x2f, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x62, 0x06, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_object_v1_object_proto_rawDescOnce sync.Once - file_object_v1_object_proto_rawDescData = file_object_v1_object_proto_rawDesc -) - -func file_object_v1_object_proto_rawDescGZIP() []byte { - file_object_v1_object_proto_rawDescOnce.Do(func() { - file_object_v1_object_proto_rawDescData = protoimpl.X.CompressGZIP(file_object_v1_object_proto_rawDescData) - }) - return file_object_v1_object_proto_rawDescData -} - -var file_object_v1_object_proto_msgTypes = make([]protoimpl.MessageInfo, 2) -var file_object_v1_object_proto_goTypes = []interface{}{ - (*Object)(nil), // 0: honu.object.v1.Object - (*Version)(nil), // 1: honu.object.v1.Version - (*timestamppb.Timestamp)(nil), // 2: google.protobuf.Timestamp -} -var file_object_v1_object_proto_depIdxs = []int32{ - 1, // 0: honu.object.v1.Object.version:type_name -> honu.object.v1.Version - 2, // 1: honu.object.v1.Object.created:type_name -> google.protobuf.Timestamp - 1, // 2: honu.object.v1.Version.parent:type_name -> honu.object.v1.Version - 2, // 3: honu.object.v1.Version.modified:type_name -> google.protobuf.Timestamp - 4, // [4:4] is the sub-list for method output_type - 4, // [4:4] is the sub-list for method input_type - 4, // [4:4] is the sub-list for extension type_name - 4, // [4:4] is the sub-list for extension extendee - 0, // [0:4] is the sub-list for field type_name -} - -func init() { file_object_v1_object_proto_init() } -func file_object_v1_object_proto_init() { - if File_object_v1_object_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_object_v1_object_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Object); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_object_v1_object_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Version); 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_object_v1_object_proto_rawDesc, - NumEnums: 0, - NumMessages: 2, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_object_v1_object_proto_goTypes, - DependencyIndexes: file_object_v1_object_proto_depIdxs, - MessageInfos: file_object_v1_object_proto_msgTypes, - }.Build() - File_object_v1_object_proto = out.File - file_object_v1_object_proto_rawDesc = nil - file_object_v1_object_proto_goTypes = nil - file_object_v1_object_proto_depIdxs = nil -} diff --git a/options/options.go b/options/options.go deleted file mode 100644 index cf18991..0000000 --- a/options/options.go +++ /dev/null @@ -1,114 +0,0 @@ -package options - -import ( - "github.com/cockroachdb/pebble" - ldb "github.com/syndtr/goleveldb/leveldb/opt" -) - -const ( - NamespaceDefault = "default" -) - -// New creates a per-call Options object based on the variadic SetOptions closures -// supplied by the user. New also sets sensible defaults for various options. -func New(options ...Option) (cfg *Options, err error) { - cfg = &Options{Namespace: NamespaceDefault} - for _, option := range options { - if err = option(cfg); err != nil { - return nil, err - } - } - return cfg, nil -} - -// Contains all available read/write options for the supported engines. Fields are set -// by closures implementing the SetOptions signature. -type Options struct { - LevelDBRead *ldb.ReadOptions - LevelDBWrite *ldb.WriteOptions - PebbleWrite *pebble.WriteOptions - Namespace string - Force bool - Tombstones bool - RequireExists bool - RequireNotExists bool -} - -// Defines the signature of functions accepted as parameters by Honu methods. -type Option func(cfg *Options) error - -// WithNamespace returns a closure that sets a namespace other than the default. -func WithNamespace(namespace string) Option { - return func(cfg *Options) error { - // If namespace is empty, keep default namespace - if namespace != "" { - cfg.Namespace = namespace - } - return nil - } -} - -// WithRequireExists adds an invariants to writes that the key has to exist prior to -// the write operation otherwise the operation will fail with a NotFound error. This is -// a similar semantic to "Update" for Put and is a check to ensure that something was -// removed for Delete. -func WithRequireExists() Option { - return func(cfg *Options) error { - cfg.RequireExists = true - return nil - } -} - -// WithRequireNotExists adds an invariant to writes that the key must not exist prior to -// the write operation otherwise the operation will fail with an AlreadyExists error. -// This is a similar semantic to "Create" for Put and while it has no real meaning for -// Delete, the invariant is still enforced. -func WithRequireNotExists() Option { - return func(cfg *Options) error { - cfg.RequireNotExists = true - return nil - } -} - -// WithForce prevents validation checks from returning an error during accesses. -func WithForce() Option { - return func(cfg *Options) error { - cfg.Force = true - return nil - } -} - -// WithTombstones causes the iterator to include tombstones as its iterating. -func WithTombstones() Option { - return func(cfg *Options) error { - cfg.Tombstones = true - return nil - } -} - -// Closure returning a function that adds the leveldbRead -// parameter to an Options struct's LeveldbRead field. -func WithLevelDBRead(opts *ldb.ReadOptions) Option { - return func(cfg *Options) error { - cfg.LevelDBRead = opts - return nil - } -} - -// Closure returning a function that adds the leveldbWrite -// parameter to an Options struct's LeveldbWrite field. -func WithLevelDBWrite(opts *ldb.WriteOptions) Option { - return func(cfg *Options) error { - cfg.LevelDBWrite = opts - return nil - } -} - -// Closure returning a function that adds the pebbleWrite -// parameter to an Options struct's PebbleWrite field. -func WithPebbleWrite(opts *pebble.WriteOptions) Option { - return func(cfg *Options) error { - cfg.PebbleWrite = opts - return nil - } -} diff --git a/options/options_test.go b/options/options_test.go deleted file mode 100644 index 8196894..0000000 --- a/options/options_test.go +++ /dev/null @@ -1,70 +0,0 @@ -package options_test - -import ( - "testing" - - "github.com/cockroachdb/pebble" - "github.com/rotationalio/honu/options" - "github.com/stretchr/testify/require" - ldb "github.com/syndtr/goleveldb/leveldb/opt" -) - -func TestHonuOptions(t *testing.T) { - // Test default options - opts, err := options.New() - require.NoError(t, err, "could not create options") - require.Equal(t, options.NamespaceDefault, opts.Namespace) - require.False(t, opts.Force) - require.False(t, opts.Tombstones) - - // Test setting multiple options - opts, err = options.New(options.WithLevelDBRead(&ldb.ReadOptions{Strict: ldb.StrictJournal}), options.WithNamespace("foo")) - require.NoError(t, err, "could not create options") - require.Equal(t, "foo", opts.Namespace) - require.NotNil(t, opts.LevelDBRead) - require.Equal(t, ldb.StrictJournal, opts.LevelDBRead.Strict) - - // Ensuring setting empty string namespace still ends up as the default namespace - opts, err = options.New(options.WithNamespace("")) - require.NoError(t, err, "could not create options with empty string namespace") - require.Equal(t, options.NamespaceDefault, opts.Namespace) - - // Test boolean options - opts, err = options.New(options.WithForce(), options.WithTombstones()) - require.NoError(t, err, "boolean options returned an error") - require.True(t, opts.Force) - require.True(t, opts.Tombstones) -} - -func TestLevelDBReadOptions(t *testing.T) { - readOptions := &ldb.ReadOptions{ - DontFillCache: true, - Strict: 1, - } - cfg := &options.Options{} - ldbReadFunc := options.WithLevelDBRead(readOptions) - ldbReadFunc(cfg) - require.Equal(t, cfg.LevelDBRead, readOptions) -} - -func TestLevelDBWriteOptions(t *testing.T) { - writeOptions := &ldb.WriteOptions{ - NoWriteMerge: true, - Sync: true, - } - cfg := &options.Options{} - ldbWriteFunc := options.WithLevelDBWrite(writeOptions) - ldbWriteFunc(cfg) - require.Equal(t, cfg.LevelDBWrite, writeOptions) - -} - -func TestPebbleWriteOptions(t *testing.T) { - writeOptions := &pebble.WriteOptions{ - Sync: true, - } - cfg := &options.Options{} - pebbleWriteFunc := options.WithPebbleWrite(writeOptions) - pebbleWriteFunc(cfg) - require.Equal(t, cfg.PebbleWrite, writeOptions) -} diff --git a/pagination/generate.go b/pagination/generate.go deleted file mode 100644 index dfbff06..0000000 --- a/pagination/generate.go +++ /dev/null @@ -1,3 +0,0 @@ -package pagination - -//go:generate bash generate.sh diff --git a/pagination/generate.sh b/pagination/generate.sh deleted file mode 100644 index c5c8a63..0000000 --- a/pagination/generate.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash - -PROTOS="${GOPATH}/src/github.com/rotationalio/honu/proto" - -if [[ ! -d $PROTOS ]]; then - echo "cannot find ${PROTOS}" - exit 1 -fi - -if [[ ! -d "./v1" ]]; then - mkdir v1 -fi - -MODULE="github.com/rotationalio/honu/pagination/v1" -MOD="github.com/rotationalio/honu/pagination/v1;pagination" - -# Generate the protocol buffers -protoc -I=${PROTOS} \ - --go_out=./v1 \ - --go_opt=module=${MODULE} \ - --go_opt=Mpagination/v1/pagination.proto="${MOD}" \ - pagination/v1/pagination.proto \ No newline at end of file diff --git a/pagination/v1/pagination.go b/pagination/v1/pagination.go deleted file mode 100644 index d299c92..0000000 --- a/pagination/v1/pagination.go +++ /dev/null @@ -1,88 +0,0 @@ -package pagination - -import ( - "encoding/base64" - "errors" - "time" - - "google.golang.org/protobuf/proto" - "google.golang.org/protobuf/types/known/timestamppb" -) - -const ( - DefaultPageSize int32 = 100 - MaximumPageSize int32 = 5000 - CursorDuration = 24 * time.Hour -) - -var ( - ErrMissingExpiration = errors.New("cursor does not have an expires timestamp") - ErrCursorExpired = errors.New("cursor has expired and is no longer useable") - ErrUnparsableToken = errors.New("could not parse the next page token") - ErrTokenQueryMismatch = errors.New("cannot change query parameters during pagination") -) - -func New(nextKey []byte, namespace string, pageSize int32) *PageCursor { - if pageSize == 0 { - pageSize = DefaultPageSize - } - - return &PageCursor{ - PageSize: pageSize, - NextKey: nextKey, - Namespace: namespace, - Expires: timestamppb.New(time.Now().Add(CursorDuration)), - } -} - -func Parse(token string) (cursor *PageCursor, err error) { - var data []byte - if data, err = base64.RawURLEncoding.DecodeString(token); err != nil { - return nil, ErrUnparsableToken - } - - cursor = &PageCursor{} - if err = proto.Unmarshal(data, cursor); err != nil { - return nil, ErrUnparsableToken - } - - var expired bool - if expired, err = cursor.HasExpired(); err != nil { - return nil, err - } - - if expired { - return nil, ErrCursorExpired - } - - return cursor, nil -} - -func (c *PageCursor) NextPageToken() (_ string, err error) { - var expired bool - if expired, err = c.HasExpired(); err != nil { - return "", err - } - - if expired { - return "", ErrCursorExpired - } - - var data []byte - if data, err = proto.Marshal(c); err != nil { - return "", err - } - - return base64.RawURLEncoding.EncodeToString(data), nil -} - -func (c *PageCursor) HasExpired() (bool, error) { - if c.Expires == nil { - return false, ErrMissingExpiration - } - return time.Now().After(c.Expires.AsTime()), nil -} - -func (c *PageCursor) IsZero() bool { - return c.PageSize == 0 && len(c.NextKey) == 0 && c.Namespace == "" && (c.Expires == nil || c.Expires.AsTime().IsZero()) -} diff --git a/pagination/v1/pagination.pb.go b/pagination/v1/pagination.pb.go deleted file mode 100644 index 7c419ce..0000000 --- a/pagination/v1/pagination.pb.go +++ /dev/null @@ -1,192 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.34.1 -// protoc v5.26.1 -// source: pagination/v1/pagination.proto - -package pagination - -import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - timestamppb "google.golang.org/protobuf/types/known/timestamppb" - 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) -) - -// Implements a protocol buffer struct for state managed pagination. This struct will be -// marshaled into a url-safe base64 encoded string and sent to the user as the -// next_page_token. The server should decode this struct to determine where to continue -// iteration for the next page. Note that the server should check to make sure the page -// size in the cursor matches the page size in the request. -// See https://cloud.google.com/apis/design/design_patterns#list_pagination for more. -type PageCursor struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The number of results returned on each iteration. - PageSize int32 `protobuf:"varint,1,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` - // The key to start the iteration from for forward iteration (e.g. the seek key). - NextKey []byte `protobuf:"bytes,2,opt,name=next_key,json=nextKey,proto3" json:"next_key,omitempty"` - // The namespace the cursor is iterating on - Namespace string `protobuf:"bytes,3,opt,name=namespace,proto3" json:"namespace,omitempty"` - // The timestamp when the cursor is no longer valid. - Expires *timestamppb.Timestamp `protobuf:"bytes,4,opt,name=expires,proto3" json:"expires,omitempty"` -} - -func (x *PageCursor) Reset() { - *x = PageCursor{} - if protoimpl.UnsafeEnabled { - mi := &file_pagination_v1_pagination_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PageCursor) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PageCursor) ProtoMessage() {} - -func (x *PageCursor) ProtoReflect() protoreflect.Message { - mi := &file_pagination_v1_pagination_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) -} - -// Deprecated: Use PageCursor.ProtoReflect.Descriptor instead. -func (*PageCursor) Descriptor() ([]byte, []int) { - return file_pagination_v1_pagination_proto_rawDescGZIP(), []int{0} -} - -func (x *PageCursor) GetPageSize() int32 { - if x != nil { - return x.PageSize - } - return 0 -} - -func (x *PageCursor) GetNextKey() []byte { - if x != nil { - return x.NextKey - } - return nil -} - -func (x *PageCursor) GetNamespace() string { - if x != nil { - return x.Namespace - } - return "" -} - -func (x *PageCursor) GetExpires() *timestamppb.Timestamp { - if x != nil { - return x.Expires - } - return nil -} - -var File_pagination_v1_pagination_proto protoreflect.FileDescriptor - -var file_pagination_v1_pagination_proto_rawDesc = []byte{ - 0x0a, 0x1e, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x76, 0x31, 0x2f, - 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x12, 0x12, 0x68, 0x6f, 0x6e, 0x75, 0x2e, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x2e, 0x76, 0x31, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x98, 0x01, 0x0a, 0x0a, 0x50, 0x61, 0x67, 0x65, 0x43, 0x75, - 0x72, 0x73, 0x6f, 0x72, 0x12, 0x1b, 0x0a, 0x09, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x73, 0x69, 0x7a, - 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x70, 0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, - 0x65, 0x12, 0x19, 0x0a, 0x08, 0x6e, 0x65, 0x78, 0x74, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x0c, 0x52, 0x07, 0x6e, 0x65, 0x78, 0x74, 0x4b, 0x65, 0x79, 0x12, 0x1c, 0x0a, 0x09, - 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x12, 0x34, 0x0a, 0x07, 0x65, 0x78, - 0x70, 0x69, 0x72, 0x65, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, - 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, - 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x07, 0x65, 0x78, 0x70, 0x69, 0x72, 0x65, 0x73, - 0x42, 0x29, 0x5a, 0x27, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x72, - 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x69, 0x6f, 0x2f, 0x68, 0x6f, 0x6e, 0x75, - 0x2f, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x33, -} - -var ( - file_pagination_v1_pagination_proto_rawDescOnce sync.Once - file_pagination_v1_pagination_proto_rawDescData = file_pagination_v1_pagination_proto_rawDesc -) - -func file_pagination_v1_pagination_proto_rawDescGZIP() []byte { - file_pagination_v1_pagination_proto_rawDescOnce.Do(func() { - file_pagination_v1_pagination_proto_rawDescData = protoimpl.X.CompressGZIP(file_pagination_v1_pagination_proto_rawDescData) - }) - return file_pagination_v1_pagination_proto_rawDescData -} - -var file_pagination_v1_pagination_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_pagination_v1_pagination_proto_goTypes = []interface{}{ - (*PageCursor)(nil), // 0: honu.pagination.v1.PageCursor - (*timestamppb.Timestamp)(nil), // 1: google.protobuf.Timestamp -} -var file_pagination_v1_pagination_proto_depIdxs = []int32{ - 1, // 0: honu.pagination.v1.PageCursor.expires:type_name -> google.protobuf.Timestamp - 1, // [1:1] is the sub-list for method output_type - 1, // [1:1] is the sub-list for method input_type - 1, // [1:1] is the sub-list for extension type_name - 1, // [1:1] is the sub-list for extension extendee - 0, // [0:1] is the sub-list for field type_name -} - -func init() { file_pagination_v1_pagination_proto_init() } -func file_pagination_v1_pagination_proto_init() { - if File_pagination_v1_pagination_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_pagination_v1_pagination_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PageCursor); 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_pagination_v1_pagination_proto_rawDesc, - NumEnums: 0, - NumMessages: 1, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_pagination_v1_pagination_proto_goTypes, - DependencyIndexes: file_pagination_v1_pagination_proto_depIdxs, - MessageInfos: file_pagination_v1_pagination_proto_msgTypes, - }.Build() - File_pagination_v1_pagination_proto = out.File - file_pagination_v1_pagination_proto_rawDesc = nil - file_pagination_v1_pagination_proto_goTypes = nil - file_pagination_v1_pagination_proto_depIdxs = nil -} diff --git a/pagination/v1/pagination_test.go b/pagination/v1/pagination_test.go deleted file mode 100644 index 88bb557..0000000 --- a/pagination/v1/pagination_test.go +++ /dev/null @@ -1,75 +0,0 @@ -package pagination_test - -import ( - "encoding/base64" - "testing" - "time" - - "github.com/rotationalio/honu/pagination/v1" - "github.com/stretchr/testify/require" - "google.golang.org/protobuf/proto" - "google.golang.org/protobuf/types/known/timestamppb" -) - -func TestPaginationToken(t *testing.T) { - cursor := pagination.New([]byte("foo"), "bar", 0) - token, err := cursor.NextPageToken() - require.NoError(t, err, "could not create next page token") - require.Greater(t, len(token), 32, "the token created above should at least be 32 characters") - require.Less(t, len(token), 64, "the token create above should be less than 64 characters") - - parsed, err := pagination.Parse(token) - require.NoError(t, err, "could not parse token") - require.True(t, proto.Equal(cursor, parsed), "parsed token should match cursor") - - cursor.Expires = nil - _, err = cursor.NextPageToken() - require.ErrorIs(t, err, pagination.ErrMissingExpiration, "should not be able to create a token with no expiration") - - data, err := proto.Marshal(cursor) - require.NoError(t, err, "could not marshal protocol buffers") - token = base64.RawURLEncoding.EncodeToString(data) - _, err = pagination.Parse(token) - require.ErrorIs(t, err, pagination.ErrMissingExpiration, "should not be able to parse a token with no expiration") - - _, err = pagination.Parse("ab") - require.ErrorIs(t, err, pagination.ErrUnparsableToken, "should not be able to parse an invalid token") - - _, err = pagination.Parse(base64.RawStdEncoding.EncodeToString([]byte("badtokendata"))) - require.ErrorIs(t, err, pagination.ErrUnparsableToken, "should not be able to parse an invalid token") - - cursor.Expires = timestamppb.New(time.Now().Add(-5 * time.Minute)) - _, err = cursor.NextPageToken() - require.ErrorIs(t, err, pagination.ErrCursorExpired, "should not be able to create an expired token") - - data, err = proto.Marshal(cursor) - require.NoError(t, err, "could not marshal protocol buffers") - token = base64.RawURLEncoding.EncodeToString(data) - _, err = pagination.Parse(token) - require.ErrorIs(t, err, pagination.ErrCursorExpired, "should not be able to parse an expired token") -} - -func TestPaginationExpired(t *testing.T) { - cursor := &pagination.PageCursor{} - expired, err := cursor.HasExpired() - require.ErrorIs(t, err, pagination.ErrMissingExpiration) - require.False(t, expired, "if err is not nil, expired should be false") - - cursor.Expires = timestamppb.New(time.Now().Add(5 * time.Minute)) - expired, err = cursor.HasExpired() - require.NoError(t, err, "cursor should compute expiration without error") - require.False(t, expired, "cusor should not be expired for 5 minutes") - - cursor.Expires = timestamppb.New(time.Now().Add(-5 * time.Minute)) - expired, err = cursor.HasExpired() - require.NoError(t, err, "cursor should compute expiration without error") - require.True(t, expired, "cusor should have expired 5 minutes ago") -} - -func TestPaginationIsZero(t *testing.T) { - cursor := &pagination.PageCursor{} - require.True(t, cursor.IsZero(), "empty cursor should be zero valued") - - cursor = pagination.New([]byte("foo"), "bar", 0) - require.False(t, cursor.IsZero(), "new cursor should not be zero valued") -} diff --git a/peers/generate.go b/peers/generate.go deleted file mode 100644 index 641e279..0000000 --- a/peers/generate.go +++ /dev/null @@ -1,3 +0,0 @@ -package peers - -//go:generate bash generate.sh diff --git a/peers/generate.sh b/peers/generate.sh deleted file mode 100644 index 76dfeb3..0000000 --- a/peers/generate.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash - -PROTOS="${GOPATH}/src/github.com/rotationalio/honu/proto" - -if [[ ! -d $PROTOS ]]; then - echo "cannot find ${PROTOS}" - exit 1 -fi - -if [[ ! -d "./v1" ]]; then - mkdir v1 -fi - -MODULE="github.com/rotationalio/honu/peers/v1" -APIMOD="github.com/rotationalio/honu/peers/v1;peers" - -# Generate the protocol buffers -protoc -I=${PROTOS} \ - --go_out=./v1 --go-grpc_out=./v1 \ - --go_opt=module=${MODULE} \ - --go-grpc_opt=module=${MODULE} \ - --go_opt=Mpeers/v1/peers.proto="${APIMOD}" \ - --go-grpc_opt=Mpeers/v1/peers.proto="${APIMOD}" \ - peers/v1/peers.proto \ No newline at end of file diff --git a/peers/v1/peers.pb.go b/peers/v1/peers.pb.go deleted file mode 100644 index b8a2d50..0000000 --- a/peers/v1/peers.pb.go +++ /dev/null @@ -1,478 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.34.1 -// protoc v5.26.1 -// source: peers/v1/peers.proto - -package peers - -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) -) - -// Peer contains metadata about how to connect to remote peers in the directory service -// network. This message services as a data-transfer and exchange mechanism for dynamic -// networks with changing membership. -type Peer struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` // the process id of the peer must be unique in the network; used for distributed versions - Addr string `protobuf:"bytes,2,opt,name=addr,proto3" json:"addr,omitempty"` // the network address to connect to the peer on (don't forget the port!) - Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"` // optional - a unique, human readable name for the peer - Region string `protobuf:"bytes,4,opt,name=region,proto3" json:"region,omitempty"` // optional? - the region the peer is running in - // Logging information timestamps - Created string `protobuf:"bytes,9,opt,name=created,proto3" json:"created,omitempty"` - Modified string `protobuf:"bytes,10,opt,name=modified,proto3" json:"modified,omitempty"` - // extra information that might be relevant to process-specific functions; e.g. for - // specific clouds or data that's been parsed (optional). - Extra map[string]string `protobuf:"bytes,14,rep,name=extra,proto3" json:"extra,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` -} - -func (x *Peer) Reset() { - *x = Peer{} - if protoimpl.UnsafeEnabled { - mi := &file_peers_v1_peers_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Peer) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Peer) ProtoMessage() {} - -func (x *Peer) ProtoReflect() protoreflect.Message { - mi := &file_peers_v1_peers_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) -} - -// Deprecated: Use Peer.ProtoReflect.Descriptor instead. -func (*Peer) Descriptor() ([]byte, []int) { - return file_peers_v1_peers_proto_rawDescGZIP(), []int{0} -} - -func (x *Peer) GetId() uint64 { - if x != nil { - return x.Id - } - return 0 -} - -func (x *Peer) GetAddr() string { - if x != nil { - return x.Addr - } - return "" -} - -func (x *Peer) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *Peer) GetRegion() string { - if x != nil { - return x.Region - } - return "" -} - -func (x *Peer) GetCreated() string { - if x != nil { - return x.Created - } - return "" -} - -func (x *Peer) GetModified() string { - if x != nil { - return x.Modified - } - return "" -} - -func (x *Peer) GetExtra() map[string]string { - if x != nil { - return x.Extra - } - return nil -} - -// Used to filter the peers that are returned. If no filters are specified then all -// known peers on the remote replica are returned. -type PeersFilter struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Region []string `protobuf:"bytes,1,rep,name=region,proto3" json:"region,omitempty"` // Specify the region(s) to return the peers for. Only effects PeersList not PeersStatus - StatusOnly bool `protobuf:"varint,2,opt,name=status_only,json=statusOnly,proto3" json:"status_only,omitempty"` // Return only the peers status, not a list of peers. -} - -func (x *PeersFilter) Reset() { - *x = PeersFilter{} - if protoimpl.UnsafeEnabled { - mi := &file_peers_v1_peers_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PeersFilter) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PeersFilter) ProtoMessage() {} - -func (x *PeersFilter) ProtoReflect() protoreflect.Message { - mi := &file_peers_v1_peers_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) -} - -// Deprecated: Use PeersFilter.ProtoReflect.Descriptor instead. -func (*PeersFilter) Descriptor() ([]byte, []int) { - return file_peers_v1_peers_proto_rawDescGZIP(), []int{1} -} - -func (x *PeersFilter) GetRegion() []string { - if x != nil { - return x.Region - } - return nil -} - -func (x *PeersFilter) GetStatusOnly() bool { - if x != nil { - return x.StatusOnly - } - return false -} - -// Returns the list of peers currently known to the replica and its peer management status. -type PeersList struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Peers []*Peer `protobuf:"bytes,1,rep,name=peers,proto3" json:"peers,omitempty"` - Status *PeersStatus `protobuf:"bytes,2,opt,name=status,proto3" json:"status,omitempty"` -} - -func (x *PeersList) Reset() { - *x = PeersList{} - if protoimpl.UnsafeEnabled { - mi := &file_peers_v1_peers_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PeersList) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PeersList) ProtoMessage() {} - -func (x *PeersList) ProtoReflect() protoreflect.Message { - mi := &file_peers_v1_peers_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) -} - -// Deprecated: Use PeersList.ProtoReflect.Descriptor instead. -func (*PeersList) Descriptor() ([]byte, []int) { - return file_peers_v1_peers_proto_rawDescGZIP(), []int{2} -} - -func (x *PeersList) GetPeers() []*Peer { - if x != nil { - return x.Peers - } - return nil -} - -func (x *PeersList) GetStatus() *PeersStatus { - if x != nil { - return x.Status - } - return nil -} - -// A response to a peer management command that describes the current state of the network. -type PeersStatus struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - NetworkSize int64 `protobuf:"varint,1,opt,name=network_size,json=networkSize,proto3" json:"network_size,omitempty"` // The total number of peers known to the replica (including itself) - Regions map[string]int64 `protobuf:"bytes,2,rep,name=regions,proto3" json:"regions,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` // The number of peers known to the replica per known region - LastSynchronization string `protobuf:"bytes,3,opt,name=last_synchronization,json=lastSynchronization,proto3" json:"last_synchronization,omitempty"` // The timestamp of the last synchronization that exchanged data -} - -func (x *PeersStatus) Reset() { - *x = PeersStatus{} - if protoimpl.UnsafeEnabled { - mi := &file_peers_v1_peers_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PeersStatus) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PeersStatus) ProtoMessage() {} - -func (x *PeersStatus) ProtoReflect() protoreflect.Message { - mi := &file_peers_v1_peers_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) -} - -// Deprecated: Use PeersStatus.ProtoReflect.Descriptor instead. -func (*PeersStatus) Descriptor() ([]byte, []int) { - return file_peers_v1_peers_proto_rawDescGZIP(), []int{3} -} - -func (x *PeersStatus) GetNetworkSize() int64 { - if x != nil { - return x.NetworkSize - } - return 0 -} - -func (x *PeersStatus) GetRegions() map[string]int64 { - if x != nil { - return x.Regions - } - return nil -} - -func (x *PeersStatus) GetLastSynchronization() string { - if x != nil { - return x.LastSynchronization - } - return "" -} - -var File_peers_v1_peers_proto protoreflect.FileDescriptor - -var file_peers_v1_peers_proto_rawDesc = []byte{ - 0x0a, 0x14, 0x70, 0x65, 0x65, 0x72, 0x73, 0x2f, 0x76, 0x31, 0x2f, 0x70, 0x65, 0x65, 0x72, 0x73, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0d, 0x68, 0x6f, 0x6e, 0x75, 0x2e, 0x70, 0x65, 0x65, - 0x72, 0x73, 0x2e, 0x76, 0x31, 0x22, 0xfc, 0x01, 0x0a, 0x04, 0x50, 0x65, 0x65, 0x72, 0x12, 0x0e, - 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, - 0x0a, 0x04, 0x61, 0x64, 0x64, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x61, 0x64, - 0x64, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x72, 0x65, 0x67, 0x69, 0x6f, 0x6e, - 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x72, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x12, 0x18, - 0x0a, 0x07, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x07, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x6d, 0x6f, 0x64, 0x69, - 0x66, 0x69, 0x65, 0x64, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6d, 0x6f, 0x64, 0x69, - 0x66, 0x69, 0x65, 0x64, 0x12, 0x34, 0x0a, 0x05, 0x65, 0x78, 0x74, 0x72, 0x61, 0x18, 0x0e, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x68, 0x6f, 0x6e, 0x75, 0x2e, 0x70, 0x65, 0x65, 0x72, 0x73, - 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x2e, 0x45, 0x78, 0x74, 0x72, 0x61, 0x45, 0x6e, - 0x74, 0x72, 0x79, 0x52, 0x05, 0x65, 0x78, 0x74, 0x72, 0x61, 0x1a, 0x38, 0x0a, 0x0a, 0x45, 0x78, - 0x74, 0x72, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 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, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x3a, 0x02, 0x38, 0x01, 0x22, 0x46, 0x0a, 0x0b, 0x50, 0x65, 0x65, 0x72, 0x73, 0x46, 0x69, 0x6c, - 0x74, 0x65, 0x72, 0x12, 0x16, 0x0a, 0x06, 0x72, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, - 0x03, 0x28, 0x09, 0x52, 0x06, 0x72, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x12, 0x1f, 0x0a, 0x0b, 0x73, - 0x74, 0x61, 0x74, 0x75, 0x73, 0x5f, 0x6f, 0x6e, 0x6c, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, - 0x52, 0x0a, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x4f, 0x6e, 0x6c, 0x79, 0x22, 0x6a, 0x0a, 0x09, - 0x50, 0x65, 0x65, 0x72, 0x73, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x29, 0x0a, 0x05, 0x70, 0x65, 0x65, - 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x68, 0x6f, 0x6e, 0x75, 0x2e, - 0x70, 0x65, 0x65, 0x72, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x52, 0x05, 0x70, - 0x65, 0x65, 0x72, 0x73, 0x12, 0x32, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x68, 0x6f, 0x6e, 0x75, 0x2e, 0x70, 0x65, 0x65, 0x72, - 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x73, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, - 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0xe2, 0x01, 0x0a, 0x0b, 0x50, 0x65, 0x65, - 0x72, 0x73, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x21, 0x0a, 0x0c, 0x6e, 0x65, 0x74, 0x77, - 0x6f, 0x72, 0x6b, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, - 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x41, 0x0a, 0x07, 0x72, - 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x68, - 0x6f, 0x6e, 0x75, 0x2e, 0x70, 0x65, 0x65, 0x72, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x65, 0x65, - 0x72, 0x73, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x73, - 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x07, 0x72, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x31, - 0x0a, 0x14, 0x6c, 0x61, 0x73, 0x74, 0x5f, 0x73, 0x79, 0x6e, 0x63, 0x68, 0x72, 0x6f, 0x6e, 0x69, - 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x13, 0x6c, 0x61, - 0x73, 0x74, 0x53, 0x79, 0x6e, 0x63, 0x68, 0x72, 0x6f, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x1a, 0x3a, 0x0a, 0x0c, 0x52, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x73, 0x45, 0x6e, 0x74, 0x72, - 0x79, 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, 0x03, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x32, 0xd1, 0x01, - 0x0a, 0x0e, 0x50, 0x65, 0x65, 0x72, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, - 0x12, 0x42, 0x0a, 0x08, 0x47, 0x65, 0x74, 0x50, 0x65, 0x65, 0x72, 0x73, 0x12, 0x1a, 0x2e, 0x68, - 0x6f, 0x6e, 0x75, 0x2e, 0x70, 0x65, 0x65, 0x72, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x65, 0x65, - 0x72, 0x73, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x1a, 0x18, 0x2e, 0x68, 0x6f, 0x6e, 0x75, 0x2e, - 0x70, 0x65, 0x65, 0x72, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x73, 0x4c, 0x69, - 0x73, 0x74, 0x22, 0x00, 0x12, 0x3d, 0x0a, 0x08, 0x41, 0x64, 0x64, 0x50, 0x65, 0x65, 0x72, 0x73, - 0x12, 0x13, 0x2e, 0x68, 0x6f, 0x6e, 0x75, 0x2e, 0x70, 0x65, 0x65, 0x72, 0x73, 0x2e, 0x76, 0x31, - 0x2e, 0x50, 0x65, 0x65, 0x72, 0x1a, 0x1a, 0x2e, 0x68, 0x6f, 0x6e, 0x75, 0x2e, 0x70, 0x65, 0x65, - 0x72, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x73, 0x53, 0x74, 0x61, 0x74, 0x75, - 0x73, 0x22, 0x00, 0x12, 0x3c, 0x0a, 0x07, 0x52, 0x6d, 0x50, 0x65, 0x65, 0x72, 0x73, 0x12, 0x13, - 0x2e, 0x68, 0x6f, 0x6e, 0x75, 0x2e, 0x70, 0x65, 0x65, 0x72, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x50, - 0x65, 0x65, 0x72, 0x1a, 0x1a, 0x2e, 0x68, 0x6f, 0x6e, 0x75, 0x2e, 0x70, 0x65, 0x65, 0x72, 0x73, - 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x73, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, - 0x00, 0x42, 0x24, 0x5a, 0x22, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, - 0x72, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x69, 0x6f, 0x2f, 0x68, 0x6f, 0x6e, - 0x75, 0x2f, 0x70, 0x65, 0x65, 0x72, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_peers_v1_peers_proto_rawDescOnce sync.Once - file_peers_v1_peers_proto_rawDescData = file_peers_v1_peers_proto_rawDesc -) - -func file_peers_v1_peers_proto_rawDescGZIP() []byte { - file_peers_v1_peers_proto_rawDescOnce.Do(func() { - file_peers_v1_peers_proto_rawDescData = protoimpl.X.CompressGZIP(file_peers_v1_peers_proto_rawDescData) - }) - return file_peers_v1_peers_proto_rawDescData -} - -var file_peers_v1_peers_proto_msgTypes = make([]protoimpl.MessageInfo, 6) -var file_peers_v1_peers_proto_goTypes = []interface{}{ - (*Peer)(nil), // 0: honu.peers.v1.Peer - (*PeersFilter)(nil), // 1: honu.peers.v1.PeersFilter - (*PeersList)(nil), // 2: honu.peers.v1.PeersList - (*PeersStatus)(nil), // 3: honu.peers.v1.PeersStatus - nil, // 4: honu.peers.v1.Peer.ExtraEntry - nil, // 5: honu.peers.v1.PeersStatus.RegionsEntry -} -var file_peers_v1_peers_proto_depIdxs = []int32{ - 4, // 0: honu.peers.v1.Peer.extra:type_name -> honu.peers.v1.Peer.ExtraEntry - 0, // 1: honu.peers.v1.PeersList.peers:type_name -> honu.peers.v1.Peer - 3, // 2: honu.peers.v1.PeersList.status:type_name -> honu.peers.v1.PeersStatus - 5, // 3: honu.peers.v1.PeersStatus.regions:type_name -> honu.peers.v1.PeersStatus.RegionsEntry - 1, // 4: honu.peers.v1.PeerManagement.GetPeers:input_type -> honu.peers.v1.PeersFilter - 0, // 5: honu.peers.v1.PeerManagement.AddPeers:input_type -> honu.peers.v1.Peer - 0, // 6: honu.peers.v1.PeerManagement.RmPeers:input_type -> honu.peers.v1.Peer - 2, // 7: honu.peers.v1.PeerManagement.GetPeers:output_type -> honu.peers.v1.PeersList - 3, // 8: honu.peers.v1.PeerManagement.AddPeers:output_type -> honu.peers.v1.PeersStatus - 3, // 9: honu.peers.v1.PeerManagement.RmPeers:output_type -> honu.peers.v1.PeersStatus - 7, // [7:10] is the sub-list for method output_type - 4, // [4:7] is the sub-list for method input_type - 4, // [4:4] is the sub-list for extension type_name - 4, // [4:4] is the sub-list for extension extendee - 0, // [0:4] is the sub-list for field type_name -} - -func init() { file_peers_v1_peers_proto_init() } -func file_peers_v1_peers_proto_init() { - if File_peers_v1_peers_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_peers_v1_peers_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Peer); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_peers_v1_peers_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PeersFilter); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_peers_v1_peers_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PeersList); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_peers_v1_peers_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PeersStatus); 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_peers_v1_peers_proto_rawDesc, - NumEnums: 0, - NumMessages: 6, - NumExtensions: 0, - NumServices: 1, - }, - GoTypes: file_peers_v1_peers_proto_goTypes, - DependencyIndexes: file_peers_v1_peers_proto_depIdxs, - MessageInfos: file_peers_v1_peers_proto_msgTypes, - }.Build() - File_peers_v1_peers_proto = out.File - file_peers_v1_peers_proto_rawDesc = nil - file_peers_v1_peers_proto_goTypes = nil - file_peers_v1_peers_proto_depIdxs = nil -} diff --git a/peers/v1/peers_grpc.pb.go b/peers/v1/peers_grpc.pb.go deleted file mode 100644 index 0348aad..0000000 --- a/peers/v1/peers_grpc.pb.go +++ /dev/null @@ -1,183 +0,0 @@ -// Code generated by protoc-gen-go-grpc. DO NOT EDIT. -// versions: -// - protoc-gen-go-grpc v1.3.0 -// - protoc v5.26.1 -// source: peers/v1/peers.proto - -package peers - -import ( - context "context" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" -) - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.32.0 or later. -const _ = grpc.SupportPackageIsVersion7 - -const ( - PeerManagement_GetPeers_FullMethodName = "/honu.peers.v1.PeerManagement/GetPeers" - PeerManagement_AddPeers_FullMethodName = "/honu.peers.v1.PeerManagement/AddPeers" - PeerManagement_RmPeers_FullMethodName = "/honu.peers.v1.PeerManagement/RmPeers" -) - -// PeerManagementClient is the client API for PeerManagement service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. -type PeerManagementClient interface { - GetPeers(ctx context.Context, in *PeersFilter, opts ...grpc.CallOption) (*PeersList, error) - AddPeers(ctx context.Context, in *Peer, opts ...grpc.CallOption) (*PeersStatus, error) - RmPeers(ctx context.Context, in *Peer, opts ...grpc.CallOption) (*PeersStatus, error) -} - -type peerManagementClient struct { - cc grpc.ClientConnInterface -} - -func NewPeerManagementClient(cc grpc.ClientConnInterface) PeerManagementClient { - return &peerManagementClient{cc} -} - -func (c *peerManagementClient) GetPeers(ctx context.Context, in *PeersFilter, opts ...grpc.CallOption) (*PeersList, error) { - out := new(PeersList) - err := c.cc.Invoke(ctx, PeerManagement_GetPeers_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *peerManagementClient) AddPeers(ctx context.Context, in *Peer, opts ...grpc.CallOption) (*PeersStatus, error) { - out := new(PeersStatus) - err := c.cc.Invoke(ctx, PeerManagement_AddPeers_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *peerManagementClient) RmPeers(ctx context.Context, in *Peer, opts ...grpc.CallOption) (*PeersStatus, error) { - out := new(PeersStatus) - err := c.cc.Invoke(ctx, PeerManagement_RmPeers_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// PeerManagementServer is the server API for PeerManagement service. -// All implementations must embed UnimplementedPeerManagementServer -// for forward compatibility -type PeerManagementServer interface { - GetPeers(context.Context, *PeersFilter) (*PeersList, error) - AddPeers(context.Context, *Peer) (*PeersStatus, error) - RmPeers(context.Context, *Peer) (*PeersStatus, error) - mustEmbedUnimplementedPeerManagementServer() -} - -// UnimplementedPeerManagementServer must be embedded to have forward compatible implementations. -type UnimplementedPeerManagementServer struct { -} - -func (UnimplementedPeerManagementServer) GetPeers(context.Context, *PeersFilter) (*PeersList, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetPeers not implemented") -} -func (UnimplementedPeerManagementServer) AddPeers(context.Context, *Peer) (*PeersStatus, error) { - return nil, status.Errorf(codes.Unimplemented, "method AddPeers not implemented") -} -func (UnimplementedPeerManagementServer) RmPeers(context.Context, *Peer) (*PeersStatus, error) { - return nil, status.Errorf(codes.Unimplemented, "method RmPeers not implemented") -} -func (UnimplementedPeerManagementServer) mustEmbedUnimplementedPeerManagementServer() {} - -// UnsafePeerManagementServer may be embedded to opt out of forward compatibility for this service. -// Use of this interface is not recommended, as added methods to PeerManagementServer will -// result in compilation errors. -type UnsafePeerManagementServer interface { - mustEmbedUnimplementedPeerManagementServer() -} - -func RegisterPeerManagementServer(s grpc.ServiceRegistrar, srv PeerManagementServer) { - s.RegisterService(&PeerManagement_ServiceDesc, srv) -} - -func _PeerManagement_GetPeers_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(PeersFilter) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(PeerManagementServer).GetPeers(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: PeerManagement_GetPeers_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(PeerManagementServer).GetPeers(ctx, req.(*PeersFilter)) - } - return interceptor(ctx, in, info, handler) -} - -func _PeerManagement_AddPeers_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(Peer) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(PeerManagementServer).AddPeers(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: PeerManagement_AddPeers_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(PeerManagementServer).AddPeers(ctx, req.(*Peer)) - } - return interceptor(ctx, in, info, handler) -} - -func _PeerManagement_RmPeers_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(Peer) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(PeerManagementServer).RmPeers(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: PeerManagement_RmPeers_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(PeerManagementServer).RmPeers(ctx, req.(*Peer)) - } - return interceptor(ctx, in, info, handler) -} - -// PeerManagement_ServiceDesc is the grpc.ServiceDesc for PeerManagement service. -// It's only intended for direct use with grpc.RegisterService, -// and not to be introspected or modified (even as a copy) -var PeerManagement_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "honu.peers.v1.PeerManagement", - HandlerType: (*PeerManagementServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "GetPeers", - Handler: _PeerManagement_GetPeers_Handler, - }, - { - MethodName: "AddPeers", - Handler: _PeerManagement_AddPeers_Handler, - }, - { - MethodName: "RmPeers", - Handler: _PeerManagement_RmPeers_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "peers/v1/peers.proto", -} diff --git a/pkg/config/config.go b/pkg/config/config.go new file mode 100644 index 0000000..8e92452 --- /dev/null +++ b/pkg/config/config.go @@ -0,0 +1,51 @@ +package config + +import ( + "github.com/rotationalio/confire" + "github.com/rotationalio/honu/pkg/logger" + "github.com/rs/zerolog" +) + +// All environment variables will have this prefix unless otherwise defined in struct +// tags. For example, the conf.LogLevel environment variable will be HONU_LOG_LEVEL +// because of this prefix and the split_words struct tag in the conf below. +const Prefix = "honu" + +// Config contains all of the configuration parameters for an honudb instance and is +// loaded from the environment or a configuration file with reasonable defaults for +// values that are omitted. The Config should be validated in preparation for running +// the honudb instance to ensure that all server operations work as expected. +type Config struct { + Maintenance bool `default:"false" desc:"if true, the replica will start in maintenance mode"` + LogLevel logger.LevelDecoder `split_words:"true" default:"info" desc:"specify the verbosity of logging (trace, debug, info, warn, error, fatal panic)"` + ConsoleLog bool `split_words:"true" default:"false" desc:"if true logs colorized human readable output instead of json"` + processed bool +} + +func New() (conf Config, err error) { + if err = confire.Process(Prefix, &conf); err != nil { + return Config{}, err + } + + if err = conf.Validate(); err != nil { + return Config{}, err + } + + conf.processed = true + return conf, nil +} + +// Returns true if the config has not been correctly processed from the environment. +func (c Config) IsZero() bool { + return !c.processed +} + +// Custom validations are added here, particularly validations that require one or more +// fields to be processed before the validation occurs. +func (c Config) Validate() (err error) { + return err +} + +func (c Config) GetLogLevel() zerolog.Level { + return zerolog.Level(c.LogLevel) +} diff --git a/pkg/config/config_test.go b/pkg/config/config_test.go new file mode 100644 index 0000000..bc5371c --- /dev/null +++ b/pkg/config/config_test.go @@ -0,0 +1,81 @@ +package config_test + +import ( + "os" + "testing" + + "github.com/rotationalio/honu/pkg/config" + "github.com/rs/zerolog" + "github.com/stretchr/testify/require" +) + +var testEnv = map[string]string{ + "HONU_MAINTENANCE": "true", + "HONU_LOG_LEVEL": "debug", + "HONU_CONSOLE_LOG": "true", +} + +func TestConfig(t *testing.T) { + // Set required environment variables and cleanup after the test is complete. + t.Cleanup(cleanupEnv()) + setEnv() + + conf, err := config.New() + require.NoError(t, err, "could not process configuration from the environment") + require.False(t, conf.IsZero(), "processed config should not be zero valued") + + // Ensure configuration is correctly set from the environment + require.True(t, conf.Maintenance) + require.Equal(t, zerolog.DebugLevel, conf.GetLogLevel()) + require.True(t, conf.ConsoleLog) +} + +// Returns the current environment for the specified keys, or if no keys are specified +// then it returns the current environment for all keys in the testEnv variable. +func curEnv(keys ...string) map[string]string { + env := make(map[string]string) + if len(keys) > 0 { + for _, key := range keys { + if val, ok := os.LookupEnv(key); ok { + env[key] = val + } + } + } else { + for key := range testEnv { + env[key] = os.Getenv(key) + } + } + + return env +} + +// Sets the environment variables from the testEnv variable. If no keys are specified, +// then this function sets all environment variables from the testEnv. +func setEnv(keys ...string) { + if len(keys) > 0 { + for _, key := range keys { + if val, ok := testEnv[key]; ok { + os.Setenv(key, val) + } + } + } else { + for key, val := range testEnv { + os.Setenv(key, val) + } + } +} + +// Cleanup helper function that can be run when the tests are complete to reset the +// environment back to its previous state before the test was run. +func cleanupEnv(keys ...string) func() { + prevEnv := curEnv(keys...) + return func() { + for key, val := range prevEnv { + if val != "" { + os.Setenv(key, val) + } else { + os.Unsetenv(key) + } + } + } +} diff --git a/pkg/logger/level.go b/pkg/logger/level.go new file mode 100644 index 0000000..10a8356 --- /dev/null +++ b/pkg/logger/level.go @@ -0,0 +1,92 @@ +package logger + +import ( + "encoding/json" + "fmt" + "strings" + + "github.com/rs/zerolog" +) + +// LogLevelDecoder deserializes the log level from a config string. +type LevelDecoder zerolog.Level + +// Names of log levels for use in encoding/decoding from strings. +const ( + llPanic = "panic" + llFatal = "fatal" + llError = "error" + llWarn = "warn" + llInfo = "info" + llDebug = "debug" + llTrace = "trace" +) + +// Decode implements confire Decoder interface. +func (ll *LevelDecoder) Decode(value string) error { + value = strings.TrimSpace(strings.ToLower(value)) + switch value { + case llPanic: + *ll = LevelDecoder(zerolog.PanicLevel) + case llFatal: + *ll = LevelDecoder(zerolog.FatalLevel) + case llError: + *ll = LevelDecoder(zerolog.ErrorLevel) + case llWarn: + *ll = LevelDecoder(zerolog.WarnLevel) + case llInfo: + *ll = LevelDecoder(zerolog.InfoLevel) + case llDebug: + *ll = LevelDecoder(zerolog.DebugLevel) + case llTrace: + *ll = LevelDecoder(zerolog.TraceLevel) + default: + return fmt.Errorf("unknown log level %q", value) + } + return nil +} + +// Encode converts the loglevel into a string for use in YAML and JSON +func (ll *LevelDecoder) Encode() (string, error) { + switch zerolog.Level(*ll) { + case zerolog.PanicLevel: + return llPanic, nil + case zerolog.FatalLevel: + return llFatal, nil + case zerolog.ErrorLevel: + return llError, nil + case zerolog.WarnLevel: + return llWarn, nil + case zerolog.InfoLevel: + return llInfo, nil + case zerolog.DebugLevel: + return llDebug, nil + case zerolog.TraceLevel: + return llTrace, nil + default: + return "", fmt.Errorf("unknown log level %d", ll) + } +} + +func (ll LevelDecoder) String() string { + ls, _ := ll.Encode() + return ls +} + +// UnmarshalJSON implements json.Unmarshaler +func (ll *LevelDecoder) UnmarshalJSON(data []byte) error { + var ls string + if err := json.Unmarshal(data, &ls); err != nil { + return err + } + return ll.Decode(ls) +} + +// MarshalJSON implements json.Marshaler +func (ll LevelDecoder) MarshalJSON() ([]byte, error) { + ls, err := ll.Encode() + if err != nil { + return nil, err + } + return json.Marshal(ls) +} diff --git a/pkg/logger/level_test.go b/pkg/logger/level_test.go new file mode 100644 index 0000000..6d7190d --- /dev/null +++ b/pkg/logger/level_test.go @@ -0,0 +1,86 @@ +package logger_test + +import ( + "encoding/json" + "fmt" + "testing" + + "github.com/rotationalio/honu/pkg/logger" + + "github.com/rs/zerolog" + "github.com/stretchr/testify/require" +) + +func TestLevelDecoder(t *testing.T) { + testTable := []struct { + value string + expected zerolog.Level + }{ + { + "panic", zerolog.PanicLevel, + }, + { + "FATAL", zerolog.FatalLevel, + }, + { + "Error", zerolog.ErrorLevel, + }, + { + " warn ", zerolog.WarnLevel, + }, + { + "iNFo", zerolog.InfoLevel, + }, + { + "debug", zerolog.DebugLevel, + }, + { + "trace", zerolog.TraceLevel, + }, + } + + // Test valid cases + for _, testCase := range testTable { + var level logger.LevelDecoder + err := level.Decode(testCase.value) + require.NoError(t, err) + require.Equal(t, testCase.expected, zerolog.Level(level)) + } + + // Test error case + var level logger.LevelDecoder + err := level.Decode("notalevel") + require.EqualError(t, err, `unknown log level "notalevel"`) +} + +func TestUnmarshaler(t *testing.T) { + type Config struct { + Level logger.LevelDecoder + } + + var jsonConf Config + err := json.Unmarshal([]byte(`{"level": "panic"}`), &jsonConf) + require.NoError(t, err, "could not unmarshal level decoder in json file") + require.Equal(t, zerolog.PanicLevel, zerolog.Level(jsonConf.Level)) +} + +func TestMarshaler(t *testing.T) { + confs := []struct { + Level logger.LevelDecoder `yaml:"level" json:"level"` + }{ + {logger.LevelDecoder(zerolog.PanicLevel)}, + {logger.LevelDecoder(zerolog.FatalLevel)}, + {logger.LevelDecoder(zerolog.ErrorLevel)}, + {logger.LevelDecoder(zerolog.WarnLevel)}, + {logger.LevelDecoder(zerolog.InfoLevel)}, + {logger.LevelDecoder(zerolog.DebugLevel)}, + {logger.LevelDecoder(zerolog.TraceLevel)}, + } + + for _, conf := range confs { + data, err := json.Marshal(conf) + require.NoError(t, err, "could not marshal data into json") + require.Equal(t, []byte(fmt.Sprintf(`{"level":%q}`, &conf.Level)), data) + } + +} diff --git a/pkg/logger/logger.go b/pkg/logger/logger.go new file mode 100644 index 0000000..78de414 --- /dev/null +++ b/pkg/logger/logger.go @@ -0,0 +1,40 @@ +package logger + +import "github.com/rs/zerolog" + +type severityGCP string + +const ( + GCPAlertLevel severityGCP = "ALERT" + GCPCriticalLevel severityGCP = "CRITICAL" + GCPErrorLevel severityGCP = "ERROR" + GCPWarningLevel severityGCP = "WARNING" + GCPInfoLevel severityGCP = "INFO" + GCPDebugLevel severityGCP = "DEBUG" + + GCPFieldKeySeverity = "severity" + GCPFieldKeyMsg = "message" + GCPFieldKeyTime = "time" +) + +var ( + zerologToGCPLevel = map[zerolog.Level]severityGCP{ + zerolog.PanicLevel: GCPAlertLevel, + zerolog.FatalLevel: GCPCriticalLevel, + zerolog.ErrorLevel: GCPErrorLevel, + zerolog.WarnLevel: GCPWarningLevel, + zerolog.InfoLevel: GCPInfoLevel, + zerolog.DebugLevel: GCPDebugLevel, + zerolog.TraceLevel: GCPDebugLevel, + } +) + +// SeverityHook adds GCP severity levels to zerolog output log messages. +type SeverityHook struct{} + +// Run implements the zerolog.Hook interface. +func (h SeverityHook) Run(e *zerolog.Event, level zerolog.Level, msg string) { + if level != zerolog.NoLevel { + e.Str(GCPFieldKeySeverity, string(zerologToGCPLevel[level])) + } +} diff --git a/pkg/logger/logger_test.go b/pkg/logger/logger_test.go new file mode 100644 index 0000000..49caf6c --- /dev/null +++ b/pkg/logger/logger_test.go @@ -0,0 +1,122 @@ +package logger_test + +import ( + "encoding/json" + "errors" + "testing" + "time" + + "github.com/rotationalio/honu/pkg/logger" + + "github.com/rs/zerolog" + "github.com/rs/zerolog/log" + "github.com/stretchr/testify/require" +) + +type testWriter struct { + lastLog map[string]interface{} + levels map[zerolog.Level]uint16 +} + +func (w *testWriter) WriteLevel(level zerolog.Level, p []byte) (n int, err error) { + if w.levels == nil { + w.levels = make(map[zerolog.Level]uint16) + } + w.levels[level]++ + return w.Write(p) +} + +func (w *testWriter) Write(p []byte) (n int, err error) { + if err = json.Unmarshal(p, &w.lastLog); err != nil { + return 0, err + } + return len(p), nil +} + +func TestSeverityHook(t *testing.T) { + // Initialize zerolog with GCP logging requirements + zerolog.TimeFieldFormat = time.RFC3339 + zerolog.TimestampFieldName = logger.GCPFieldKeyTime + zerolog.MessageFieldName = logger.GCPFieldKeyMsg + + // Test writer + tw := &testWriter{} + + // Add the severity hook for GCP logging + var gcpHook logger.SeverityHook + log.Logger = zerolog.New(tw).Hook(gcpHook).With().Timestamp().Logger() + + log.Trace().Msg("just a trace") + require.Equal(t, uint16(1), tw.levels[zerolog.TraceLevel]) + require.Contains(t, tw.lastLog, logger.GCPFieldKeySeverity) + require.Equal(t, "DEBUG", tw.lastLog[logger.GCPFieldKeySeverity]) + require.Contains(t, tw.lastLog, logger.GCPFieldKeyMsg) + require.Equal(t, "just a trace", tw.lastLog[logger.GCPFieldKeyMsg]) + require.Contains(t, tw.lastLog, logger.GCPFieldKeyTime) + require.NotEmpty(t, tw.lastLog[logger.GCPFieldKeyMsg]) + + log.Debug().Msg("is it on?") + require.Equal(t, uint16(1), tw.levels[zerolog.DebugLevel]) + require.Contains(t, tw.lastLog, logger.GCPFieldKeySeverity) + require.Equal(t, "DEBUG", tw.lastLog[logger.GCPFieldKeySeverity]) + require.Contains(t, tw.lastLog, logger.GCPFieldKeyMsg) + require.Equal(t, "is it on?", tw.lastLog[logger.GCPFieldKeyMsg]) + require.Contains(t, tw.lastLog, logger.GCPFieldKeyTime) + require.NotEmpty(t, tw.lastLog[logger.GCPFieldKeyMsg]) + + log.Info().Str("extra", "foo").Msg("my name is bob") + require.Equal(t, uint16(1), tw.levels[zerolog.InfoLevel]) + require.Contains(t, tw.lastLog, logger.GCPFieldKeySeverity) + require.Equal(t, "INFO", tw.lastLog[logger.GCPFieldKeySeverity]) + require.Contains(t, tw.lastLog, logger.GCPFieldKeyMsg) + require.Equal(t, "my name is bob", tw.lastLog[logger.GCPFieldKeyMsg]) + require.Contains(t, tw.lastLog, logger.GCPFieldKeyTime) + require.NotEmpty(t, tw.lastLog[logger.GCPFieldKeyMsg]) + require.Contains(t, tw.lastLog, "extra") + require.Equal(t, "foo", tw.lastLog["extra"]) + + log.Warn().Msg("don't run with scissors") + require.Equal(t, uint16(1), tw.levels[zerolog.WarnLevel]) + require.Contains(t, tw.lastLog, logger.GCPFieldKeySeverity) + require.Equal(t, "WARNING", tw.lastLog[logger.GCPFieldKeySeverity]) + require.Contains(t, tw.lastLog, logger.GCPFieldKeyMsg) + require.Equal(t, "don't run with scissors", tw.lastLog[logger.GCPFieldKeyMsg]) + require.Contains(t, tw.lastLog, logger.GCPFieldKeyTime) + require.NotEmpty(t, tw.lastLog[logger.GCPFieldKeyMsg]) + + log.Error().Err(errors.New("bad things")).Msg("oops") + require.Equal(t, uint16(1), tw.levels[zerolog.ErrorLevel]) + require.Contains(t, tw.lastLog, logger.GCPFieldKeySeverity) + require.Equal(t, "ERROR", tw.lastLog[logger.GCPFieldKeySeverity]) + require.Contains(t, tw.lastLog, logger.GCPFieldKeyMsg) + require.Equal(t, "oops", tw.lastLog[logger.GCPFieldKeyMsg]) + require.Contains(t, tw.lastLog, logger.GCPFieldKeyTime) + require.NotEmpty(t, tw.lastLog[logger.GCPFieldKeyMsg]) + require.Contains(t, tw.lastLog, "error") + require.Equal(t, "bad things", tw.lastLog["error"]) + + // Must use WithLevel or the program will exit and the test will fail. + log.WithLevel(zerolog.FatalLevel).Err(errors.New("murder")).Msg("dying") + require.Equal(t, uint16(1), tw.levels[zerolog.FatalLevel]) + require.Contains(t, tw.lastLog, logger.GCPFieldKeySeverity) + require.Equal(t, "CRITICAL", tw.lastLog[logger.GCPFieldKeySeverity]) + require.Contains(t, tw.lastLog, logger.GCPFieldKeyMsg) + require.Equal(t, "dying", tw.lastLog[logger.GCPFieldKeyMsg]) + require.Contains(t, tw.lastLog, logger.GCPFieldKeyTime) + require.NotEmpty(t, tw.lastLog[logger.GCPFieldKeyMsg]) + require.Contains(t, tw.lastLog, "error") + require.Equal(t, "murder", tw.lastLog["error"]) + + require.Panics(t, func() { + log.Panic().Err(errors.New("run away!")).Msg("squeeeee!!!") + }) + require.Equal(t, uint16(1), tw.levels[zerolog.PanicLevel]) + require.Contains(t, tw.lastLog, logger.GCPFieldKeySeverity) + require.Equal(t, "ALERT", tw.lastLog[logger.GCPFieldKeySeverity]) + require.Contains(t, tw.lastLog, logger.GCPFieldKeyMsg) + require.Equal(t, "squeeeee!!!", tw.lastLog[logger.GCPFieldKeyMsg]) + require.Contains(t, tw.lastLog, logger.GCPFieldKeyTime) + require.NotEmpty(t, tw.lastLog[logger.GCPFieldKeyMsg]) + require.Contains(t, tw.lastLog, "error") + require.Equal(t, "run away!", tw.lastLog["error"]) +} diff --git a/version.go b/pkg/version.go similarity index 82% rename from version.go rename to pkg/version.go index 008a470..97b8822 100644 --- a/version.go +++ b/pkg/version.go @@ -1,20 +1,20 @@ -package honu +package pkg import "fmt" // Version component constants for the current build. const ( - VersionMajor = 0 - VersionMinor = 4 + VersionMajor = 1 + VersionMinor = 0 VersionPatch = 0 - VersionReleaseLevel = "beta" - VersionReleaseNumber = 12 + VersionReleaseLevel = "alpha" + VersionReleaseNumber = 1 ) -// Set the GitVersion via -ldflags="-X 'github.com/rotationalio/honu.GitVersion=$(git rev-parse --short HEAD)'" +// Set the GitVersion via -ldflags="-X 'github.com/rotationalio/honu/pkg.GitVersion=$(git rev-parse --short HEAD)'" var GitVersion string -// Set the BuildDate via -ldflags="-X github.com/rotationalio/honu.BuildDate=YYYY-MM-DD" +// Set the BuildDate via -ldflags="-X github.com/rotationalio/honu/pkg.BuildDate=YYYY-MM-DD" var BuildDate string // Version returns the semantic version for the current build. diff --git a/proto/honu/v1/honu.proto b/proto/honu/v1/honu.proto deleted file mode 100644 index 7b4b2df..0000000 --- a/proto/honu/v1/honu.proto +++ /dev/null @@ -1,193 +0,0 @@ -syntax = "proto3"; - -package honu.v1; - -service Honu { - // Get is a unary request to retrieve a value for a key. - rpc Get(GetRequest) returns (GetReply) {}; - - // Put is a unary request to store a value for a key. - rpc Put(PutRequest) returns (PutReply) {}; - - // Delete is a unary request to remove a value and key. - rpc Delete(DeleteRequest) returns (DeleteReply) {}; - - // Iter is a unary request that returns a completely materialized list of key value pairs. - rpc Iter(IterRequest) returns (IterReply) {}; - - // Batch is a client-side streaming request to issue multiple commands, usually Put and Delete. - rpc Batch(stream BatchRequest) returns (BatchReply) {}; - - // Cursor is a server-side streaming request to iterate in a memory safe fashion. - rpc Cursor(CursorRequest) returns (stream KVPair) {}; - - // Sync is a bi-directional streaming mechanism to issue access requests synchronously. - rpc Sync(stream SyncRequest) returns (stream SyncReply) {}; - - // Count the number of objects currently stored in the database - rpc Count(CountRequest) returns (CountReply) {}; - - // This RPC servers as a health check for clients to make sure the server is online. - rpc Status(HealthCheck) returns (ServerStatus) {}; -} - - -message GetRequest { - bytes key = 1; - string namespace = 2; - Options options = 3; -} - -message GetReply { - bytes value = 1; - Meta meta = 2; // will only be supplied if return_meta=true in options -} - -message PutRequest { - bytes key = 1; - bytes value = 2; - string namespace = 3; - Options options = 4; -} - -message PutReply { - bool success = 1; - Meta meta = 2; // will only be supplied if return_meta=true in options -} - -message DeleteRequest { - bytes key = 1; - string namespace = 2; - Options options = 3; // if return_meta=true then the meta of the version deleted is returned -} - -message DeleteReply { - bool success = 1; - Meta meta = 2; // will only be supplied if return_meta=true in options -} - -message IterRequest { - bytes prefix = 1; // the prefix to range over, if nil all objects are returned - string namespace = 2; - Options options = 3; -} - -message IterReply { - repeated KVPair values = 1; - string next_page_token = 2; -} - -message BatchRequest { - int64 id = 1; - oneof request { - PutRequest put = 2; - DeleteRequest delete = 3; - } -} - -message BatchReply { - message Error { - int64 id = 1; - string error = 2; - } - - int64 operations = 1; - int64 successful = 2; - int64 failed = 3; - repeated Error errors = 4; -} - -message CursorRequest { - bytes prefix = 1; // the prefix to range over, if nil all objects are returned - bytes seek_key = 2; // a key to seekto within the prefix (optional) - string namespace = 3; - Options options = 4; -} - -message SyncRequest { - int64 id = 1; - oneof request { - GetRequest get = 2; - PutRequest put = 3; - DeleteRequest delete = 4; - IterRequest iter = 5; - } -} - -message SyncReply { - int64 id = 1; - bool success = 2; - string error = 3; - oneof reply { - GetReply get = 4; - PutReply put = 5; - DeleteReply delete = 6; - IterReply iter = 7; - } -} - -message CountRequest { - bytes prefix = 1; // the prefix to range over, if nil all objects are counted - bytes seek_key = 2; // a key to seekto within the prefix (optional) - string namespace = 3; -} - -message CountReply { - uint64 objects = 1; // the number of objects in the iterator - uint64 key_bytes = 2; // the number of bytes used for keys - uint64 object_bytes = 3; // the number of bytes used for objects -} - -message HealthCheck {} - -message ServerStatus { - string status = 1; - string version = 2; - string uptime = 3; - ReplicaStatus replica = 15; -} - -message ReplicaStatus { - bool enabled = 1; - uint64 pid = 2; - string region = 3; - string name = 4; - string interval = 5; - string sigma = 6; -} - -// Options conditions all accesses to trtl, e.g. there are not different structs for -// Get vs Put options. The semantics of each option depends on the type of request. -message Options { - bool return_meta = 1; // generally, return the version information for the object in the response - bool iter_no_keys = 2; // do not include keys in an Iter or Cursor response, to reduce data transfer load - bool iter_no_values = 3; // do not include values in an Iter or Cursor response, to reduce data transfer load - string page_token = 4; // specify the page token to fetch the next page of results - int32 page_size = 5; // specify the number of results per page, cannot change between page requests -} - -// A key/value pair that is returned in Iter and Cursor requests -message KVPair { - bytes key = 1; - bytes value = 2; - string namespace = 3; - Meta meta = 4; -} - -// Meta is a simplified representation of the honu.object.v1.Object metadata that trtl -// actually stores. The simplification is intended to return non-nested data version -// information to the user in a read-only fashion. -message Meta { - bytes key = 1; // the key that the metadata describes - string namespace = 2; // a unique namespace of the key, usually a prefix - string region = 3; // the region in which the data originated - string owner = 4; // the name of the replica where the data originated - Version version = 5; // the current conflict-free version of the data - Version parent = 6; // the version the current data was was derived from -} - -message Version { - uint64 pid = 1; // process id, used for conflict-free version comparisons - uint64 version = 2; // a monotonically increasing scalar that describes changes in the record - string region = 3; // the region where the version originated -} \ No newline at end of file diff --git a/proto/mimetype/v1/charset.proto b/proto/mimetype/v1/charset.proto deleted file mode 100644 index 94c246b..0000000 --- a/proto/mimetype/v1/charset.proto +++ /dev/null @@ -1,275 +0,0 @@ -// Code generated by proto/mimetype/v1/generate.go DO NOT EDIT. -syntax = "proto3"; - -package mimetype.v1; - -option go_package = "github.com/rotationalio/honu/mimetype"; - -// CharSet defines the character set used in text based encoding. If the CharSet is not -// specified, it is assumed to be UTF-8. These CharSets are defined by the IANA -// character set assignments at -// https://www.iana.org/assignments/character-sets/character-sets.xhtml -// -// NOTE: not all character sets may be supported by the server and must be supported by -// clients of the database if an unsupport charset is used. -enum CharSet { - UNDEFINED = 0; - US_ASCII = 3; - ISO_8859_1 = 4; - ISO_8859_2 = 5; - ISO_8859_3 = 6; - ISO_8859_4 = 7; - ISO_8859_5 = 8; - ISO_8859_6 = 9; - ISO_8859_7 = 10; - ISO_8859_8 = 11; - ISO_8859_9 = 12; - ISO_8859_10 = 13; - ISO_6937_2_ADD = 14; - JIS_X0201 = 15; - JIS_ENCODING = 16; - SHIFT_JIS = 17; - EUC_JP = 18; - EXTENDED_UNIX_CODE_FIXED_WIDTH_FOR_JAPANESE = 19; - BS_4730 = 20; - SEN_850200_C = 21; - IT = 22; - ES = 23; - DIN_66003 = 24; - NS_4551_1 = 25; - NF_Z_62_010 = 26; - ISO_10646_UTF_1 = 27; - ISO_646_BASIC_1983 = 28; - INVARIANT = 29; - ISO_646_IRV_1983 = 30; - NATS_SEFI = 31; - NATS_SEFI_ADD = 32; - NATS_DANO = 33; - NATS_DANO_ADD = 34; - SEN_850200_B = 35; - KS_C_5601_1987 = 36; - ISO_2022_KR = 37; - EUC_KR = 38; - ISO_2022_JP = 39; - ISO_2022_JP_2 = 40; - JIS_C6220_1969_JP = 41; - JIS_C6220_1969_RO = 42; - PT = 43; - GREEK7_OLD = 44; - LATIN_GREEK = 45; - NF_Z_62_010_1973 = 46; - LATIN_GREEK_1 = 47; - ISO_5427 = 48; - JIS_C6226_1978 = 49; - BS_VIEWDATA = 50; - INIS = 51; - INIS_8 = 52; - INIS_CYRILLIC = 53; - ISO_5427_1981 = 54; - ISO_5428_1980 = 55; - GB_1988_80 = 56; - GB_2312_80 = 57; - NS_4551_2 = 58; - VIDEOTEX_SUPPL = 59; - PT2 = 60; - ES2 = 61; - MSZ_7795_3 = 62; - JIS_C6226_1983 = 63; - GREEK7 = 64; - ASMO_449 = 65; - ISO_IR_90 = 66; - JIS_C6229_1984_A = 67; - JIS_C6229_1984_B = 68; - JIS_C6229_1984_B_ADD = 69; - JIS_C6229_1984_HAND = 70; - JIS_C6229_1984_HAND_ADD = 71; - JIS_C6229_1984_KANA = 72; - ISO_2033_1983 = 73; - ANSI_X3_110_1983 = 74; - T_61_7BIT = 75; - T_61_8BIT = 76; - ECMA_CYRILLIC = 77; - CSA_Z243_4_1985_1 = 78; - CSA_Z243_4_1985_2 = 79; - CSA_Z243_4_1985_GR = 80; - ISO_8859_6_E = 81; - ISO_8859_6_I = 82; - T_101_G2 = 83; - ISO_8859_8_E = 84; - ISO_8859_8_I = 85; - CSN_369103 = 86; - JUS_I_B1_002 = 87; - IEC_P27_1 = 88; - JUS_I_B1_003_SERB = 89; - JUS_I_B1_003_MAC = 90; - GREEK_CCITT = 91; - NC_NC00_10_81 = 92; - ISO_6937_2_25 = 93; - GOST_19768_74 = 94; - ISO_8859_SUPP = 95; - ISO_10367_BOX = 96; - LATIN_LAP = 97; - JIS_X0212_1990 = 98; - DS_2089 = 99; - US_DK = 100; - DK_US = 101; - KSC5636 = 102; - UNICODE_1_1_UTF_7 = 103; - ISO_2022_CN = 104; - ISO_2022_CN_EXT = 105; - UTF_8 = 106; - ISO_8859_13 = 109; - ISO_8859_14 = 110; - ISO_8859_15 = 111; - ISO_8859_16 = 112; - GBK = 113; - GB18030 = 114; - OSD_EBCDIC_DF04_15 = 115; - OSD_EBCDIC_DF03_IRV = 116; - OSD_EBCDIC_DF04_1 = 117; - ISO_11548_1 = 118; - KZ_1048 = 119; - ISO_10646_UCS_2 = 1000; - ISO_10646_UCS_4 = 1001; - ISO_10646_UCS_BASIC = 1002; - ISO_10646_UNICODE_LATIN1 = 1003; - ISO_10646_J_1 = 1004; - ISO_UNICODE_IBM_1261 = 1005; - ISO_UNICODE_IBM_1268 = 1006; - ISO_UNICODE_IBM_1276 = 1007; - ISO_UNICODE_IBM_1264 = 1008; - ISO_UNICODE_IBM_1265 = 1009; - UNICODE_1_1 = 1010; - SCSU = 1011; - UTF_7 = 1012; - UTF_16BE = 1013; - UTF_16LE = 1014; - UTF_16 = 1015; - CESU_8 = 1016; - UTF_32 = 1017; - UTF_32BE = 1018; - UTF_32LE = 1019; - BOCU_1 = 1020; - UTF_7_IMAP = 1021; - ISO_8859_1_WINDOWS_3_0_LATIN_1 = 2000; - ISO_8859_1_WINDOWS_3_1_LATIN_1 = 2001; - ISO_8859_2_WINDOWS_LATIN_2 = 2002; - ISO_8859_9_WINDOWS_LATIN_5 = 2003; - HP_ROMAN8 = 2004; - ADOBE_STANDARD_ENCODING = 2005; - VENTURA_US = 2006; - VENTURA_INTERNATIONAL = 2007; - DEC_MCS = 2008; - IBM850 = 2009; - PC8_DANISH_NORWEGIAN = 2012; - IBM862 = 2013; - PC8_TURKISH = 2014; - IBM_SYMBOLS = 2015; - IBM_THAI = 2016; - HP_LEGAL = 2017; - HP_PI_FONT = 2018; - HP_MATH8 = 2019; - ADOBE_SYMBOL_ENCODING = 2020; - HP_DESKTOP = 2021; - VENTURA_MATH = 2022; - MICROSOFT_PUBLISHING = 2023; - WINDOWS_31J = 2024; - GB2312 = 2025; - BIG5 = 2026; - MACINTOSH = 2027; - IBM037 = 2028; - IBM038 = 2029; - IBM273 = 2030; - IBM274 = 2031; - IBM275 = 2032; - IBM277 = 2033; - IBM278 = 2034; - IBM280 = 2035; - IBM281 = 2036; - IBM284 = 2037; - IBM285 = 2038; - IBM290 = 2039; - IBM297 = 2040; - IBM420 = 2041; - IBM423 = 2042; - IBM424 = 2043; - IBM437 = 2011; - IBM500 = 2044; - IBM851 = 2045; - IBM852 = 2010; - IBM855 = 2046; - IBM857 = 2047; - IBM860 = 2048; - IBM861 = 2049; - IBM863 = 2050; - IBM864 = 2051; - IBM865 = 2052; - IBM868 = 2053; - IBM869 = 2054; - IBM870 = 2055; - IBM871 = 2056; - IBM880 = 2057; - IBM891 = 2058; - IBM903 = 2059; - IBM904 = 2060; - IBM905 = 2061; - IBM918 = 2062; - IBM1026 = 2063; - EBCDIC_AT_DE = 2064; - EBCDIC_AT_DE_A = 2065; - EBCDIC_CA_FR = 2066; - EBCDIC_DK_NO = 2067; - EBCDIC_DK_NO_A = 2068; - EBCDIC_FI_SE = 2069; - EBCDIC_FI_SE_A = 2070; - EBCDIC_FR = 2071; - EBCDIC_IT = 2072; - EBCDIC_PT = 2073; - EBCDIC_ES = 2074; - EBCDIC_ES_A = 2075; - EBCDIC_ES_S = 2076; - EBCDIC_UK = 2077; - EBCDIC_US = 2078; - UNKNOWN_8BIT = 2079; - MNEMONIC = 2080; - MNEM = 2081; - VISCII = 2082; - VIQR = 2083; - KOI8_R = 2084; - HZ_GB_2312 = 2085; - IBM866 = 2086; - IBM775 = 2087; - KOI8_U = 2088; - IBM00858 = 2089; - IBM00924 = 2090; - IBM01140 = 2091; - IBM01141 = 2092; - IBM01142 = 2093; - IBM01143 = 2094; - IBM01144 = 2095; - IBM01145 = 2096; - IBM01146 = 2097; - IBM01147 = 2098; - IBM01148 = 2099; - IBM01149 = 2100; - BIG5_HKSCS = 2101; - IBM1047 = 2102; - PTCP154 = 2103; - AMIGA_1251 = 2104; - KOI7_SWITCHED = 2105; - BRF = 2106; - TSCII = 2107; - CP51932 = 2108; - WINDOWS_874 = 2109; - WINDOWS_1250 = 2250; - WINDOWS_1251 = 2251; - WINDOWS_1252 = 2252; - WINDOWS_1253 = 2253; - WINDOWS_1254 = 2254; - WINDOWS_1255 = 2255; - WINDOWS_1256 = 2256; - WINDOWS_1257 = 2257; - WINDOWS_1258 = 2258; - TIS_620 = 2259; - CP50220 = 2260; -} \ No newline at end of file diff --git a/proto/mimetype/v1/generate.go b/proto/mimetype/v1/generate.go deleted file mode 100644 index c502c40..0000000 --- a/proto/mimetype/v1/generate.go +++ /dev/null @@ -1,171 +0,0 @@ -package main - -import ( - "encoding/csv" - "fmt" - "io" - "net/http" - "os" - "strconv" - "strings" -) - -//go:generate go run . - -const ( - charsetPath = "charset.proto" - ianaCharSets = "https://www.iana.org/assignments/character-sets/character-sets-1.csv" -) - -func main() { - var ( - f *os.File - err error - charsets []string - values []int32 - ) - - if charsets, values, err = fetchCharSets(); err != nil { - exit(fmt.Errorf("could not fetch charsets: %w", err)) - } - - if f, err = os.Create(charsetPath); err != nil { - exit(fmt.Errorf("could not open %s: %w", charsetPath, err)) - } - defer f.Close() - - if err = writeProtobuf(f, charsets, values); err != nil { - exit(fmt.Errorf("could not write generated protobofu file: %w", err)) - } -} - -func fetchCharSets() (charsets []string, values []int32, err error) { - var req *http.Request - if req, err = http.NewRequest(http.MethodGet, ianaCharSets, nil); err != nil { - return nil, nil, err - } - - var rep *http.Response - if rep, err = http.DefaultClient.Do(req); err != nil { - return nil, nil, err - } - - if rep.StatusCode != http.StatusOK { - return nil, nil, fmt.Errorf("[%d] %s", rep.StatusCode, http.StatusText(rep.StatusCode)) - } - defer rep.Body.Close() - - reader := csv.NewReader(rep.Body) - charsets = []string{"UNDEFINED"} - values = []int32{0} - - // Read the first row from the reader to remove the fields - reader.Read() - -csvReader: - for { - var row []string - if row, err = reader.Read(); err != nil { - if err == io.EOF { - break csvReader - } else { - return nil, nil, err - } - } - - var name string - switch { - case row[0] != "": - name = row[0] - case row[1] != "": - name = row[1] - default: - continue csvReader - } - - charsets = append(charsets, normalizeName(name)) - - var value int32 - if value, err = parseInt32(row[2]); err != nil { - return nil, nil, err - } - - values = append(values, value) - } - - return charsets, values, nil -} - -func normalizeName(name string) string { - name = strings.ToUpper(strings.TrimSpace(name)) - name = strings.ReplaceAll(name, "-", "_") - name = strings.ReplaceAll(name, " ", "_") - name = strings.ReplaceAll(name, ":", "_") - name = strings.ReplaceAll(name, ".", "_") - name = strings.ReplaceAll(name, "(", "") - name = strings.ReplaceAll(name, ")", "") - name = strings.ReplaceAll(name, "__", "_") - - return name -} - -func parseInt32(s string) (_ int32, err error) { - if s == "" { - return 0, nil - } - - var i int64 - if i, err = strconv.ParseInt(s, 10, 32); err != nil { - return 0, err - } - return int32(i), nil -} - -const padbuf = 24 - -func writeProtobuf(w io.Writer, charsets []string, values []int32) (err error) { - if _, err = fmt.Fprint(w, GenFileHeader); err != nil { - return err - } - - for i := 0; i < len(charsets); i++ { - klen := len(charsets[i]) - - var pad string - if klen < padbuf { - pad = strings.Repeat(" ", padbuf-klen) - } - - if _, err = fmt.Fprintf(w, " %s%s = %d;\n", charsets[i], pad, values[i]); err != nil { - return fmt.Errorf("could not write line: %w", err) - } - } - - if _, err = fmt.Fprint(w, "}"); err != nil { - return err - } - - return nil -} - -const GenFileHeader = `// Code generated by proto/mimetype/v1/generate.go DO NOT EDIT. -syntax = "proto3"; - -package mimetype.v1; - -option go_package = "github.com/rotationalio/honu/mimetype"; - -// CharSet defines the character set used in text based encoding. If the CharSet is not -// specified, it is assumed to be UTF-8. These CharSets are defined by the IANA -// character set assignments at -// https://www.iana.org/assignments/character-sets/character-sets.xhtml -// -// NOTE: not all character sets may be supported by the server and must be supported by -// clients of the database if an unsupport charset is used. -enum CharSet { -` - -func exit(err error) { - fmt.Fprintln(os.Stderr, err.Error()) - os.Exit(1) -} diff --git a/proto/mimetype/v1/mimetype.proto b/proto/mimetype/v1/mimetype.proto deleted file mode 100644 index 3766f66..0000000 --- a/proto/mimetype/v1/mimetype.proto +++ /dev/null @@ -1,82 +0,0 @@ -syntax = "proto3"; - -package mimetype.v1; - -import "mimetype/v1/charset.proto"; - -option go_package = "github.com/rotationalio/honu/mimetype"; - -message Mimetype { - MIME mime = 1; - mimetype.v1.CharSet charset = 2; -} - -// MIME stands for multipurpose internet mail extensions and is a standardized method -// for defining the formatting of files and data of different types. In Honu, the -// mimetype is used to identify and deserialize object data. -// -// Typically, mimetypes are strings, e.g. "application/json" and can even flexibly -// define encodings such as "application/json; charset=utf-8"; these ensure that -// mimetypes are flexible and can be extended without changing protocols. However, using -// string encoding for objects results in a lot of duplication and data size should be as -// small as possible when there are numerous objects in the system. -// -// To reduce the size of object metadata, this package defines mimetypes as an enum. This -// ensures that only 4 bytes maximum are used for the mimetype, but also means that the -// mimetypes are not as flexible and adding new mimetypes requires adding enum values to -// this package. If your mimetype is not listed here, please submit a pull request to -// honu to get it added! -// -// TODO: generate mimetype list from IANA like we're doing with charsets: -// https://www.iana.org/assignments/media-types/media-types.xhtml -enum MIME { - option allow_alias = true; - UNSPECIFIED = 0; - UNKNOWN = 0; - - // Default value for textual files that are human-readable and do not contain binary data. - TEXT_PLAIN = 1; - - // Plain text data-containing types - TEXT_CSV = 2; - TEXT_HTML = 3; - TEXT_CALENDAR = 4; - - // Default value for all non-text data types (alias for UNSPECIFIED) - APPLICATION_OCTET_STREAM = 0; - - // Application data-containing types - APPLICATION_JSON = 50; - APPLICATION_JSON_UTF8 = 50; - APPLICATION_JSON_LD = 51; - APPLICATION_JSON_LINES = 52; - APPLICATION_UBJSON = 53; - APPLICATION_BSON = 54; - - APPLICATION_XML = 100; - APPLICATION_ATOM = 101; - - // Binary application data-containing types - APPLICATION_MSGPACK = 252; - APPLICATION_PARQUET = 253; - APPLICATION_AVRO = 254; - APPLICATION_PROTOBUF = 255; - - // Other miscellaneous application types - APPLICATION_PDF = 512; - APPLICATION_JAVA_ARCHIVE = 513; - APPLICATION_PYTHON_PICKLE = 514; - - // User-specified mimetypes allow the user to distinguish mimetypes in their - // applications without specifically setting a mimetype. - USER_SPECIFIED0 = 1000; - USER_SPECIFIED1 = 1001; - USER_SPECIFIED2 = 1002; - USER_SPECIFIED3 = 1003; - USER_SPECIFIED4 = 1004; - USER_SPECIFIED5 = 1005; - USER_SPECIFIED6 = 1006; - USER_SPECIFIED7 = 1007; - USER_SPECIFIED8 = 1008; - USER_SPECIFIED9 = 1009; -} \ No newline at end of file diff --git a/proto/object/v1/object.proto b/proto/object/v1/object.proto deleted file mode 100644 index 78d672d..0000000 --- a/proto/object/v1/object.proto +++ /dev/null @@ -1,45 +0,0 @@ -syntax = "proto3"; - -package honu.object.v1; -import "google/protobuf/timestamp.proto"; - -option go_package = "github.com/rotationalio/honu/object"; - -// An Object is a generic representation of a replicated piece of data. At the top level -// it contains enough metadata in order to detect changes during anti-entropy, -// specifically, given two objects, which is the later object (or does it need to be -// created or deleted). When used in VersionVectors only the metadata of the object is -// supplied. When passed via Updates, then the full data of the object is populated. -// -// For research purposes, this anti-entropy mechanism tracks the region and owner of -// each object to determine provinence and global interactions. Because this is side -// channel information that may not necessarily be stored with the object data, it is -// recommended that an objects table be kept for fast lookups of object versions. -// Additionally, it is recommended that a history table be maintained locally so that -// Object versions can be rolled back to previous states where necessary. -message Object { - // The object metadata that must be populated on both VersionVectors and Updates - bytes key = 1; // A unique key/id that represents the object across the namespace of the object type - string namespace = 2; // The namespace of the object, used to disambiguate keys or different object types - Version version = 3; // A version vector representing this objects current or latest version - string region = 4; // The region code where the data originated - string owner = 5; // The replica that created the object (identified as "pid:name" if name exists) - - // The object data that is only populated on Updates. - bytes data = 10; - - // The timestamp that the object was created (modified timestamps are on versions). - google.protobuf.Timestamp created = 15; -} - -// Implements a geo-distributed version as a Lamport Scalar -message Version { - uint64 pid = 1; // Process ID - used to deconflict ties in the version number. - uint64 version = 2; // Montonically increasing version number. - string region = 3; // The region where the change occurred to track multi-region handling. - Version parent = 4; // In order to get a complete version history, identify the predessor; for compact data transfer parent should not be defined in parent version. - bool tombstone = 5; // Set to true in order to mark the object as deleted - - // The timestamp that the version was created (e.g. the last modified date). - google.protobuf.Timestamp modified = 15; -} diff --git a/proto/pagination/v1/pagination.proto b/proto/pagination/v1/pagination.proto deleted file mode 100644 index 490d4fe..0000000 --- a/proto/pagination/v1/pagination.proto +++ /dev/null @@ -1,27 +0,0 @@ -syntax = "proto3"; - -package honu.pagination.v1; - -import "google/protobuf/timestamp.proto"; - -option go_package = "github.com/rotationalio/honu/pagination"; - -// Implements a protocol buffer struct for state managed pagination. This struct will be -// marshaled into a url-safe base64 encoded string and sent to the user as the -// next_page_token. The server should decode this struct to determine where to continue -// iteration for the next page. Note that the server should check to make sure the page -// size in the cursor matches the page size in the request. -// See https://cloud.google.com/apis/design/design_patterns#list_pagination for more. -message PageCursor { - // The number of results returned on each iteration. - int32 page_size = 1; - - // The key to start the iteration from for forward iteration (e.g. the seek key). - bytes next_key = 2; - - // The namespace the cursor is iterating on - string namespace = 3; - - // The timestamp when the cursor is no longer valid. - google.protobuf.Timestamp expires = 4; -} diff --git a/proto/peers/v1/peers.proto b/proto/peers/v1/peers.proto deleted file mode 100644 index 89fa8e1..0000000 --- a/proto/peers/v1/peers.proto +++ /dev/null @@ -1,51 +0,0 @@ -syntax = "proto3"; - -package honu.peers.v1; -option go_package = "github.com/rotationalio/honu/peers"; - -// Peer contains metadata about how to connect to remote peers in the directory service -// network. This message services as a data-transfer and exchange mechanism for dynamic -// networks with changing membership. -message Peer { - uint64 id = 1; // the process id of the peer must be unique in the network; used for distributed versions - string addr = 2; // the network address to connect to the peer on (don't forget the port!) - string name = 3; // optional - a unique, human readable name for the peer - string region = 4; // optional? - the region the peer is running in - - // Logging information timestamps - string created = 9; - string modified = 10; - - // extra information that might be relevant to process-specific functions; e.g. for - // specific clouds or data that's been parsed (optional). - map extra = 14; -} - -// PeerManagement provides a simple interface for administrators to debug the -// anti-entropy network and to manage services. Note that administrators can also use -// Gossip to perform the same requests, but this service simplifies things. -service PeerManagement { - rpc GetPeers(PeersFilter) returns (PeersList) {}; - rpc AddPeers(Peer) returns (PeersStatus) {}; - rpc RmPeers(Peer) returns (PeersStatus) {}; -} - -// Used to filter the peers that are returned. If no filters are specified then all -// known peers on the remote replica are returned. -message PeersFilter { - repeated string region = 1; // Specify the region(s) to return the peers for. Only effects PeersList not PeersStatus - bool status_only = 2; // Return only the peers status, not a list of peers. -} - -// Returns the list of peers currently known to the replica and its peer management status. -message PeersList { - repeated Peer peers = 1; - PeersStatus status = 2; -} - -// A response to a peer management command that describes the current state of the network. -message PeersStatus { - int64 network_size = 1; // The total number of peers known to the replica (including itself) - map regions = 2; // The number of peers known to the replica per known region - string last_synchronization = 3; // The timestamp of the last synchronization that exchanged data -} \ No newline at end of file diff --git a/proto/region/v1/region.proto b/proto/region/v1/region.proto deleted file mode 100644 index b027264..0000000 --- a/proto/region/v1/region.proto +++ /dev/null @@ -1,163 +0,0 @@ -syntax = "proto3"; - -package honu.region.v1; -option go_package = "github.com/rotationalio/honu/region"; - -import "google/protobuf/timestamp.proto"; - -// Region enumerates the clouds and regions that are available to Honu in order to -// ensure region identification and serialiation is as small a data type as possible. -// Region codes are generally broken into parts: the first digit represents the cloud, -// e.g. a region code that starts with 1 is Linode. The second series of three digits -// represents the country, e.g. USA is 840 in the ISO 3166 standard. The three digits -// represents the zone of the datacenter, and is usually cloud specific. -// NOTE: this guide to the enumeration representation is generally about making the -// definition easier to see and parse; but the exact information of the region should -// be looked up using the RegionInfo struct. -enum Region { - UNKNOWN = 0; - - // Regions 1-999 are reserved for staging and development regions. - STG_LKE_US_EAST_1A = 1; - LOCALHOST = 999; - - // Linode Regions - LKE_AP_WEST_1A = 1356000; - LKE_CA_CENTRAL_1A = 1124010; - LKE_AP_SOUTHEAST_1A = 1036020; - LKE_US_CENTRAL_1A = 1840030; - LKE_US_WEST_1A = 1840040; - LKE_US_SOUTHEAST_1A = 1840050; - LKE_US_EAST_1A = 1840060; - LKE_EU_WEST_1A = 1826070; - LKE_AP_SOUTH_1A = 1702080; - LKE_EU_CENTRAL_1A = 1276090; - LKE_AP_NORTHEAST_1A = 1392100; - - // Google Cloud Regions - GCP_ASIA_EAST_1A = 2158001; - GCP_ASIA_EAST_1B = 2158002; - GCP_ASIA_EAST_1C = 2158003; - GCP_ASIA_EAST_2A = 2344010; - GCP_ASIA_EAST_2B = 2344011; - GCP_ASIA_EAST_2C = 2344012; - GCP_ASIA_NORTHEAST_1A = 2392020; - GCP_ASIA_NORTHEAST_1B = 2392021; - GCP_ASIA_NORTHEAST_1C = 2392022; - GCP_ASIA_NORTHEAST_2A = 2392030; - GCP_ASIA_NORTHEAST_2B = 2392031; - GCP_ASIA_NORTHEAST_2C = 2392032; - GCP_ASIA_NORTHEAST_3A = 2410040; - GCP_ASIA_NORTHEAST_3B = 2410041; - GCP_ASIA_NORTHEAST_3C = 2410042; - GCP_ASIA_SOUTH_1A = 2356051; - GCP_ASIA_SOUTH_1B = 2356052; - GCP_ASIA_SOUTH_1C = 2356053; - GCP_ASIA_SOUTH_2A = 2356061; - GCP_ASIA_SOUTH_2B = 2356062; - GCP_ASIA_SOUTH_2C = 2356063; - GCP_ASIA_SOUTHEAST_1A = 2702070; - GCP_ASIA_SOUTHEAST_1B = 2702071; - GCP_ASIA_SOUTHEAST_1C = 2702072; - GCP_ASIA_SOUTHEAST_2A = 2360080; - GCP_ASIA_SOUTHEAST_2B = 2360081; - GCP_ASIA_SOUTHEAST_2C = 2360082; - GCP_AUSTRALIA_SOUTHEAST_1A = 2036090; - GCP_AUSTRALIA_SOUTHEAST_1B = 2036091; - GCP_AUSTRALIA_SOUTHEAST_1C = 2036092; - GCP_AUSTRALIA_SOUTHEAST_2A = 2036100; - GCP_AUSTRALIA_SOUTHEAST_2B = 2036101; - GCP_AUSTRALIA_SOUTHEAST_2C = 2036102; - GCP_EUROPE_CENTRAL_2A = 2616110; - GCP_EUROPE_CENTRAL_2B = 2616111; - GCP_EUROPE_CENTRAL_2C = 2616112; - GCP_EUROPE_NORTH_1A = 2246120; - GCP_EUROPE_NORTH_1B = 2246121; - GCP_EUROPE_NORTH_1C = 2246122; - GCP_EUROPE_SOUTHWEST_1A = 2724130; - GCP_EUROPE_SOUTHWEST_1B = 2724131; - GCP_EUROPE_SOUTHWEST_1C = 2724132; - GCP_EUROPE_WEST_1B = 2056141; - GCP_EUROPE_WEST_1C = 2056142; - GCP_EUROPE_WEST_1D = 2056143; - GCP_EUROPE_WEST_12A = 2380150; - GCP_EUROPE_WEST_12B = 2380151; - GCP_EUROPE_WEST_12C = 2380152; - GCP_EUROPE_WEST_2A = 2826160; - GCP_EUROPE_WEST_2B = 2826161; - GCP_EUROPE_WEST_2C = 2826162; - GCP_EUROPE_WEST_3A = 2276170; - GCP_EUROPE_WEST_3B = 2276171; - GCP_EUROPE_WEST_3C = 2276172; - GCP_EUROPE_WEST_4A = 2528180; - GCP_EUROPE_WEST_4B = 2528181; - GCP_EUROPE_WEST_4C = 2528182; - GCP_EUROPE_WEST_6A = 2756190; - GCP_EUROPE_WEST_6B = 2756191; - GCP_EUROPE_WEST_6C = 2756192; - GCP_EUROPE_WEST_8A = 2380200; - GCP_EUROPE_WEST_8B = 2380201; - GCP_EUROPE_WEST_8C = 2380202; - GCP_EUROPE_WEST_9A = 2250210; - GCP_EUROPE_WEST_9B = 2250211; - GCP_EUROPE_WEST_9C = 2250212; - GCP_ME_CENTRAL_1A = 2364220; - GCP_ME_CENTRAL_1B = 2364221; - GCP_ME_CENTRAL_1C = 2364222; - GCP_ME_WEST_1A = 2376230; - GCP_ME_WEST_1B = 2376231; - GCP_ME_WEST_1C = 2376232; - GCP_NORTHAMERICA_NORTHEAST_1A = 2124240; - GCP_NORTHAMERICA_NORTHEAST_1B = 2124241; - GCP_NORTHAMERICA_NORTHEAST_1C = 2124242; - GCP_NORTHAMERICA_NORTHEAST_2A = 2124250; - GCP_NORTHAMERICA_NORTHEAST_2B = 2124251; - GCP_NORTHAMERICA_NORTHEAST_2C = 2124252; - GCP_SOUTHAMERICA_EAST_1A = 2076260; - GCP_SOUTHAMERICA_EAST_1B = 2076261; - GCP_SOUTHAMERICA_EAST_1C = 2076262; - GCP_SOUTHAMERICA_WEST_1A = 2152270; - GCP_SOUTHAMERICA_WEST_1B = 2152271; - GCP_SOUTHAMERICA_WEST_1C = 2152272; - GCP_US_CENTRAL_1A = 2840280; - GCP_US_CENTRAL_1B = 2840281; - GCP_US_CENTRAL_1C = 2840282; - GCP_US_CENTRAL_1F = 2840285; - GCP_US_EAST_1B = 2840291; - GCP_US_EAST_1C = 2840292; - GCP_US_EAST_1D = 2840293; - GCP_US_EAST_4A = 2840300; - GCP_US_EAST_4B = 2840301; - GCP_US_EAST_4C = 2840302; - GCP_US_EAST_5A = 2840310; - GCP_US_EAST_5B = 2840311; - GCP_US_EAST_5C = 2840312; - GCP_US_SOUTH_1A = 2840320; - GCP_US_SOUTH_1B = 2840321; - GCP_US_SOUTH_1C = 2840322; - GCP_US_WEST_1A = 2840330; - GCP_US_WEST_1B = 2840331; - GCP_US_WEST_1C = 2840332; - GCP_US_WEST_2A = 2840340; - GCP_US_WEST_2B = 2840341; - GCP_US_WEST_2C = 2840342; - GCP_US_WEST_3A = 2840350; - GCP_US_WEST_3B = 2840351; - GCP_US_WEST_3C = 2840352; - GCP_US_WEST_4A = 2840360; - GCP_US_WEST_4B = 2840361; - GCP_US_WEST_4C = 2840362; -} - -// Geographic metadata for compliance and region-awareness. -message RegionInfo { - Region id = 1; - string name = 2; - string country = 3; - string zone = 4; - string cloud = 5; - string cluster = 6; - - google.protobuf.Timestamp modified = 14; - google.protobuf.Timestamp created = 15; -} \ No newline at end of file diff --git a/proto/replica/v1/replica.proto b/proto/replica/v1/replica.proto deleted file mode 100644 index 0e14111..0000000 --- a/proto/replica/v1/replica.proto +++ /dev/null @@ -1,51 +0,0 @@ -syntax = "proto3"; - -package honu.replica.v1; -option go_package = "github.com/rotationalio/honu/replica"; - -import "object/v1/object.proto"; - -// The Replication Service implements a gossip-based anti-entropy protocol for -// synchronizing replicas around the world. Honu expects total replication, meaning -// all replicas will have a copy of all replicated data (although some data won't be -// replicated). Not only is the Replication service is the mechanism by which data is -// exchanged, but also network membership and discovery. Every replica should -// periodically perform anti-entropy via the Gossip RPC with a randomly selected peer, -// and update its data store via a "latest writer wins"policy. -// -// The Replication Service requires mTLS authentication in order to conduct exchanges. -service Replication { - // Gossip implements biltateral anti-entropy: during a Gossip session the initiating - // replica pushes updates to the remote peer and pulls requested changes. Using - // bidirectional streaming, the initiating peer sends data-less sync messages with - // the versions of objects it stores locally. The remote replica then responds with - // data if its local version is later or sends a sync message back requesting the - // data from the initating replica if its local version is earlier (no exchange) - // occurs if both replicas have the same version. At the end of a gossip session, - // both replicas should have synchronized and have identical underlying data stores. - rpc Gossip(stream Sync) returns (stream Sync) {} -} - -// Sync messages allow replicas to exchange information in a bidirectional stream. -// Because Sync messages are sent in the stream, there are different synchronization -// types. A "check" synchronization sends only the version vector without data, -// requesting the remote peer to check if they have a later version, and if so, return -// it. A "repair" synchronization sends object data back if the sender's version is -// later. A "complete" synchronization indicates that the sender is fully synchronized, -// and an "error" synchronization message says that there was some failure repairing -// the specified version vector. -message Sync { - // Status indicates what state the synchronization is in between peers, allowing - // the replicas to coordinate between multiple sync messages in a grpc stream. - enum Status { - UNKNOWN = 0; // Should not be used as a status - CHECK = 1; // Sync contains version information only - REPAIR = 2; // Sync contains object data information - COMPLETE = 3; // Sync contains no object information, ready to end Gossip - ERROR = 4; // Sync contains object-specific error information - } - - Status status = 1; // The status/type of sync messages - honu.object.v1.Object object = 2; // The object being synchronized - string error = 3; // Error information if the object failed to sync -} \ No newline at end of file diff --git a/region/generate.go b/region/generate.go deleted file mode 100644 index e3b70ea..0000000 --- a/region/generate.go +++ /dev/null @@ -1,3 +0,0 @@ -package region - -//go:generate bash generate.sh diff --git a/region/generate.sh b/region/generate.sh deleted file mode 100644 index 1e6450f..0000000 --- a/region/generate.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash - -PROTOS="${GOPATH}/src/github.com/rotationalio/honu/proto" - -if [[ ! -d $PROTOS ]]; then - echo "cannot find ${PROTOS}" - exit 1 -fi - -if [[ ! -d "./v1" ]]; then - mkdir v1 -fi - -MODULE="github.com/rotationalio/honu/region/v1" -APIMOD="github.com/rotationalio/honu/region/v1;region" - -# Generate the protocol buffers -protoc -I=${PROTOS} \ - --go_out=./v1 --go-grpc_out=./v1 \ - --go_opt=module=${MODULE} \ - --go-grpc_opt=module=${MODULE} \ - --go_opt=Mregion/v1/region.proto="${APIMOD}" \ - --go-grpc_opt=Mregion/v1/region.proto="${APIMOD}" \ - region/v1/region.proto \ No newline at end of file diff --git a/region/v1/region.pb.go b/region/v1/region.pb.go deleted file mode 100644 index fdb4311..0000000 --- a/region/v1/region.pb.go +++ /dev/null @@ -1,871 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.34.1 -// protoc v5.26.1 -// source: region/v1/region.proto - -package region - -import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - timestamppb "google.golang.org/protobuf/types/known/timestamppb" - 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) -) - -// Region enumerates the clouds and regions that are available to Honu in order to -// ensure region identification and serialiation is as small a data type as possible. -// Region codes are generally broken into parts: the first digit represents the cloud, -// e.g. a region code that starts with 1 is Linode. The second series of three digits -// represents the country, e.g. USA is 840 in the ISO 3166 standard. The three digits -// represents the zone of the datacenter, and is usually cloud specific. -// NOTE: this guide to the enumeration representation is generally about making the -// definition easier to see and parse; but the exact information of the region should -// be looked up using the RegionInfo struct. -type Region int32 - -const ( - Region_UNKNOWN Region = 0 - // Regions 1-999 are reserved for staging and development regions. - Region_STG_LKE_US_EAST_1A Region = 1 - Region_LOCALHOST Region = 999 - // Linode Regions - Region_LKE_AP_WEST_1A Region = 1356000 - Region_LKE_CA_CENTRAL_1A Region = 1124010 - Region_LKE_AP_SOUTHEAST_1A Region = 1036020 - Region_LKE_US_CENTRAL_1A Region = 1840030 - Region_LKE_US_WEST_1A Region = 1840040 - Region_LKE_US_SOUTHEAST_1A Region = 1840050 - Region_LKE_US_EAST_1A Region = 1840060 - Region_LKE_EU_WEST_1A Region = 1826070 - Region_LKE_AP_SOUTH_1A Region = 1702080 - Region_LKE_EU_CENTRAL_1A Region = 1276090 - Region_LKE_AP_NORTHEAST_1A Region = 1392100 - // Google Cloud Regions - Region_GCP_ASIA_EAST_1A Region = 2158001 - Region_GCP_ASIA_EAST_1B Region = 2158002 - Region_GCP_ASIA_EAST_1C Region = 2158003 - Region_GCP_ASIA_EAST_2A Region = 2344010 - Region_GCP_ASIA_EAST_2B Region = 2344011 - Region_GCP_ASIA_EAST_2C Region = 2344012 - Region_GCP_ASIA_NORTHEAST_1A Region = 2392020 - Region_GCP_ASIA_NORTHEAST_1B Region = 2392021 - Region_GCP_ASIA_NORTHEAST_1C Region = 2392022 - Region_GCP_ASIA_NORTHEAST_2A Region = 2392030 - Region_GCP_ASIA_NORTHEAST_2B Region = 2392031 - Region_GCP_ASIA_NORTHEAST_2C Region = 2392032 - Region_GCP_ASIA_NORTHEAST_3A Region = 2410040 - Region_GCP_ASIA_NORTHEAST_3B Region = 2410041 - Region_GCP_ASIA_NORTHEAST_3C Region = 2410042 - Region_GCP_ASIA_SOUTH_1A Region = 2356051 - Region_GCP_ASIA_SOUTH_1B Region = 2356052 - Region_GCP_ASIA_SOUTH_1C Region = 2356053 - Region_GCP_ASIA_SOUTH_2A Region = 2356061 - Region_GCP_ASIA_SOUTH_2B Region = 2356062 - Region_GCP_ASIA_SOUTH_2C Region = 2356063 - Region_GCP_ASIA_SOUTHEAST_1A Region = 2702070 - Region_GCP_ASIA_SOUTHEAST_1B Region = 2702071 - Region_GCP_ASIA_SOUTHEAST_1C Region = 2702072 - Region_GCP_ASIA_SOUTHEAST_2A Region = 2360080 - Region_GCP_ASIA_SOUTHEAST_2B Region = 2360081 - Region_GCP_ASIA_SOUTHEAST_2C Region = 2360082 - Region_GCP_AUSTRALIA_SOUTHEAST_1A Region = 2036090 - Region_GCP_AUSTRALIA_SOUTHEAST_1B Region = 2036091 - Region_GCP_AUSTRALIA_SOUTHEAST_1C Region = 2036092 - Region_GCP_AUSTRALIA_SOUTHEAST_2A Region = 2036100 - Region_GCP_AUSTRALIA_SOUTHEAST_2B Region = 2036101 - Region_GCP_AUSTRALIA_SOUTHEAST_2C Region = 2036102 - Region_GCP_EUROPE_CENTRAL_2A Region = 2616110 - Region_GCP_EUROPE_CENTRAL_2B Region = 2616111 - Region_GCP_EUROPE_CENTRAL_2C Region = 2616112 - Region_GCP_EUROPE_NORTH_1A Region = 2246120 - Region_GCP_EUROPE_NORTH_1B Region = 2246121 - Region_GCP_EUROPE_NORTH_1C Region = 2246122 - Region_GCP_EUROPE_SOUTHWEST_1A Region = 2724130 - Region_GCP_EUROPE_SOUTHWEST_1B Region = 2724131 - Region_GCP_EUROPE_SOUTHWEST_1C Region = 2724132 - Region_GCP_EUROPE_WEST_1B Region = 2056141 - Region_GCP_EUROPE_WEST_1C Region = 2056142 - Region_GCP_EUROPE_WEST_1D Region = 2056143 - Region_GCP_EUROPE_WEST_12A Region = 2380150 - Region_GCP_EUROPE_WEST_12B Region = 2380151 - Region_GCP_EUROPE_WEST_12C Region = 2380152 - Region_GCP_EUROPE_WEST_2A Region = 2826160 - Region_GCP_EUROPE_WEST_2B Region = 2826161 - Region_GCP_EUROPE_WEST_2C Region = 2826162 - Region_GCP_EUROPE_WEST_3A Region = 2276170 - Region_GCP_EUROPE_WEST_3B Region = 2276171 - Region_GCP_EUROPE_WEST_3C Region = 2276172 - Region_GCP_EUROPE_WEST_4A Region = 2528180 - Region_GCP_EUROPE_WEST_4B Region = 2528181 - Region_GCP_EUROPE_WEST_4C Region = 2528182 - Region_GCP_EUROPE_WEST_6A Region = 2756190 - Region_GCP_EUROPE_WEST_6B Region = 2756191 - Region_GCP_EUROPE_WEST_6C Region = 2756192 - Region_GCP_EUROPE_WEST_8A Region = 2380200 - Region_GCP_EUROPE_WEST_8B Region = 2380201 - Region_GCP_EUROPE_WEST_8C Region = 2380202 - Region_GCP_EUROPE_WEST_9A Region = 2250210 - Region_GCP_EUROPE_WEST_9B Region = 2250211 - Region_GCP_EUROPE_WEST_9C Region = 2250212 - Region_GCP_ME_CENTRAL_1A Region = 2364220 - Region_GCP_ME_CENTRAL_1B Region = 2364221 - Region_GCP_ME_CENTRAL_1C Region = 2364222 - Region_GCP_ME_WEST_1A Region = 2376230 - Region_GCP_ME_WEST_1B Region = 2376231 - Region_GCP_ME_WEST_1C Region = 2376232 - Region_GCP_NORTHAMERICA_NORTHEAST_1A Region = 2124240 - Region_GCP_NORTHAMERICA_NORTHEAST_1B Region = 2124241 - Region_GCP_NORTHAMERICA_NORTHEAST_1C Region = 2124242 - Region_GCP_NORTHAMERICA_NORTHEAST_2A Region = 2124250 - Region_GCP_NORTHAMERICA_NORTHEAST_2B Region = 2124251 - Region_GCP_NORTHAMERICA_NORTHEAST_2C Region = 2124252 - Region_GCP_SOUTHAMERICA_EAST_1A Region = 2076260 - Region_GCP_SOUTHAMERICA_EAST_1B Region = 2076261 - Region_GCP_SOUTHAMERICA_EAST_1C Region = 2076262 - Region_GCP_SOUTHAMERICA_WEST_1A Region = 2152270 - Region_GCP_SOUTHAMERICA_WEST_1B Region = 2152271 - Region_GCP_SOUTHAMERICA_WEST_1C Region = 2152272 - Region_GCP_US_CENTRAL_1A Region = 2840280 - Region_GCP_US_CENTRAL_1B Region = 2840281 - Region_GCP_US_CENTRAL_1C Region = 2840282 - Region_GCP_US_CENTRAL_1F Region = 2840285 - Region_GCP_US_EAST_1B Region = 2840291 - Region_GCP_US_EAST_1C Region = 2840292 - Region_GCP_US_EAST_1D Region = 2840293 - Region_GCP_US_EAST_4A Region = 2840300 - Region_GCP_US_EAST_4B Region = 2840301 - Region_GCP_US_EAST_4C Region = 2840302 - Region_GCP_US_EAST_5A Region = 2840310 - Region_GCP_US_EAST_5B Region = 2840311 - Region_GCP_US_EAST_5C Region = 2840312 - Region_GCP_US_SOUTH_1A Region = 2840320 - Region_GCP_US_SOUTH_1B Region = 2840321 - Region_GCP_US_SOUTH_1C Region = 2840322 - Region_GCP_US_WEST_1A Region = 2840330 - Region_GCP_US_WEST_1B Region = 2840331 - Region_GCP_US_WEST_1C Region = 2840332 - Region_GCP_US_WEST_2A Region = 2840340 - Region_GCP_US_WEST_2B Region = 2840341 - Region_GCP_US_WEST_2C Region = 2840342 - Region_GCP_US_WEST_3A Region = 2840350 - Region_GCP_US_WEST_3B Region = 2840351 - Region_GCP_US_WEST_3C Region = 2840352 - Region_GCP_US_WEST_4A Region = 2840360 - Region_GCP_US_WEST_4B Region = 2840361 - Region_GCP_US_WEST_4C Region = 2840362 -) - -// Enum value maps for Region. -var ( - Region_name = map[int32]string{ - 0: "UNKNOWN", - 1: "STG_LKE_US_EAST_1A", - 999: "LOCALHOST", - 1356000: "LKE_AP_WEST_1A", - 1124010: "LKE_CA_CENTRAL_1A", - 1036020: "LKE_AP_SOUTHEAST_1A", - 1840030: "LKE_US_CENTRAL_1A", - 1840040: "LKE_US_WEST_1A", - 1840050: "LKE_US_SOUTHEAST_1A", - 1840060: "LKE_US_EAST_1A", - 1826070: "LKE_EU_WEST_1A", - 1702080: "LKE_AP_SOUTH_1A", - 1276090: "LKE_EU_CENTRAL_1A", - 1392100: "LKE_AP_NORTHEAST_1A", - 2158001: "GCP_ASIA_EAST_1A", - 2158002: "GCP_ASIA_EAST_1B", - 2158003: "GCP_ASIA_EAST_1C", - 2344010: "GCP_ASIA_EAST_2A", - 2344011: "GCP_ASIA_EAST_2B", - 2344012: "GCP_ASIA_EAST_2C", - 2392020: "GCP_ASIA_NORTHEAST_1A", - 2392021: "GCP_ASIA_NORTHEAST_1B", - 2392022: "GCP_ASIA_NORTHEAST_1C", - 2392030: "GCP_ASIA_NORTHEAST_2A", - 2392031: "GCP_ASIA_NORTHEAST_2B", - 2392032: "GCP_ASIA_NORTHEAST_2C", - 2410040: "GCP_ASIA_NORTHEAST_3A", - 2410041: "GCP_ASIA_NORTHEAST_3B", - 2410042: "GCP_ASIA_NORTHEAST_3C", - 2356051: "GCP_ASIA_SOUTH_1A", - 2356052: "GCP_ASIA_SOUTH_1B", - 2356053: "GCP_ASIA_SOUTH_1C", - 2356061: "GCP_ASIA_SOUTH_2A", - 2356062: "GCP_ASIA_SOUTH_2B", - 2356063: "GCP_ASIA_SOUTH_2C", - 2702070: "GCP_ASIA_SOUTHEAST_1A", - 2702071: "GCP_ASIA_SOUTHEAST_1B", - 2702072: "GCP_ASIA_SOUTHEAST_1C", - 2360080: "GCP_ASIA_SOUTHEAST_2A", - 2360081: "GCP_ASIA_SOUTHEAST_2B", - 2360082: "GCP_ASIA_SOUTHEAST_2C", - 2036090: "GCP_AUSTRALIA_SOUTHEAST_1A", - 2036091: "GCP_AUSTRALIA_SOUTHEAST_1B", - 2036092: "GCP_AUSTRALIA_SOUTHEAST_1C", - 2036100: "GCP_AUSTRALIA_SOUTHEAST_2A", - 2036101: "GCP_AUSTRALIA_SOUTHEAST_2B", - 2036102: "GCP_AUSTRALIA_SOUTHEAST_2C", - 2616110: "GCP_EUROPE_CENTRAL_2A", - 2616111: "GCP_EUROPE_CENTRAL_2B", - 2616112: "GCP_EUROPE_CENTRAL_2C", - 2246120: "GCP_EUROPE_NORTH_1A", - 2246121: "GCP_EUROPE_NORTH_1B", - 2246122: "GCP_EUROPE_NORTH_1C", - 2724130: "GCP_EUROPE_SOUTHWEST_1A", - 2724131: "GCP_EUROPE_SOUTHWEST_1B", - 2724132: "GCP_EUROPE_SOUTHWEST_1C", - 2056141: "GCP_EUROPE_WEST_1B", - 2056142: "GCP_EUROPE_WEST_1C", - 2056143: "GCP_EUROPE_WEST_1D", - 2380150: "GCP_EUROPE_WEST_12A", - 2380151: "GCP_EUROPE_WEST_12B", - 2380152: "GCP_EUROPE_WEST_12C", - 2826160: "GCP_EUROPE_WEST_2A", - 2826161: "GCP_EUROPE_WEST_2B", - 2826162: "GCP_EUROPE_WEST_2C", - 2276170: "GCP_EUROPE_WEST_3A", - 2276171: "GCP_EUROPE_WEST_3B", - 2276172: "GCP_EUROPE_WEST_3C", - 2528180: "GCP_EUROPE_WEST_4A", - 2528181: "GCP_EUROPE_WEST_4B", - 2528182: "GCP_EUROPE_WEST_4C", - 2756190: "GCP_EUROPE_WEST_6A", - 2756191: "GCP_EUROPE_WEST_6B", - 2756192: "GCP_EUROPE_WEST_6C", - 2380200: "GCP_EUROPE_WEST_8A", - 2380201: "GCP_EUROPE_WEST_8B", - 2380202: "GCP_EUROPE_WEST_8C", - 2250210: "GCP_EUROPE_WEST_9A", - 2250211: "GCP_EUROPE_WEST_9B", - 2250212: "GCP_EUROPE_WEST_9C", - 2364220: "GCP_ME_CENTRAL_1A", - 2364221: "GCP_ME_CENTRAL_1B", - 2364222: "GCP_ME_CENTRAL_1C", - 2376230: "GCP_ME_WEST_1A", - 2376231: "GCP_ME_WEST_1B", - 2376232: "GCP_ME_WEST_1C", - 2124240: "GCP_NORTHAMERICA_NORTHEAST_1A", - 2124241: "GCP_NORTHAMERICA_NORTHEAST_1B", - 2124242: "GCP_NORTHAMERICA_NORTHEAST_1C", - 2124250: "GCP_NORTHAMERICA_NORTHEAST_2A", - 2124251: "GCP_NORTHAMERICA_NORTHEAST_2B", - 2124252: "GCP_NORTHAMERICA_NORTHEAST_2C", - 2076260: "GCP_SOUTHAMERICA_EAST_1A", - 2076261: "GCP_SOUTHAMERICA_EAST_1B", - 2076262: "GCP_SOUTHAMERICA_EAST_1C", - 2152270: "GCP_SOUTHAMERICA_WEST_1A", - 2152271: "GCP_SOUTHAMERICA_WEST_1B", - 2152272: "GCP_SOUTHAMERICA_WEST_1C", - 2840280: "GCP_US_CENTRAL_1A", - 2840281: "GCP_US_CENTRAL_1B", - 2840282: "GCP_US_CENTRAL_1C", - 2840285: "GCP_US_CENTRAL_1F", - 2840291: "GCP_US_EAST_1B", - 2840292: "GCP_US_EAST_1C", - 2840293: "GCP_US_EAST_1D", - 2840300: "GCP_US_EAST_4A", - 2840301: "GCP_US_EAST_4B", - 2840302: "GCP_US_EAST_4C", - 2840310: "GCP_US_EAST_5A", - 2840311: "GCP_US_EAST_5B", - 2840312: "GCP_US_EAST_5C", - 2840320: "GCP_US_SOUTH_1A", - 2840321: "GCP_US_SOUTH_1B", - 2840322: "GCP_US_SOUTH_1C", - 2840330: "GCP_US_WEST_1A", - 2840331: "GCP_US_WEST_1B", - 2840332: "GCP_US_WEST_1C", - 2840340: "GCP_US_WEST_2A", - 2840341: "GCP_US_WEST_2B", - 2840342: "GCP_US_WEST_2C", - 2840350: "GCP_US_WEST_3A", - 2840351: "GCP_US_WEST_3B", - 2840352: "GCP_US_WEST_3C", - 2840360: "GCP_US_WEST_4A", - 2840361: "GCP_US_WEST_4B", - 2840362: "GCP_US_WEST_4C", - } - Region_value = map[string]int32{ - "UNKNOWN": 0, - "STG_LKE_US_EAST_1A": 1, - "LOCALHOST": 999, - "LKE_AP_WEST_1A": 1356000, - "LKE_CA_CENTRAL_1A": 1124010, - "LKE_AP_SOUTHEAST_1A": 1036020, - "LKE_US_CENTRAL_1A": 1840030, - "LKE_US_WEST_1A": 1840040, - "LKE_US_SOUTHEAST_1A": 1840050, - "LKE_US_EAST_1A": 1840060, - "LKE_EU_WEST_1A": 1826070, - "LKE_AP_SOUTH_1A": 1702080, - "LKE_EU_CENTRAL_1A": 1276090, - "LKE_AP_NORTHEAST_1A": 1392100, - "GCP_ASIA_EAST_1A": 2158001, - "GCP_ASIA_EAST_1B": 2158002, - "GCP_ASIA_EAST_1C": 2158003, - "GCP_ASIA_EAST_2A": 2344010, - "GCP_ASIA_EAST_2B": 2344011, - "GCP_ASIA_EAST_2C": 2344012, - "GCP_ASIA_NORTHEAST_1A": 2392020, - "GCP_ASIA_NORTHEAST_1B": 2392021, - "GCP_ASIA_NORTHEAST_1C": 2392022, - "GCP_ASIA_NORTHEAST_2A": 2392030, - "GCP_ASIA_NORTHEAST_2B": 2392031, - "GCP_ASIA_NORTHEAST_2C": 2392032, - "GCP_ASIA_NORTHEAST_3A": 2410040, - "GCP_ASIA_NORTHEAST_3B": 2410041, - "GCP_ASIA_NORTHEAST_3C": 2410042, - "GCP_ASIA_SOUTH_1A": 2356051, - "GCP_ASIA_SOUTH_1B": 2356052, - "GCP_ASIA_SOUTH_1C": 2356053, - "GCP_ASIA_SOUTH_2A": 2356061, - "GCP_ASIA_SOUTH_2B": 2356062, - "GCP_ASIA_SOUTH_2C": 2356063, - "GCP_ASIA_SOUTHEAST_1A": 2702070, - "GCP_ASIA_SOUTHEAST_1B": 2702071, - "GCP_ASIA_SOUTHEAST_1C": 2702072, - "GCP_ASIA_SOUTHEAST_2A": 2360080, - "GCP_ASIA_SOUTHEAST_2B": 2360081, - "GCP_ASIA_SOUTHEAST_2C": 2360082, - "GCP_AUSTRALIA_SOUTHEAST_1A": 2036090, - "GCP_AUSTRALIA_SOUTHEAST_1B": 2036091, - "GCP_AUSTRALIA_SOUTHEAST_1C": 2036092, - "GCP_AUSTRALIA_SOUTHEAST_2A": 2036100, - "GCP_AUSTRALIA_SOUTHEAST_2B": 2036101, - "GCP_AUSTRALIA_SOUTHEAST_2C": 2036102, - "GCP_EUROPE_CENTRAL_2A": 2616110, - "GCP_EUROPE_CENTRAL_2B": 2616111, - "GCP_EUROPE_CENTRAL_2C": 2616112, - "GCP_EUROPE_NORTH_1A": 2246120, - "GCP_EUROPE_NORTH_1B": 2246121, - "GCP_EUROPE_NORTH_1C": 2246122, - "GCP_EUROPE_SOUTHWEST_1A": 2724130, - "GCP_EUROPE_SOUTHWEST_1B": 2724131, - "GCP_EUROPE_SOUTHWEST_1C": 2724132, - "GCP_EUROPE_WEST_1B": 2056141, - "GCP_EUROPE_WEST_1C": 2056142, - "GCP_EUROPE_WEST_1D": 2056143, - "GCP_EUROPE_WEST_12A": 2380150, - "GCP_EUROPE_WEST_12B": 2380151, - "GCP_EUROPE_WEST_12C": 2380152, - "GCP_EUROPE_WEST_2A": 2826160, - "GCP_EUROPE_WEST_2B": 2826161, - "GCP_EUROPE_WEST_2C": 2826162, - "GCP_EUROPE_WEST_3A": 2276170, - "GCP_EUROPE_WEST_3B": 2276171, - "GCP_EUROPE_WEST_3C": 2276172, - "GCP_EUROPE_WEST_4A": 2528180, - "GCP_EUROPE_WEST_4B": 2528181, - "GCP_EUROPE_WEST_4C": 2528182, - "GCP_EUROPE_WEST_6A": 2756190, - "GCP_EUROPE_WEST_6B": 2756191, - "GCP_EUROPE_WEST_6C": 2756192, - "GCP_EUROPE_WEST_8A": 2380200, - "GCP_EUROPE_WEST_8B": 2380201, - "GCP_EUROPE_WEST_8C": 2380202, - "GCP_EUROPE_WEST_9A": 2250210, - "GCP_EUROPE_WEST_9B": 2250211, - "GCP_EUROPE_WEST_9C": 2250212, - "GCP_ME_CENTRAL_1A": 2364220, - "GCP_ME_CENTRAL_1B": 2364221, - "GCP_ME_CENTRAL_1C": 2364222, - "GCP_ME_WEST_1A": 2376230, - "GCP_ME_WEST_1B": 2376231, - "GCP_ME_WEST_1C": 2376232, - "GCP_NORTHAMERICA_NORTHEAST_1A": 2124240, - "GCP_NORTHAMERICA_NORTHEAST_1B": 2124241, - "GCP_NORTHAMERICA_NORTHEAST_1C": 2124242, - "GCP_NORTHAMERICA_NORTHEAST_2A": 2124250, - "GCP_NORTHAMERICA_NORTHEAST_2B": 2124251, - "GCP_NORTHAMERICA_NORTHEAST_2C": 2124252, - "GCP_SOUTHAMERICA_EAST_1A": 2076260, - "GCP_SOUTHAMERICA_EAST_1B": 2076261, - "GCP_SOUTHAMERICA_EAST_1C": 2076262, - "GCP_SOUTHAMERICA_WEST_1A": 2152270, - "GCP_SOUTHAMERICA_WEST_1B": 2152271, - "GCP_SOUTHAMERICA_WEST_1C": 2152272, - "GCP_US_CENTRAL_1A": 2840280, - "GCP_US_CENTRAL_1B": 2840281, - "GCP_US_CENTRAL_1C": 2840282, - "GCP_US_CENTRAL_1F": 2840285, - "GCP_US_EAST_1B": 2840291, - "GCP_US_EAST_1C": 2840292, - "GCP_US_EAST_1D": 2840293, - "GCP_US_EAST_4A": 2840300, - "GCP_US_EAST_4B": 2840301, - "GCP_US_EAST_4C": 2840302, - "GCP_US_EAST_5A": 2840310, - "GCP_US_EAST_5B": 2840311, - "GCP_US_EAST_5C": 2840312, - "GCP_US_SOUTH_1A": 2840320, - "GCP_US_SOUTH_1B": 2840321, - "GCP_US_SOUTH_1C": 2840322, - "GCP_US_WEST_1A": 2840330, - "GCP_US_WEST_1B": 2840331, - "GCP_US_WEST_1C": 2840332, - "GCP_US_WEST_2A": 2840340, - "GCP_US_WEST_2B": 2840341, - "GCP_US_WEST_2C": 2840342, - "GCP_US_WEST_3A": 2840350, - "GCP_US_WEST_3B": 2840351, - "GCP_US_WEST_3C": 2840352, - "GCP_US_WEST_4A": 2840360, - "GCP_US_WEST_4B": 2840361, - "GCP_US_WEST_4C": 2840362, - } -) - -func (x Region) Enum() *Region { - p := new(Region) - *p = x - return p -} - -func (x Region) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (Region) Descriptor() protoreflect.EnumDescriptor { - return file_region_v1_region_proto_enumTypes[0].Descriptor() -} - -func (Region) Type() protoreflect.EnumType { - return &file_region_v1_region_proto_enumTypes[0] -} - -func (x Region) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use Region.Descriptor instead. -func (Region) EnumDescriptor() ([]byte, []int) { - return file_region_v1_region_proto_rawDescGZIP(), []int{0} -} - -// Geographic metadata for compliance and region-awareness. -type RegionInfo struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Id Region `protobuf:"varint,1,opt,name=id,proto3,enum=honu.region.v1.Region" json:"id,omitempty"` - Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` - Country string `protobuf:"bytes,3,opt,name=country,proto3" json:"country,omitempty"` - Zone string `protobuf:"bytes,4,opt,name=zone,proto3" json:"zone,omitempty"` - Cloud string `protobuf:"bytes,5,opt,name=cloud,proto3" json:"cloud,omitempty"` - Cluster string `protobuf:"bytes,6,opt,name=cluster,proto3" json:"cluster,omitempty"` - Modified *timestamppb.Timestamp `protobuf:"bytes,14,opt,name=modified,proto3" json:"modified,omitempty"` - Created *timestamppb.Timestamp `protobuf:"bytes,15,opt,name=created,proto3" json:"created,omitempty"` -} - -func (x *RegionInfo) Reset() { - *x = RegionInfo{} - if protoimpl.UnsafeEnabled { - mi := &file_region_v1_region_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *RegionInfo) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*RegionInfo) ProtoMessage() {} - -func (x *RegionInfo) ProtoReflect() protoreflect.Message { - mi := &file_region_v1_region_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) -} - -// Deprecated: Use RegionInfo.ProtoReflect.Descriptor instead. -func (*RegionInfo) Descriptor() ([]byte, []int) { - return file_region_v1_region_proto_rawDescGZIP(), []int{0} -} - -func (x *RegionInfo) GetId() Region { - if x != nil { - return x.Id - } - return Region_UNKNOWN -} - -func (x *RegionInfo) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *RegionInfo) GetCountry() string { - if x != nil { - return x.Country - } - return "" -} - -func (x *RegionInfo) GetZone() string { - if x != nil { - return x.Zone - } - return "" -} - -func (x *RegionInfo) GetCloud() string { - if x != nil { - return x.Cloud - } - return "" -} - -func (x *RegionInfo) GetCluster() string { - if x != nil { - return x.Cluster - } - return "" -} - -func (x *RegionInfo) GetModified() *timestamppb.Timestamp { - if x != nil { - return x.Modified - } - return nil -} - -func (x *RegionInfo) GetCreated() *timestamppb.Timestamp { - if x != nil { - return x.Created - } - return nil -} - -var File_region_v1_region_proto protoreflect.FileDescriptor - -var file_region_v1_region_proto_rawDesc = []byte{ - 0x0a, 0x16, 0x72, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x2f, 0x76, 0x31, 0x2f, 0x72, 0x65, 0x67, 0x69, - 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0e, 0x68, 0x6f, 0x6e, 0x75, 0x2e, 0x72, - 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, - 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, - 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x94, 0x02, 0x0a, 0x0a, 0x52, 0x65, - 0x67, 0x69, 0x6f, 0x6e, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x26, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0e, 0x32, 0x16, 0x2e, 0x68, 0x6f, 0x6e, 0x75, 0x2e, 0x72, 0x65, 0x67, 0x69, - 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x52, 0x02, 0x69, 0x64, - 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, - 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x72, 0x79, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x12, - 0x0a, 0x04, 0x7a, 0x6f, 0x6e, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x7a, 0x6f, - 0x6e, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x05, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6c, 0x75, 0x73, - 0x74, 0x65, 0x72, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6c, 0x75, 0x73, 0x74, - 0x65, 0x72, 0x12, 0x36, 0x0a, 0x08, 0x6d, 0x6f, 0x64, 0x69, 0x66, 0x69, 0x65, 0x64, 0x18, 0x0e, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, - 0x52, 0x08, 0x6d, 0x6f, 0x64, 0x69, 0x66, 0x69, 0x65, 0x64, 0x12, 0x34, 0x0a, 0x07, 0x63, 0x72, - 0x65, 0x61, 0x74, 0x65, 0x64, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, - 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, - 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x07, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, - 0x2a, 0xeb, 0x1a, 0x0a, 0x06, 0x52, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x12, 0x0b, 0x0a, 0x07, 0x55, - 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x16, 0x0a, 0x12, 0x53, 0x54, 0x47, 0x5f, - 0x4c, 0x4b, 0x45, 0x5f, 0x55, 0x53, 0x5f, 0x45, 0x41, 0x53, 0x54, 0x5f, 0x31, 0x41, 0x10, 0x01, - 0x12, 0x0e, 0x0a, 0x09, 0x4c, 0x4f, 0x43, 0x41, 0x4c, 0x48, 0x4f, 0x53, 0x54, 0x10, 0xe7, 0x07, - 0x12, 0x14, 0x0a, 0x0e, 0x4c, 0x4b, 0x45, 0x5f, 0x41, 0x50, 0x5f, 0x57, 0x45, 0x53, 0x54, 0x5f, - 0x31, 0x41, 0x10, 0xe0, 0xe1, 0x52, 0x12, 0x17, 0x0a, 0x11, 0x4c, 0x4b, 0x45, 0x5f, 0x43, 0x41, - 0x5f, 0x43, 0x45, 0x4e, 0x54, 0x52, 0x41, 0x4c, 0x5f, 0x31, 0x41, 0x10, 0xaa, 0xcd, 0x44, 0x12, - 0x19, 0x0a, 0x13, 0x4c, 0x4b, 0x45, 0x5f, 0x41, 0x50, 0x5f, 0x53, 0x4f, 0x55, 0x54, 0x48, 0x45, - 0x41, 0x53, 0x54, 0x5f, 0x31, 0x41, 0x10, 0xf4, 0x9d, 0x3f, 0x12, 0x17, 0x0a, 0x11, 0x4c, 0x4b, - 0x45, 0x5f, 0x55, 0x53, 0x5f, 0x43, 0x45, 0x4e, 0x54, 0x52, 0x41, 0x4c, 0x5f, 0x31, 0x41, 0x10, - 0x9e, 0xa7, 0x70, 0x12, 0x14, 0x0a, 0x0e, 0x4c, 0x4b, 0x45, 0x5f, 0x55, 0x53, 0x5f, 0x57, 0x45, - 0x53, 0x54, 0x5f, 0x31, 0x41, 0x10, 0xa8, 0xa7, 0x70, 0x12, 0x19, 0x0a, 0x13, 0x4c, 0x4b, 0x45, - 0x5f, 0x55, 0x53, 0x5f, 0x53, 0x4f, 0x55, 0x54, 0x48, 0x45, 0x41, 0x53, 0x54, 0x5f, 0x31, 0x41, - 0x10, 0xb2, 0xa7, 0x70, 0x12, 0x14, 0x0a, 0x0e, 0x4c, 0x4b, 0x45, 0x5f, 0x55, 0x53, 0x5f, 0x45, - 0x41, 0x53, 0x54, 0x5f, 0x31, 0x41, 0x10, 0xbc, 0xa7, 0x70, 0x12, 0x14, 0x0a, 0x0e, 0x4c, 0x4b, - 0x45, 0x5f, 0x45, 0x55, 0x5f, 0x57, 0x45, 0x53, 0x54, 0x5f, 0x31, 0x41, 0x10, 0x96, 0xba, 0x6f, - 0x12, 0x15, 0x0a, 0x0f, 0x4c, 0x4b, 0x45, 0x5f, 0x41, 0x50, 0x5f, 0x53, 0x4f, 0x55, 0x54, 0x48, - 0x5f, 0x31, 0x41, 0x10, 0xc0, 0xf1, 0x67, 0x12, 0x17, 0x0a, 0x11, 0x4c, 0x4b, 0x45, 0x5f, 0x45, - 0x55, 0x5f, 0x43, 0x45, 0x4e, 0x54, 0x52, 0x41, 0x4c, 0x5f, 0x31, 0x41, 0x10, 0xba, 0xf1, 0x4d, - 0x12, 0x19, 0x0a, 0x13, 0x4c, 0x4b, 0x45, 0x5f, 0x41, 0x50, 0x5f, 0x4e, 0x4f, 0x52, 0x54, 0x48, - 0x45, 0x41, 0x53, 0x54, 0x5f, 0x31, 0x41, 0x10, 0xe4, 0xfb, 0x54, 0x12, 0x17, 0x0a, 0x10, 0x47, - 0x43, 0x50, 0x5f, 0x41, 0x53, 0x49, 0x41, 0x5f, 0x45, 0x41, 0x53, 0x54, 0x5f, 0x31, 0x41, 0x10, - 0xb1, 0xdb, 0x83, 0x01, 0x12, 0x17, 0x0a, 0x10, 0x47, 0x43, 0x50, 0x5f, 0x41, 0x53, 0x49, 0x41, - 0x5f, 0x45, 0x41, 0x53, 0x54, 0x5f, 0x31, 0x42, 0x10, 0xb2, 0xdb, 0x83, 0x01, 0x12, 0x17, 0x0a, - 0x10, 0x47, 0x43, 0x50, 0x5f, 0x41, 0x53, 0x49, 0x41, 0x5f, 0x45, 0x41, 0x53, 0x54, 0x5f, 0x31, - 0x43, 0x10, 0xb3, 0xdb, 0x83, 0x01, 0x12, 0x17, 0x0a, 0x10, 0x47, 0x43, 0x50, 0x5f, 0x41, 0x53, - 0x49, 0x41, 0x5f, 0x45, 0x41, 0x53, 0x54, 0x5f, 0x32, 0x41, 0x10, 0xca, 0x88, 0x8f, 0x01, 0x12, - 0x17, 0x0a, 0x10, 0x47, 0x43, 0x50, 0x5f, 0x41, 0x53, 0x49, 0x41, 0x5f, 0x45, 0x41, 0x53, 0x54, - 0x5f, 0x32, 0x42, 0x10, 0xcb, 0x88, 0x8f, 0x01, 0x12, 0x17, 0x0a, 0x10, 0x47, 0x43, 0x50, 0x5f, - 0x41, 0x53, 0x49, 0x41, 0x5f, 0x45, 0x41, 0x53, 0x54, 0x5f, 0x32, 0x43, 0x10, 0xcc, 0x88, 0x8f, - 0x01, 0x12, 0x1c, 0x0a, 0x15, 0x47, 0x43, 0x50, 0x5f, 0x41, 0x53, 0x49, 0x41, 0x5f, 0x4e, 0x4f, - 0x52, 0x54, 0x48, 0x45, 0x41, 0x53, 0x54, 0x5f, 0x31, 0x41, 0x10, 0xd4, 0xff, 0x91, 0x01, 0x12, - 0x1c, 0x0a, 0x15, 0x47, 0x43, 0x50, 0x5f, 0x41, 0x53, 0x49, 0x41, 0x5f, 0x4e, 0x4f, 0x52, 0x54, - 0x48, 0x45, 0x41, 0x53, 0x54, 0x5f, 0x31, 0x42, 0x10, 0xd5, 0xff, 0x91, 0x01, 0x12, 0x1c, 0x0a, - 0x15, 0x47, 0x43, 0x50, 0x5f, 0x41, 0x53, 0x49, 0x41, 0x5f, 0x4e, 0x4f, 0x52, 0x54, 0x48, 0x45, - 0x41, 0x53, 0x54, 0x5f, 0x31, 0x43, 0x10, 0xd6, 0xff, 0x91, 0x01, 0x12, 0x1c, 0x0a, 0x15, 0x47, - 0x43, 0x50, 0x5f, 0x41, 0x53, 0x49, 0x41, 0x5f, 0x4e, 0x4f, 0x52, 0x54, 0x48, 0x45, 0x41, 0x53, - 0x54, 0x5f, 0x32, 0x41, 0x10, 0xde, 0xff, 0x91, 0x01, 0x12, 0x1c, 0x0a, 0x15, 0x47, 0x43, 0x50, - 0x5f, 0x41, 0x53, 0x49, 0x41, 0x5f, 0x4e, 0x4f, 0x52, 0x54, 0x48, 0x45, 0x41, 0x53, 0x54, 0x5f, - 0x32, 0x42, 0x10, 0xdf, 0xff, 0x91, 0x01, 0x12, 0x1c, 0x0a, 0x15, 0x47, 0x43, 0x50, 0x5f, 0x41, - 0x53, 0x49, 0x41, 0x5f, 0x4e, 0x4f, 0x52, 0x54, 0x48, 0x45, 0x41, 0x53, 0x54, 0x5f, 0x32, 0x43, - 0x10, 0xe0, 0xff, 0x91, 0x01, 0x12, 0x1c, 0x0a, 0x15, 0x47, 0x43, 0x50, 0x5f, 0x41, 0x53, 0x49, - 0x41, 0x5f, 0x4e, 0x4f, 0x52, 0x54, 0x48, 0x45, 0x41, 0x53, 0x54, 0x5f, 0x33, 0x41, 0x10, 0xb8, - 0x8c, 0x93, 0x01, 0x12, 0x1c, 0x0a, 0x15, 0x47, 0x43, 0x50, 0x5f, 0x41, 0x53, 0x49, 0x41, 0x5f, - 0x4e, 0x4f, 0x52, 0x54, 0x48, 0x45, 0x41, 0x53, 0x54, 0x5f, 0x33, 0x42, 0x10, 0xb9, 0x8c, 0x93, - 0x01, 0x12, 0x1c, 0x0a, 0x15, 0x47, 0x43, 0x50, 0x5f, 0x41, 0x53, 0x49, 0x41, 0x5f, 0x4e, 0x4f, - 0x52, 0x54, 0x48, 0x45, 0x41, 0x53, 0x54, 0x5f, 0x33, 0x43, 0x10, 0xba, 0x8c, 0x93, 0x01, 0x12, - 0x18, 0x0a, 0x11, 0x47, 0x43, 0x50, 0x5f, 0x41, 0x53, 0x49, 0x41, 0x5f, 0x53, 0x4f, 0x55, 0x54, - 0x48, 0x5f, 0x31, 0x41, 0x10, 0xd3, 0xe6, 0x8f, 0x01, 0x12, 0x18, 0x0a, 0x11, 0x47, 0x43, 0x50, - 0x5f, 0x41, 0x53, 0x49, 0x41, 0x5f, 0x53, 0x4f, 0x55, 0x54, 0x48, 0x5f, 0x31, 0x42, 0x10, 0xd4, - 0xe6, 0x8f, 0x01, 0x12, 0x18, 0x0a, 0x11, 0x47, 0x43, 0x50, 0x5f, 0x41, 0x53, 0x49, 0x41, 0x5f, - 0x53, 0x4f, 0x55, 0x54, 0x48, 0x5f, 0x31, 0x43, 0x10, 0xd5, 0xe6, 0x8f, 0x01, 0x12, 0x18, 0x0a, - 0x11, 0x47, 0x43, 0x50, 0x5f, 0x41, 0x53, 0x49, 0x41, 0x5f, 0x53, 0x4f, 0x55, 0x54, 0x48, 0x5f, - 0x32, 0x41, 0x10, 0xdd, 0xe6, 0x8f, 0x01, 0x12, 0x18, 0x0a, 0x11, 0x47, 0x43, 0x50, 0x5f, 0x41, - 0x53, 0x49, 0x41, 0x5f, 0x53, 0x4f, 0x55, 0x54, 0x48, 0x5f, 0x32, 0x42, 0x10, 0xde, 0xe6, 0x8f, - 0x01, 0x12, 0x18, 0x0a, 0x11, 0x47, 0x43, 0x50, 0x5f, 0x41, 0x53, 0x49, 0x41, 0x5f, 0x53, 0x4f, - 0x55, 0x54, 0x48, 0x5f, 0x32, 0x43, 0x10, 0xdf, 0xe6, 0x8f, 0x01, 0x12, 0x1c, 0x0a, 0x15, 0x47, - 0x43, 0x50, 0x5f, 0x41, 0x53, 0x49, 0x41, 0x5f, 0x53, 0x4f, 0x55, 0x54, 0x48, 0x45, 0x41, 0x53, - 0x54, 0x5f, 0x31, 0x41, 0x10, 0xf6, 0xf5, 0xa4, 0x01, 0x12, 0x1c, 0x0a, 0x15, 0x47, 0x43, 0x50, - 0x5f, 0x41, 0x53, 0x49, 0x41, 0x5f, 0x53, 0x4f, 0x55, 0x54, 0x48, 0x45, 0x41, 0x53, 0x54, 0x5f, - 0x31, 0x42, 0x10, 0xf7, 0xf5, 0xa4, 0x01, 0x12, 0x1c, 0x0a, 0x15, 0x47, 0x43, 0x50, 0x5f, 0x41, - 0x53, 0x49, 0x41, 0x5f, 0x53, 0x4f, 0x55, 0x54, 0x48, 0x45, 0x41, 0x53, 0x54, 0x5f, 0x31, 0x43, - 0x10, 0xf8, 0xf5, 0xa4, 0x01, 0x12, 0x1c, 0x0a, 0x15, 0x47, 0x43, 0x50, 0x5f, 0x41, 0x53, 0x49, - 0x41, 0x5f, 0x53, 0x4f, 0x55, 0x54, 0x48, 0x45, 0x41, 0x53, 0x54, 0x5f, 0x32, 0x41, 0x10, 0x90, - 0x86, 0x90, 0x01, 0x12, 0x1c, 0x0a, 0x15, 0x47, 0x43, 0x50, 0x5f, 0x41, 0x53, 0x49, 0x41, 0x5f, - 0x53, 0x4f, 0x55, 0x54, 0x48, 0x45, 0x41, 0x53, 0x54, 0x5f, 0x32, 0x42, 0x10, 0x91, 0x86, 0x90, - 0x01, 0x12, 0x1c, 0x0a, 0x15, 0x47, 0x43, 0x50, 0x5f, 0x41, 0x53, 0x49, 0x41, 0x5f, 0x53, 0x4f, - 0x55, 0x54, 0x48, 0x45, 0x41, 0x53, 0x54, 0x5f, 0x32, 0x43, 0x10, 0x92, 0x86, 0x90, 0x01, 0x12, - 0x20, 0x0a, 0x1a, 0x47, 0x43, 0x50, 0x5f, 0x41, 0x55, 0x53, 0x54, 0x52, 0x41, 0x4c, 0x49, 0x41, - 0x5f, 0x53, 0x4f, 0x55, 0x54, 0x48, 0x45, 0x41, 0x53, 0x54, 0x5f, 0x31, 0x41, 0x10, 0xfa, 0xa2, - 0x7c, 0x12, 0x20, 0x0a, 0x1a, 0x47, 0x43, 0x50, 0x5f, 0x41, 0x55, 0x53, 0x54, 0x52, 0x41, 0x4c, - 0x49, 0x41, 0x5f, 0x53, 0x4f, 0x55, 0x54, 0x48, 0x45, 0x41, 0x53, 0x54, 0x5f, 0x31, 0x42, 0x10, - 0xfb, 0xa2, 0x7c, 0x12, 0x20, 0x0a, 0x1a, 0x47, 0x43, 0x50, 0x5f, 0x41, 0x55, 0x53, 0x54, 0x52, - 0x41, 0x4c, 0x49, 0x41, 0x5f, 0x53, 0x4f, 0x55, 0x54, 0x48, 0x45, 0x41, 0x53, 0x54, 0x5f, 0x31, - 0x43, 0x10, 0xfc, 0xa2, 0x7c, 0x12, 0x20, 0x0a, 0x1a, 0x47, 0x43, 0x50, 0x5f, 0x41, 0x55, 0x53, - 0x54, 0x52, 0x41, 0x4c, 0x49, 0x41, 0x5f, 0x53, 0x4f, 0x55, 0x54, 0x48, 0x45, 0x41, 0x53, 0x54, - 0x5f, 0x32, 0x41, 0x10, 0x84, 0xa3, 0x7c, 0x12, 0x20, 0x0a, 0x1a, 0x47, 0x43, 0x50, 0x5f, 0x41, - 0x55, 0x53, 0x54, 0x52, 0x41, 0x4c, 0x49, 0x41, 0x5f, 0x53, 0x4f, 0x55, 0x54, 0x48, 0x45, 0x41, - 0x53, 0x54, 0x5f, 0x32, 0x42, 0x10, 0x85, 0xa3, 0x7c, 0x12, 0x20, 0x0a, 0x1a, 0x47, 0x43, 0x50, - 0x5f, 0x41, 0x55, 0x53, 0x54, 0x52, 0x41, 0x4c, 0x49, 0x41, 0x5f, 0x53, 0x4f, 0x55, 0x54, 0x48, - 0x45, 0x41, 0x53, 0x54, 0x5f, 0x32, 0x43, 0x10, 0x86, 0xa3, 0x7c, 0x12, 0x1c, 0x0a, 0x15, 0x47, - 0x43, 0x50, 0x5f, 0x45, 0x55, 0x52, 0x4f, 0x50, 0x45, 0x5f, 0x43, 0x45, 0x4e, 0x54, 0x52, 0x41, - 0x4c, 0x5f, 0x32, 0x41, 0x10, 0xae, 0xd6, 0x9f, 0x01, 0x12, 0x1c, 0x0a, 0x15, 0x47, 0x43, 0x50, - 0x5f, 0x45, 0x55, 0x52, 0x4f, 0x50, 0x45, 0x5f, 0x43, 0x45, 0x4e, 0x54, 0x52, 0x41, 0x4c, 0x5f, - 0x32, 0x42, 0x10, 0xaf, 0xd6, 0x9f, 0x01, 0x12, 0x1c, 0x0a, 0x15, 0x47, 0x43, 0x50, 0x5f, 0x45, - 0x55, 0x52, 0x4f, 0x50, 0x45, 0x5f, 0x43, 0x45, 0x4e, 0x54, 0x52, 0x41, 0x4c, 0x5f, 0x32, 0x43, - 0x10, 0xb0, 0xd6, 0x9f, 0x01, 0x12, 0x1a, 0x0a, 0x13, 0x47, 0x43, 0x50, 0x5f, 0x45, 0x55, 0x52, - 0x4f, 0x50, 0x45, 0x5f, 0x4e, 0x4f, 0x52, 0x54, 0x48, 0x5f, 0x31, 0x41, 0x10, 0xe8, 0x8b, 0x89, - 0x01, 0x12, 0x1a, 0x0a, 0x13, 0x47, 0x43, 0x50, 0x5f, 0x45, 0x55, 0x52, 0x4f, 0x50, 0x45, 0x5f, - 0x4e, 0x4f, 0x52, 0x54, 0x48, 0x5f, 0x31, 0x42, 0x10, 0xe9, 0x8b, 0x89, 0x01, 0x12, 0x1a, 0x0a, - 0x13, 0x47, 0x43, 0x50, 0x5f, 0x45, 0x55, 0x52, 0x4f, 0x50, 0x45, 0x5f, 0x4e, 0x4f, 0x52, 0x54, - 0x48, 0x5f, 0x31, 0x43, 0x10, 0xea, 0x8b, 0x89, 0x01, 0x12, 0x1e, 0x0a, 0x17, 0x47, 0x43, 0x50, - 0x5f, 0x45, 0x55, 0x52, 0x4f, 0x50, 0x45, 0x5f, 0x53, 0x4f, 0x55, 0x54, 0x48, 0x57, 0x45, 0x53, - 0x54, 0x5f, 0x31, 0x41, 0x10, 0xa2, 0xa2, 0xa6, 0x01, 0x12, 0x1e, 0x0a, 0x17, 0x47, 0x43, 0x50, - 0x5f, 0x45, 0x55, 0x52, 0x4f, 0x50, 0x45, 0x5f, 0x53, 0x4f, 0x55, 0x54, 0x48, 0x57, 0x45, 0x53, - 0x54, 0x5f, 0x31, 0x42, 0x10, 0xa3, 0xa2, 0xa6, 0x01, 0x12, 0x1e, 0x0a, 0x17, 0x47, 0x43, 0x50, - 0x5f, 0x45, 0x55, 0x52, 0x4f, 0x50, 0x45, 0x5f, 0x53, 0x4f, 0x55, 0x54, 0x48, 0x57, 0x45, 0x53, - 0x54, 0x5f, 0x31, 0x43, 0x10, 0xa4, 0xa2, 0xa6, 0x01, 0x12, 0x18, 0x0a, 0x12, 0x47, 0x43, 0x50, - 0x5f, 0x45, 0x55, 0x52, 0x4f, 0x50, 0x45, 0x5f, 0x57, 0x45, 0x53, 0x54, 0x5f, 0x31, 0x42, 0x10, - 0xcd, 0xbf, 0x7d, 0x12, 0x18, 0x0a, 0x12, 0x47, 0x43, 0x50, 0x5f, 0x45, 0x55, 0x52, 0x4f, 0x50, - 0x45, 0x5f, 0x57, 0x45, 0x53, 0x54, 0x5f, 0x31, 0x43, 0x10, 0xce, 0xbf, 0x7d, 0x12, 0x18, 0x0a, - 0x12, 0x47, 0x43, 0x50, 0x5f, 0x45, 0x55, 0x52, 0x4f, 0x50, 0x45, 0x5f, 0x57, 0x45, 0x53, 0x54, - 0x5f, 0x31, 0x44, 0x10, 0xcf, 0xbf, 0x7d, 0x12, 0x1a, 0x0a, 0x13, 0x47, 0x43, 0x50, 0x5f, 0x45, - 0x55, 0x52, 0x4f, 0x50, 0x45, 0x5f, 0x57, 0x45, 0x53, 0x54, 0x5f, 0x31, 0x32, 0x41, 0x10, 0xf6, - 0xa2, 0x91, 0x01, 0x12, 0x1a, 0x0a, 0x13, 0x47, 0x43, 0x50, 0x5f, 0x45, 0x55, 0x52, 0x4f, 0x50, - 0x45, 0x5f, 0x57, 0x45, 0x53, 0x54, 0x5f, 0x31, 0x32, 0x42, 0x10, 0xf7, 0xa2, 0x91, 0x01, 0x12, - 0x1a, 0x0a, 0x13, 0x47, 0x43, 0x50, 0x5f, 0x45, 0x55, 0x52, 0x4f, 0x50, 0x45, 0x5f, 0x57, 0x45, - 0x53, 0x54, 0x5f, 0x31, 0x32, 0x43, 0x10, 0xf8, 0xa2, 0x91, 0x01, 0x12, 0x19, 0x0a, 0x12, 0x47, - 0x43, 0x50, 0x5f, 0x45, 0x55, 0x52, 0x4f, 0x50, 0x45, 0x5f, 0x57, 0x45, 0x53, 0x54, 0x5f, 0x32, - 0x41, 0x10, 0xb0, 0xbf, 0xac, 0x01, 0x12, 0x19, 0x0a, 0x12, 0x47, 0x43, 0x50, 0x5f, 0x45, 0x55, - 0x52, 0x4f, 0x50, 0x45, 0x5f, 0x57, 0x45, 0x53, 0x54, 0x5f, 0x32, 0x42, 0x10, 0xb1, 0xbf, 0xac, - 0x01, 0x12, 0x19, 0x0a, 0x12, 0x47, 0x43, 0x50, 0x5f, 0x45, 0x55, 0x52, 0x4f, 0x50, 0x45, 0x5f, - 0x57, 0x45, 0x53, 0x54, 0x5f, 0x32, 0x43, 0x10, 0xb2, 0xbf, 0xac, 0x01, 0x12, 0x19, 0x0a, 0x12, - 0x47, 0x43, 0x50, 0x5f, 0x45, 0x55, 0x52, 0x4f, 0x50, 0x45, 0x5f, 0x57, 0x45, 0x53, 0x54, 0x5f, - 0x33, 0x41, 0x10, 0xca, 0xf6, 0x8a, 0x01, 0x12, 0x19, 0x0a, 0x12, 0x47, 0x43, 0x50, 0x5f, 0x45, - 0x55, 0x52, 0x4f, 0x50, 0x45, 0x5f, 0x57, 0x45, 0x53, 0x54, 0x5f, 0x33, 0x42, 0x10, 0xcb, 0xf6, - 0x8a, 0x01, 0x12, 0x19, 0x0a, 0x12, 0x47, 0x43, 0x50, 0x5f, 0x45, 0x55, 0x52, 0x4f, 0x50, 0x45, - 0x5f, 0x57, 0x45, 0x53, 0x54, 0x5f, 0x33, 0x43, 0x10, 0xcc, 0xf6, 0x8a, 0x01, 0x12, 0x19, 0x0a, - 0x12, 0x47, 0x43, 0x50, 0x5f, 0x45, 0x55, 0x52, 0x4f, 0x50, 0x45, 0x5f, 0x57, 0x45, 0x53, 0x54, - 0x5f, 0x34, 0x41, 0x10, 0xb4, 0xa7, 0x9a, 0x01, 0x12, 0x19, 0x0a, 0x12, 0x47, 0x43, 0x50, 0x5f, - 0x45, 0x55, 0x52, 0x4f, 0x50, 0x45, 0x5f, 0x57, 0x45, 0x53, 0x54, 0x5f, 0x34, 0x42, 0x10, 0xb5, - 0xa7, 0x9a, 0x01, 0x12, 0x19, 0x0a, 0x12, 0x47, 0x43, 0x50, 0x5f, 0x45, 0x55, 0x52, 0x4f, 0x50, - 0x45, 0x5f, 0x57, 0x45, 0x53, 0x54, 0x5f, 0x34, 0x43, 0x10, 0xb6, 0xa7, 0x9a, 0x01, 0x12, 0x19, - 0x0a, 0x12, 0x47, 0x43, 0x50, 0x5f, 0x45, 0x55, 0x52, 0x4f, 0x50, 0x45, 0x5f, 0x57, 0x45, 0x53, - 0x54, 0x5f, 0x36, 0x41, 0x10, 0xde, 0x9c, 0xa8, 0x01, 0x12, 0x19, 0x0a, 0x12, 0x47, 0x43, 0x50, - 0x5f, 0x45, 0x55, 0x52, 0x4f, 0x50, 0x45, 0x5f, 0x57, 0x45, 0x53, 0x54, 0x5f, 0x36, 0x42, 0x10, - 0xdf, 0x9c, 0xa8, 0x01, 0x12, 0x19, 0x0a, 0x12, 0x47, 0x43, 0x50, 0x5f, 0x45, 0x55, 0x52, 0x4f, - 0x50, 0x45, 0x5f, 0x57, 0x45, 0x53, 0x54, 0x5f, 0x36, 0x43, 0x10, 0xe0, 0x9c, 0xa8, 0x01, 0x12, - 0x19, 0x0a, 0x12, 0x47, 0x43, 0x50, 0x5f, 0x45, 0x55, 0x52, 0x4f, 0x50, 0x45, 0x5f, 0x57, 0x45, - 0x53, 0x54, 0x5f, 0x38, 0x41, 0x10, 0xa8, 0xa3, 0x91, 0x01, 0x12, 0x19, 0x0a, 0x12, 0x47, 0x43, - 0x50, 0x5f, 0x45, 0x55, 0x52, 0x4f, 0x50, 0x45, 0x5f, 0x57, 0x45, 0x53, 0x54, 0x5f, 0x38, 0x42, - 0x10, 0xa9, 0xa3, 0x91, 0x01, 0x12, 0x19, 0x0a, 0x12, 0x47, 0x43, 0x50, 0x5f, 0x45, 0x55, 0x52, - 0x4f, 0x50, 0x45, 0x5f, 0x57, 0x45, 0x53, 0x54, 0x5f, 0x38, 0x43, 0x10, 0xaa, 0xa3, 0x91, 0x01, - 0x12, 0x19, 0x0a, 0x12, 0x47, 0x43, 0x50, 0x5f, 0x45, 0x55, 0x52, 0x4f, 0x50, 0x45, 0x5f, 0x57, - 0x45, 0x53, 0x54, 0x5f, 0x39, 0x41, 0x10, 0xe2, 0xab, 0x89, 0x01, 0x12, 0x19, 0x0a, 0x12, 0x47, - 0x43, 0x50, 0x5f, 0x45, 0x55, 0x52, 0x4f, 0x50, 0x45, 0x5f, 0x57, 0x45, 0x53, 0x54, 0x5f, 0x39, - 0x42, 0x10, 0xe3, 0xab, 0x89, 0x01, 0x12, 0x19, 0x0a, 0x12, 0x47, 0x43, 0x50, 0x5f, 0x45, 0x55, - 0x52, 0x4f, 0x50, 0x45, 0x5f, 0x57, 0x45, 0x53, 0x54, 0x5f, 0x39, 0x43, 0x10, 0xe4, 0xab, 0x89, - 0x01, 0x12, 0x18, 0x0a, 0x11, 0x47, 0x43, 0x50, 0x5f, 0x4d, 0x45, 0x5f, 0x43, 0x45, 0x4e, 0x54, - 0x52, 0x41, 0x4c, 0x5f, 0x31, 0x41, 0x10, 0xbc, 0xa6, 0x90, 0x01, 0x12, 0x18, 0x0a, 0x11, 0x47, - 0x43, 0x50, 0x5f, 0x4d, 0x45, 0x5f, 0x43, 0x45, 0x4e, 0x54, 0x52, 0x41, 0x4c, 0x5f, 0x31, 0x42, - 0x10, 0xbd, 0xa6, 0x90, 0x01, 0x12, 0x18, 0x0a, 0x11, 0x47, 0x43, 0x50, 0x5f, 0x4d, 0x45, 0x5f, - 0x43, 0x45, 0x4e, 0x54, 0x52, 0x41, 0x4c, 0x5f, 0x31, 0x43, 0x10, 0xbe, 0xa6, 0x90, 0x01, 0x12, - 0x15, 0x0a, 0x0e, 0x47, 0x43, 0x50, 0x5f, 0x4d, 0x45, 0x5f, 0x57, 0x45, 0x53, 0x54, 0x5f, 0x31, - 0x41, 0x10, 0xa6, 0x84, 0x91, 0x01, 0x12, 0x15, 0x0a, 0x0e, 0x47, 0x43, 0x50, 0x5f, 0x4d, 0x45, - 0x5f, 0x57, 0x45, 0x53, 0x54, 0x5f, 0x31, 0x42, 0x10, 0xa7, 0x84, 0x91, 0x01, 0x12, 0x15, 0x0a, - 0x0e, 0x47, 0x43, 0x50, 0x5f, 0x4d, 0x45, 0x5f, 0x57, 0x45, 0x53, 0x54, 0x5f, 0x31, 0x43, 0x10, - 0xa8, 0x84, 0x91, 0x01, 0x12, 0x24, 0x0a, 0x1d, 0x47, 0x43, 0x50, 0x5f, 0x4e, 0x4f, 0x52, 0x54, - 0x48, 0x41, 0x4d, 0x45, 0x52, 0x49, 0x43, 0x41, 0x5f, 0x4e, 0x4f, 0x52, 0x54, 0x48, 0x45, 0x41, - 0x53, 0x54, 0x5f, 0x31, 0x41, 0x10, 0xd0, 0xd3, 0x81, 0x01, 0x12, 0x24, 0x0a, 0x1d, 0x47, 0x43, - 0x50, 0x5f, 0x4e, 0x4f, 0x52, 0x54, 0x48, 0x41, 0x4d, 0x45, 0x52, 0x49, 0x43, 0x41, 0x5f, 0x4e, - 0x4f, 0x52, 0x54, 0x48, 0x45, 0x41, 0x53, 0x54, 0x5f, 0x31, 0x42, 0x10, 0xd1, 0xd3, 0x81, 0x01, - 0x12, 0x24, 0x0a, 0x1d, 0x47, 0x43, 0x50, 0x5f, 0x4e, 0x4f, 0x52, 0x54, 0x48, 0x41, 0x4d, 0x45, - 0x52, 0x49, 0x43, 0x41, 0x5f, 0x4e, 0x4f, 0x52, 0x54, 0x48, 0x45, 0x41, 0x53, 0x54, 0x5f, 0x31, - 0x43, 0x10, 0xd2, 0xd3, 0x81, 0x01, 0x12, 0x24, 0x0a, 0x1d, 0x47, 0x43, 0x50, 0x5f, 0x4e, 0x4f, - 0x52, 0x54, 0x48, 0x41, 0x4d, 0x45, 0x52, 0x49, 0x43, 0x41, 0x5f, 0x4e, 0x4f, 0x52, 0x54, 0x48, - 0x45, 0x41, 0x53, 0x54, 0x5f, 0x32, 0x41, 0x10, 0xda, 0xd3, 0x81, 0x01, 0x12, 0x24, 0x0a, 0x1d, - 0x47, 0x43, 0x50, 0x5f, 0x4e, 0x4f, 0x52, 0x54, 0x48, 0x41, 0x4d, 0x45, 0x52, 0x49, 0x43, 0x41, - 0x5f, 0x4e, 0x4f, 0x52, 0x54, 0x48, 0x45, 0x41, 0x53, 0x54, 0x5f, 0x32, 0x42, 0x10, 0xdb, 0xd3, - 0x81, 0x01, 0x12, 0x24, 0x0a, 0x1d, 0x47, 0x43, 0x50, 0x5f, 0x4e, 0x4f, 0x52, 0x54, 0x48, 0x41, - 0x4d, 0x45, 0x52, 0x49, 0x43, 0x41, 0x5f, 0x4e, 0x4f, 0x52, 0x54, 0x48, 0x45, 0x41, 0x53, 0x54, - 0x5f, 0x32, 0x43, 0x10, 0xdc, 0xd3, 0x81, 0x01, 0x12, 0x1e, 0x0a, 0x18, 0x47, 0x43, 0x50, 0x5f, - 0x53, 0x4f, 0x55, 0x54, 0x48, 0x41, 0x4d, 0x45, 0x52, 0x49, 0x43, 0x41, 0x5f, 0x45, 0x41, 0x53, - 0x54, 0x5f, 0x31, 0x41, 0x10, 0xe4, 0xdc, 0x7e, 0x12, 0x1e, 0x0a, 0x18, 0x47, 0x43, 0x50, 0x5f, - 0x53, 0x4f, 0x55, 0x54, 0x48, 0x41, 0x4d, 0x45, 0x52, 0x49, 0x43, 0x41, 0x5f, 0x45, 0x41, 0x53, - 0x54, 0x5f, 0x31, 0x42, 0x10, 0xe5, 0xdc, 0x7e, 0x12, 0x1e, 0x0a, 0x18, 0x47, 0x43, 0x50, 0x5f, - 0x53, 0x4f, 0x55, 0x54, 0x48, 0x41, 0x4d, 0x45, 0x52, 0x49, 0x43, 0x41, 0x5f, 0x45, 0x41, 0x53, - 0x54, 0x5f, 0x31, 0x43, 0x10, 0xe6, 0xdc, 0x7e, 0x12, 0x1f, 0x0a, 0x18, 0x47, 0x43, 0x50, 0x5f, - 0x53, 0x4f, 0x55, 0x54, 0x48, 0x41, 0x4d, 0x45, 0x52, 0x49, 0x43, 0x41, 0x5f, 0x57, 0x45, 0x53, - 0x54, 0x5f, 0x31, 0x41, 0x10, 0xce, 0xae, 0x83, 0x01, 0x12, 0x1f, 0x0a, 0x18, 0x47, 0x43, 0x50, - 0x5f, 0x53, 0x4f, 0x55, 0x54, 0x48, 0x41, 0x4d, 0x45, 0x52, 0x49, 0x43, 0x41, 0x5f, 0x57, 0x45, - 0x53, 0x54, 0x5f, 0x31, 0x42, 0x10, 0xcf, 0xae, 0x83, 0x01, 0x12, 0x1f, 0x0a, 0x18, 0x47, 0x43, - 0x50, 0x5f, 0x53, 0x4f, 0x55, 0x54, 0x48, 0x41, 0x4d, 0x45, 0x52, 0x49, 0x43, 0x41, 0x5f, 0x57, - 0x45, 0x53, 0x54, 0x5f, 0x31, 0x43, 0x10, 0xd0, 0xae, 0x83, 0x01, 0x12, 0x18, 0x0a, 0x11, 0x47, - 0x43, 0x50, 0x5f, 0x55, 0x53, 0x5f, 0x43, 0x45, 0x4e, 0x54, 0x52, 0x41, 0x4c, 0x5f, 0x31, 0x41, - 0x10, 0xd8, 0xad, 0xad, 0x01, 0x12, 0x18, 0x0a, 0x11, 0x47, 0x43, 0x50, 0x5f, 0x55, 0x53, 0x5f, - 0x43, 0x45, 0x4e, 0x54, 0x52, 0x41, 0x4c, 0x5f, 0x31, 0x42, 0x10, 0xd9, 0xad, 0xad, 0x01, 0x12, - 0x18, 0x0a, 0x11, 0x47, 0x43, 0x50, 0x5f, 0x55, 0x53, 0x5f, 0x43, 0x45, 0x4e, 0x54, 0x52, 0x41, - 0x4c, 0x5f, 0x31, 0x43, 0x10, 0xda, 0xad, 0xad, 0x01, 0x12, 0x18, 0x0a, 0x11, 0x47, 0x43, 0x50, - 0x5f, 0x55, 0x53, 0x5f, 0x43, 0x45, 0x4e, 0x54, 0x52, 0x41, 0x4c, 0x5f, 0x31, 0x46, 0x10, 0xdd, - 0xad, 0xad, 0x01, 0x12, 0x15, 0x0a, 0x0e, 0x47, 0x43, 0x50, 0x5f, 0x55, 0x53, 0x5f, 0x45, 0x41, - 0x53, 0x54, 0x5f, 0x31, 0x42, 0x10, 0xe3, 0xad, 0xad, 0x01, 0x12, 0x15, 0x0a, 0x0e, 0x47, 0x43, - 0x50, 0x5f, 0x55, 0x53, 0x5f, 0x45, 0x41, 0x53, 0x54, 0x5f, 0x31, 0x43, 0x10, 0xe4, 0xad, 0xad, - 0x01, 0x12, 0x15, 0x0a, 0x0e, 0x47, 0x43, 0x50, 0x5f, 0x55, 0x53, 0x5f, 0x45, 0x41, 0x53, 0x54, - 0x5f, 0x31, 0x44, 0x10, 0xe5, 0xad, 0xad, 0x01, 0x12, 0x15, 0x0a, 0x0e, 0x47, 0x43, 0x50, 0x5f, - 0x55, 0x53, 0x5f, 0x45, 0x41, 0x53, 0x54, 0x5f, 0x34, 0x41, 0x10, 0xec, 0xad, 0xad, 0x01, 0x12, - 0x15, 0x0a, 0x0e, 0x47, 0x43, 0x50, 0x5f, 0x55, 0x53, 0x5f, 0x45, 0x41, 0x53, 0x54, 0x5f, 0x34, - 0x42, 0x10, 0xed, 0xad, 0xad, 0x01, 0x12, 0x15, 0x0a, 0x0e, 0x47, 0x43, 0x50, 0x5f, 0x55, 0x53, - 0x5f, 0x45, 0x41, 0x53, 0x54, 0x5f, 0x34, 0x43, 0x10, 0xee, 0xad, 0xad, 0x01, 0x12, 0x15, 0x0a, - 0x0e, 0x47, 0x43, 0x50, 0x5f, 0x55, 0x53, 0x5f, 0x45, 0x41, 0x53, 0x54, 0x5f, 0x35, 0x41, 0x10, - 0xf6, 0xad, 0xad, 0x01, 0x12, 0x15, 0x0a, 0x0e, 0x47, 0x43, 0x50, 0x5f, 0x55, 0x53, 0x5f, 0x45, - 0x41, 0x53, 0x54, 0x5f, 0x35, 0x42, 0x10, 0xf7, 0xad, 0xad, 0x01, 0x12, 0x15, 0x0a, 0x0e, 0x47, - 0x43, 0x50, 0x5f, 0x55, 0x53, 0x5f, 0x45, 0x41, 0x53, 0x54, 0x5f, 0x35, 0x43, 0x10, 0xf8, 0xad, - 0xad, 0x01, 0x12, 0x16, 0x0a, 0x0f, 0x47, 0x43, 0x50, 0x5f, 0x55, 0x53, 0x5f, 0x53, 0x4f, 0x55, - 0x54, 0x48, 0x5f, 0x31, 0x41, 0x10, 0x80, 0xae, 0xad, 0x01, 0x12, 0x16, 0x0a, 0x0f, 0x47, 0x43, - 0x50, 0x5f, 0x55, 0x53, 0x5f, 0x53, 0x4f, 0x55, 0x54, 0x48, 0x5f, 0x31, 0x42, 0x10, 0x81, 0xae, - 0xad, 0x01, 0x12, 0x16, 0x0a, 0x0f, 0x47, 0x43, 0x50, 0x5f, 0x55, 0x53, 0x5f, 0x53, 0x4f, 0x55, - 0x54, 0x48, 0x5f, 0x31, 0x43, 0x10, 0x82, 0xae, 0xad, 0x01, 0x12, 0x15, 0x0a, 0x0e, 0x47, 0x43, - 0x50, 0x5f, 0x55, 0x53, 0x5f, 0x57, 0x45, 0x53, 0x54, 0x5f, 0x31, 0x41, 0x10, 0x8a, 0xae, 0xad, - 0x01, 0x12, 0x15, 0x0a, 0x0e, 0x47, 0x43, 0x50, 0x5f, 0x55, 0x53, 0x5f, 0x57, 0x45, 0x53, 0x54, - 0x5f, 0x31, 0x42, 0x10, 0x8b, 0xae, 0xad, 0x01, 0x12, 0x15, 0x0a, 0x0e, 0x47, 0x43, 0x50, 0x5f, - 0x55, 0x53, 0x5f, 0x57, 0x45, 0x53, 0x54, 0x5f, 0x31, 0x43, 0x10, 0x8c, 0xae, 0xad, 0x01, 0x12, - 0x15, 0x0a, 0x0e, 0x47, 0x43, 0x50, 0x5f, 0x55, 0x53, 0x5f, 0x57, 0x45, 0x53, 0x54, 0x5f, 0x32, - 0x41, 0x10, 0x94, 0xae, 0xad, 0x01, 0x12, 0x15, 0x0a, 0x0e, 0x47, 0x43, 0x50, 0x5f, 0x55, 0x53, - 0x5f, 0x57, 0x45, 0x53, 0x54, 0x5f, 0x32, 0x42, 0x10, 0x95, 0xae, 0xad, 0x01, 0x12, 0x15, 0x0a, - 0x0e, 0x47, 0x43, 0x50, 0x5f, 0x55, 0x53, 0x5f, 0x57, 0x45, 0x53, 0x54, 0x5f, 0x32, 0x43, 0x10, - 0x96, 0xae, 0xad, 0x01, 0x12, 0x15, 0x0a, 0x0e, 0x47, 0x43, 0x50, 0x5f, 0x55, 0x53, 0x5f, 0x57, - 0x45, 0x53, 0x54, 0x5f, 0x33, 0x41, 0x10, 0x9e, 0xae, 0xad, 0x01, 0x12, 0x15, 0x0a, 0x0e, 0x47, - 0x43, 0x50, 0x5f, 0x55, 0x53, 0x5f, 0x57, 0x45, 0x53, 0x54, 0x5f, 0x33, 0x42, 0x10, 0x9f, 0xae, - 0xad, 0x01, 0x12, 0x15, 0x0a, 0x0e, 0x47, 0x43, 0x50, 0x5f, 0x55, 0x53, 0x5f, 0x57, 0x45, 0x53, - 0x54, 0x5f, 0x33, 0x43, 0x10, 0xa0, 0xae, 0xad, 0x01, 0x12, 0x15, 0x0a, 0x0e, 0x47, 0x43, 0x50, - 0x5f, 0x55, 0x53, 0x5f, 0x57, 0x45, 0x53, 0x54, 0x5f, 0x34, 0x41, 0x10, 0xa8, 0xae, 0xad, 0x01, - 0x12, 0x15, 0x0a, 0x0e, 0x47, 0x43, 0x50, 0x5f, 0x55, 0x53, 0x5f, 0x57, 0x45, 0x53, 0x54, 0x5f, - 0x34, 0x42, 0x10, 0xa9, 0xae, 0xad, 0x01, 0x12, 0x15, 0x0a, 0x0e, 0x47, 0x43, 0x50, 0x5f, 0x55, - 0x53, 0x5f, 0x57, 0x45, 0x53, 0x54, 0x5f, 0x34, 0x43, 0x10, 0xaa, 0xae, 0xad, 0x01, 0x42, 0x25, - 0x5a, 0x23, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x72, 0x6f, 0x74, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x69, 0x6f, 0x2f, 0x68, 0x6f, 0x6e, 0x75, 0x2f, 0x72, - 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_region_v1_region_proto_rawDescOnce sync.Once - file_region_v1_region_proto_rawDescData = file_region_v1_region_proto_rawDesc -) - -func file_region_v1_region_proto_rawDescGZIP() []byte { - file_region_v1_region_proto_rawDescOnce.Do(func() { - file_region_v1_region_proto_rawDescData = protoimpl.X.CompressGZIP(file_region_v1_region_proto_rawDescData) - }) - return file_region_v1_region_proto_rawDescData -} - -var file_region_v1_region_proto_enumTypes = make([]protoimpl.EnumInfo, 1) -var file_region_v1_region_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_region_v1_region_proto_goTypes = []interface{}{ - (Region)(0), // 0: honu.region.v1.Region - (*RegionInfo)(nil), // 1: honu.region.v1.RegionInfo - (*timestamppb.Timestamp)(nil), // 2: google.protobuf.Timestamp -} -var file_region_v1_region_proto_depIdxs = []int32{ - 0, // 0: honu.region.v1.RegionInfo.id:type_name -> honu.region.v1.Region - 2, // 1: honu.region.v1.RegionInfo.modified:type_name -> google.protobuf.Timestamp - 2, // 2: honu.region.v1.RegionInfo.created:type_name -> google.protobuf.Timestamp - 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 -} - -func init() { file_region_v1_region_proto_init() } -func file_region_v1_region_proto_init() { - if File_region_v1_region_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_region_v1_region_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RegionInfo); 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_region_v1_region_proto_rawDesc, - NumEnums: 1, - NumMessages: 1, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_region_v1_region_proto_goTypes, - DependencyIndexes: file_region_v1_region_proto_depIdxs, - EnumInfos: file_region_v1_region_proto_enumTypes, - MessageInfos: file_region_v1_region_proto_msgTypes, - }.Build() - File_region_v1_region_proto = out.File - file_region_v1_region_proto_rawDesc = nil - file_region_v1_region_proto_goTypes = nil - file_region_v1_region_proto_depIdxs = nil -} diff --git a/replica/generate.go b/replica/generate.go deleted file mode 100644 index 203de95..0000000 --- a/replica/generate.go +++ /dev/null @@ -1,3 +0,0 @@ -package replica - -//go:generate bash generate.sh diff --git a/replica/generate.sh b/replica/generate.sh deleted file mode 100644 index 4f6aac1..0000000 --- a/replica/generate.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash - -PROTOS="${GOPATH}/src/github.com/rotationalio/honu/proto" - -if [[ ! -d $PROTOS ]]; then - echo "cannot find ${PROTOS}" - exit 1 -fi - -if [[ ! -d "./v1" ]]; then - mkdir v1 -fi - -MODULE="github.com/rotationalio/honu/replica/v1" -APIMOD="github.com/rotationalio/honu/replica/v1;replica" - -# Generate the protocol buffers -protoc -I=${PROTOS} \ - --go_out=./v1 --go-grpc_out=./v1 \ - --go_opt=module=${MODULE} \ - --go-grpc_opt=module=${MODULE} \ - --go_opt=Mreplica/v1/replica.proto="${APIMOD}" \ - --go-grpc_opt=Mreplica/v1/replica.proto="${APIMOD}" \ - replica/v1/replica.proto \ No newline at end of file diff --git a/replica/v1/replica.pb.go b/replica/v1/replica.pb.go deleted file mode 100644 index 9893d58..0000000 --- a/replica/v1/replica.pb.go +++ /dev/null @@ -1,251 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.34.1 -// protoc v5.26.1 -// source: replica/v1/replica.proto - -package replica - -import ( - object "github.com/rotationalio/honu/object" - 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) -) - -// Status indicates what state the synchronization is in between peers, allowing -// the replicas to coordinate between multiple sync messages in a grpc stream. -type Sync_Status int32 - -const ( - Sync_UNKNOWN Sync_Status = 0 // Should not be used as a status - Sync_CHECK Sync_Status = 1 // Sync contains version information only - Sync_REPAIR Sync_Status = 2 // Sync contains object data information - Sync_COMPLETE Sync_Status = 3 // Sync contains no object information, ready to end Gossip - Sync_ERROR Sync_Status = 4 // Sync contains object-specific error information -) - -// Enum value maps for Sync_Status. -var ( - Sync_Status_name = map[int32]string{ - 0: "UNKNOWN", - 1: "CHECK", - 2: "REPAIR", - 3: "COMPLETE", - 4: "ERROR", - } - Sync_Status_value = map[string]int32{ - "UNKNOWN": 0, - "CHECK": 1, - "REPAIR": 2, - "COMPLETE": 3, - "ERROR": 4, - } -) - -func (x Sync_Status) Enum() *Sync_Status { - p := new(Sync_Status) - *p = x - return p -} - -func (x Sync_Status) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (Sync_Status) Descriptor() protoreflect.EnumDescriptor { - return file_replica_v1_replica_proto_enumTypes[0].Descriptor() -} - -func (Sync_Status) Type() protoreflect.EnumType { - return &file_replica_v1_replica_proto_enumTypes[0] -} - -func (x Sync_Status) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use Sync_Status.Descriptor instead. -func (Sync_Status) EnumDescriptor() ([]byte, []int) { - return file_replica_v1_replica_proto_rawDescGZIP(), []int{0, 0} -} - -// Sync messages allow replicas to exchange information in a bidirectional stream. -// Because Sync messages are sent in the stream, there are different synchronization -// types. A "check" synchronization sends only the version vector without data, -// requesting the remote peer to check if they have a later version, and if so, return -// it. A "repair" synchronization sends object data back if the sender's version is -// later. A "complete" synchronization indicates that the sender is fully synchronized, -// and an "error" synchronization message says that there was some failure repairing -// the specified version vector. -type Sync struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Status Sync_Status `protobuf:"varint,1,opt,name=status,proto3,enum=honu.replica.v1.Sync_Status" json:"status,omitempty"` // The status/type of sync messages - Object *object.Object `protobuf:"bytes,2,opt,name=object,proto3" json:"object,omitempty"` // The object being synchronized - Error string `protobuf:"bytes,3,opt,name=error,proto3" json:"error,omitempty"` // Error information if the object failed to sync -} - -func (x *Sync) Reset() { - *x = Sync{} - if protoimpl.UnsafeEnabled { - mi := &file_replica_v1_replica_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Sync) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Sync) ProtoMessage() {} - -func (x *Sync) ProtoReflect() protoreflect.Message { - mi := &file_replica_v1_replica_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) -} - -// Deprecated: Use Sync.ProtoReflect.Descriptor instead. -func (*Sync) Descriptor() ([]byte, []int) { - return file_replica_v1_replica_proto_rawDescGZIP(), []int{0} -} - -func (x *Sync) GetStatus() Sync_Status { - if x != nil { - return x.Status - } - return Sync_UNKNOWN -} - -func (x *Sync) GetObject() *object.Object { - if x != nil { - return x.Object - } - return nil -} - -func (x *Sync) GetError() string { - if x != nil { - return x.Error - } - return "" -} - -var File_replica_v1_replica_proto protoreflect.FileDescriptor - -var file_replica_v1_replica_proto_rawDesc = []byte{ - 0x0a, 0x18, 0x72, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x2f, 0x76, 0x31, 0x2f, 0x72, 0x65, 0x70, - 0x6c, 0x69, 0x63, 0x61, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0f, 0x68, 0x6f, 0x6e, 0x75, - 0x2e, 0x72, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x2e, 0x76, 0x31, 0x1a, 0x16, 0x6f, 0x62, 0x6a, - 0x65, 0x63, 0x74, 0x2f, 0x76, 0x31, 0x2f, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x22, 0xc9, 0x01, 0x0a, 0x04, 0x53, 0x79, 0x6e, 0x63, 0x12, 0x34, 0x0a, 0x06, - 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1c, 0x2e, 0x68, - 0x6f, 0x6e, 0x75, 0x2e, 0x72, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x2e, 0x76, 0x31, 0x2e, 0x53, - 0x79, 0x6e, 0x63, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, - 0x75, 0x73, 0x12, 0x2e, 0x0a, 0x06, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x68, 0x6f, 0x6e, 0x75, 0x2e, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, - 0x2e, 0x76, 0x31, 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x06, 0x6f, 0x62, 0x6a, 0x65, - 0x63, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x22, 0x45, 0x0a, 0x06, 0x53, 0x74, 0x61, 0x74, - 0x75, 0x73, 0x12, 0x0b, 0x0a, 0x07, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, - 0x09, 0x0a, 0x05, 0x43, 0x48, 0x45, 0x43, 0x4b, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x52, 0x45, - 0x50, 0x41, 0x49, 0x52, 0x10, 0x02, 0x12, 0x0c, 0x0a, 0x08, 0x43, 0x4f, 0x4d, 0x50, 0x4c, 0x45, - 0x54, 0x45, 0x10, 0x03, 0x12, 0x09, 0x0a, 0x05, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x10, 0x04, 0x32, - 0x4b, 0x0a, 0x0b, 0x52, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x3c, - 0x0a, 0x06, 0x47, 0x6f, 0x73, 0x73, 0x69, 0x70, 0x12, 0x15, 0x2e, 0x68, 0x6f, 0x6e, 0x75, 0x2e, - 0x72, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x79, 0x6e, 0x63, 0x1a, - 0x15, 0x2e, 0x68, 0x6f, 0x6e, 0x75, 0x2e, 0x72, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x2e, 0x76, - 0x31, 0x2e, 0x53, 0x79, 0x6e, 0x63, 0x22, 0x00, 0x28, 0x01, 0x30, 0x01, 0x42, 0x26, 0x5a, 0x24, - 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x72, 0x6f, 0x74, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x69, 0x6f, 0x2f, 0x68, 0x6f, 0x6e, 0x75, 0x2f, 0x72, 0x65, 0x70, - 0x6c, 0x69, 0x63, 0x61, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_replica_v1_replica_proto_rawDescOnce sync.Once - file_replica_v1_replica_proto_rawDescData = file_replica_v1_replica_proto_rawDesc -) - -func file_replica_v1_replica_proto_rawDescGZIP() []byte { - file_replica_v1_replica_proto_rawDescOnce.Do(func() { - file_replica_v1_replica_proto_rawDescData = protoimpl.X.CompressGZIP(file_replica_v1_replica_proto_rawDescData) - }) - return file_replica_v1_replica_proto_rawDescData -} - -var file_replica_v1_replica_proto_enumTypes = make([]protoimpl.EnumInfo, 1) -var file_replica_v1_replica_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_replica_v1_replica_proto_goTypes = []interface{}{ - (Sync_Status)(0), // 0: honu.replica.v1.Sync.Status - (*Sync)(nil), // 1: honu.replica.v1.Sync - (*object.Object)(nil), // 2: honu.object.v1.Object -} -var file_replica_v1_replica_proto_depIdxs = []int32{ - 0, // 0: honu.replica.v1.Sync.status:type_name -> honu.replica.v1.Sync.Status - 2, // 1: honu.replica.v1.Sync.object:type_name -> honu.object.v1.Object - 1, // 2: honu.replica.v1.Replication.Gossip:input_type -> honu.replica.v1.Sync - 1, // 3: honu.replica.v1.Replication.Gossip:output_type -> honu.replica.v1.Sync - 3, // [3:4] is the sub-list for method output_type - 2, // [2:3] 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 -} - -func init() { file_replica_v1_replica_proto_init() } -func file_replica_v1_replica_proto_init() { - if File_replica_v1_replica_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_replica_v1_replica_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Sync); 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_replica_v1_replica_proto_rawDesc, - NumEnums: 1, - NumMessages: 1, - NumExtensions: 0, - NumServices: 1, - }, - GoTypes: file_replica_v1_replica_proto_goTypes, - DependencyIndexes: file_replica_v1_replica_proto_depIdxs, - EnumInfos: file_replica_v1_replica_proto_enumTypes, - MessageInfos: file_replica_v1_replica_proto_msgTypes, - }.Build() - File_replica_v1_replica_proto = out.File - file_replica_v1_replica_proto_rawDesc = nil - file_replica_v1_replica_proto_goTypes = nil - file_replica_v1_replica_proto_depIdxs = nil -} diff --git a/replica/v1/replica_grpc.pb.go b/replica/v1/replica_grpc.pb.go deleted file mode 100644 index dadf33b..0000000 --- a/replica/v1/replica_grpc.pb.go +++ /dev/null @@ -1,157 +0,0 @@ -// Code generated by protoc-gen-go-grpc. DO NOT EDIT. -// versions: -// - protoc-gen-go-grpc v1.3.0 -// - protoc v5.26.1 -// source: replica/v1/replica.proto - -package replica - -import ( - context "context" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" -) - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.32.0 or later. -const _ = grpc.SupportPackageIsVersion7 - -const ( - Replication_Gossip_FullMethodName = "/honu.replica.v1.Replication/Gossip" -) - -// ReplicationClient is the client API for Replication service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. -type ReplicationClient interface { - // Gossip implements biltateral anti-entropy: during a Gossip session the initiating - // replica pushes updates to the remote peer and pulls requested changes. Using - // bidirectional streaming, the initiating peer sends data-less sync messages with - // the versions of objects it stores locally. The remote replica then responds with - // data if its local version is later or sends a sync message back requesting the - // data from the initating replica if its local version is earlier (no exchange) - // occurs if both replicas have the same version. At the end of a gossip session, - // both replicas should have synchronized and have identical underlying data stores. - Gossip(ctx context.Context, opts ...grpc.CallOption) (Replication_GossipClient, error) -} - -type replicationClient struct { - cc grpc.ClientConnInterface -} - -func NewReplicationClient(cc grpc.ClientConnInterface) ReplicationClient { - return &replicationClient{cc} -} - -func (c *replicationClient) Gossip(ctx context.Context, opts ...grpc.CallOption) (Replication_GossipClient, error) { - stream, err := c.cc.NewStream(ctx, &Replication_ServiceDesc.Streams[0], Replication_Gossip_FullMethodName, opts...) - if err != nil { - return nil, err - } - x := &replicationGossipClient{stream} - return x, nil -} - -type Replication_GossipClient interface { - Send(*Sync) error - Recv() (*Sync, error) - grpc.ClientStream -} - -type replicationGossipClient struct { - grpc.ClientStream -} - -func (x *replicationGossipClient) Send(m *Sync) error { - return x.ClientStream.SendMsg(m) -} - -func (x *replicationGossipClient) Recv() (*Sync, error) { - m := new(Sync) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -// ReplicationServer is the server API for Replication service. -// All implementations must embed UnimplementedReplicationServer -// for forward compatibility -type ReplicationServer interface { - // Gossip implements biltateral anti-entropy: during a Gossip session the initiating - // replica pushes updates to the remote peer and pulls requested changes. Using - // bidirectional streaming, the initiating peer sends data-less sync messages with - // the versions of objects it stores locally. The remote replica then responds with - // data if its local version is later or sends a sync message back requesting the - // data from the initating replica if its local version is earlier (no exchange) - // occurs if both replicas have the same version. At the end of a gossip session, - // both replicas should have synchronized and have identical underlying data stores. - Gossip(Replication_GossipServer) error - mustEmbedUnimplementedReplicationServer() -} - -// UnimplementedReplicationServer must be embedded to have forward compatible implementations. -type UnimplementedReplicationServer struct { -} - -func (UnimplementedReplicationServer) Gossip(Replication_GossipServer) error { - return status.Errorf(codes.Unimplemented, "method Gossip not implemented") -} -func (UnimplementedReplicationServer) mustEmbedUnimplementedReplicationServer() {} - -// UnsafeReplicationServer may be embedded to opt out of forward compatibility for this service. -// Use of this interface is not recommended, as added methods to ReplicationServer will -// result in compilation errors. -type UnsafeReplicationServer interface { - mustEmbedUnimplementedReplicationServer() -} - -func RegisterReplicationServer(s grpc.ServiceRegistrar, srv ReplicationServer) { - s.RegisterService(&Replication_ServiceDesc, srv) -} - -func _Replication_Gossip_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(ReplicationServer).Gossip(&replicationGossipServer{stream}) -} - -type Replication_GossipServer interface { - Send(*Sync) error - Recv() (*Sync, error) - grpc.ServerStream -} - -type replicationGossipServer struct { - grpc.ServerStream -} - -func (x *replicationGossipServer) Send(m *Sync) error { - return x.ServerStream.SendMsg(m) -} - -func (x *replicationGossipServer) Recv() (*Sync, error) { - m := new(Sync) - if err := x.ServerStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -// Replication_ServiceDesc is the grpc.ServiceDesc for Replication service. -// It's only intended for direct use with grpc.RegisterService, -// and not to be introspected or modified (even as a copy) -var Replication_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "honu.replica.v1.Replication", - HandlerType: (*ReplicationServer)(nil), - Methods: []grpc.MethodDesc{}, - Streams: []grpc.StreamDesc{ - { - StreamName: "Gossip", - Handler: _Replication_Gossip_Handler, - ServerStreams: true, - ClientStreams: true, - }, - }, - Metadata: "replica/v1/replica.proto", -} diff --git a/versions/versions.go b/versions/versions.go deleted file mode 100644 index 7c575db..0000000 --- a/versions/versions.go +++ /dev/null @@ -1,94 +0,0 @@ -package versions - -import ( - "errors" - "fmt" - - "github.com/rotationalio/honu/config" - pb "github.com/rotationalio/honu/object/v1" - "google.golang.org/protobuf/types/known/timestamppb" -) - -// New creates a new manager for handling lamport scalar versions. -func New(conf config.ReplicaConfig) (v *Manager, err error) { - // Make sure we don't create a VersionManager that is unable to do its job. - if conf.PID == 0 || conf.Region == "" { - return nil, errors.New("improperly configured: version manager requires PID and Region") - } - - v = &Manager{PID: conf.PID, Region: conf.Region} - - // Compute the owner name - if conf.Name != "" { - // The common name - v.Owner = fmt.Sprintf("%d:%s", conf.PID, conf.Name) - } else { - // The owner name is just the pid:region - v.Owner = fmt.Sprintf("%d:%s", conf.PID, conf.Region) - } - - return v, nil -} - -// Manager is configured with information associated with the local Replica in -// order to correctly implement Lamport clocks for sequential, conflict-free replicated -// versions. -type Manager struct { - PID uint64 - Owner string - Region string -} - -// Update the version of an object in place. -// If the object was previously a tombstone (e.g. deleted) then it is "undeleted". -func (v Manager) Update(meta *pb.Object) error { - if meta == nil { - return errors.New("cannot update version on empty object") - } - - // Update the parent to the current version of the object. - if meta.Version != nil && !meta.Version.IsZero() { - meta.Version.Parent = meta.Version.Clone() - } else { - // This is the first version of the object. Also set provenance on the object. - meta.Version = &pb.Version{} - meta.Region = v.Region - meta.Owner = v.Owner - } - - // Update the version to the new version of the local version manager, - // Undelete the version if it was a Tombstone before - v.updateVersion(meta, false) - return nil -} - -// Delete creates a tombstone version of the object in place. -func (v Manager) Delete(meta *pb.Object) error { - if meta == nil { - return errors.New("cannot create tombstone version on empty object") - } - - if meta.Version == nil || meta.Version.IsZero() { - // This is the first version of the object, it cannot be deleted. - return errors.New("cannot delete version that doesn't exist yet") - } - - // Cannot delete a tombstone - if meta.Version.Tombstone { - return errors.New("cannot delete an already deleted object") - } - meta.Version.Parent = meta.Version.Clone() - - //Update Pid, Version, Region and Tombstone for the version. - v.updateVersion(meta, true) - return nil -} - -// Assigns the attributes of the passed versionManager to the object. -func (v Manager) updateVersion(meta *pb.Object, delete_version bool) { - meta.Version.Pid = v.PID - meta.Version.Version++ - meta.Version.Region = v.Region - meta.Version.Tombstone = delete_version - meta.Version.Modified = timestamppb.Now() -} diff --git a/versions/versions_test.go b/versions/versions_test.go deleted file mode 100644 index 9bf55c0..0000000 --- a/versions/versions_test.go +++ /dev/null @@ -1,185 +0,0 @@ -package versions_test - -import ( - "testing" - - "github.com/rotationalio/honu/config" - pb "github.com/rotationalio/honu/object/v1" - . "github.com/rotationalio/honu/versions" - "github.com/stretchr/testify/require" -) - -func TestVersionManager(t *testing.T) { - conf := config.ReplicaConfig{} - - // Check required settings - _, err := New(conf) - require.Error(t, err) - - conf.PID = 8 - _, err = New(conf) - require.Error(t, err) - - conf.Region = "us-east-2c" - vers1, err := New(conf) - require.NoError(t, err) - require.Equal(t, "8:us-east-2c", vers1.Owner) - - conf.Name = "mitchell" - vers1, err = New(conf) - require.NoError(t, err) - require.Equal(t, "8:mitchell", vers1.Owner) - - // Check update system - require.Error(t, vers1.Update(nil)) - - // Expected object definition: - // &Object{ - // Key: "foo", - // Namespace: "awesome", - // Region: "us-east-2c", - // Owner: "8:mitchell", - // Version: &Version{ - // PID: 8, - // Version: 1, - // Region: "us-east-2c", - // Parent: nil, - // }, - // } - - obj := &pb.Object{Key: []byte("foo"), Namespace: "awesome"} - require.NoError(t, vers1.Update(obj)) - require.Equal(t, vers1.Region, obj.Region) - require.Equal(t, vers1.Owner, obj.Owner) - require.Equal(t, vers1.PID, obj.Version.Pid) - require.Equal(t, uint64(1), obj.Version.Version) - require.Equal(t, vers1.Region, obj.Version.Region) - require.Empty(t, obj.Version.Parent) - require.False(t, obj.Tombstone()) - require.NotEmpty(t, obj.Version.Modified) - require.False(t, obj.Version.Modified.AsTime().IsZero()) - - // Create a new remote versioner - conf.PID = 13 - conf.Region = "europe-west-3" - conf.Name = "jacques" - vers2, err := New(conf) - require.NoError(t, err) - - // Update the previous version - require.NoError(t, vers2.Update(obj)) - - // Expected object definition: - // &Object{ - // Key: "foo", - // Namespace: "awesome", - // Region: "us-east-2c", - // Owner: "8:mitchell", - // Version: &Version{ - // Pid: 13, - // Version: 2, - // Region: "europe-west-3", - // Parent: &Version{ - // Pid: 8, - // Version: 1, - // Region: "us-east-2c", - // }, - // }, - // } - - require.Equal(t, vers1.Region, obj.Region) - require.Equal(t, vers1.Owner, obj.Owner) - require.Equal(t, vers2.PID, obj.Version.Pid) - require.Equal(t, uint64(2), obj.Version.Version) - require.Equal(t, vers2.Region, obj.Version.Region) - require.NotEmpty(t, obj.Version.Parent) - require.False(t, obj.Version.Parent.IsZero()) - require.Equal(t, vers1.PID, obj.Version.Parent.Pid) - require.Equal(t, uint64(1), obj.Version.Parent.Version) - require.Equal(t, vers1.Region, obj.Version.Parent.Region) - require.False(t, obj.Tombstone()) - require.NotEmpty(t, obj.Version.Modified) - require.False(t, obj.Version.Modified.AsTime().IsZero()) - - // Test Delete - creating a tombstone - require.NoError(t, vers1.Delete(obj)) - - // Expected object definition: - // &Object{ - // Key: "foo", - // Namespace: "awesome", - // Region: "us-east-2c", - // Owner: "8:mitchell", - // Version: &Version{ - // Pid: 8, - // Version: 3, - // Region: "us-east-2c", - // Parent: &Version{ - // Pid: 13, - // Version: 2, - // Region: "europe-west-3", - // }, - // Tombstone: true, - // }, - // } - - require.Equal(t, vers1.Region, obj.Region) - require.Equal(t, vers1.Owner, obj.Owner) - require.Equal(t, vers1.PID, obj.Version.Pid) - require.Equal(t, uint64(3), obj.Version.Version) - require.Equal(t, vers1.Region, obj.Version.Region) - require.NotEmpty(t, obj.Version.Parent) - require.False(t, obj.Version.Parent.IsZero()) - require.Equal(t, vers2.PID, obj.Version.Parent.Pid) - require.Equal(t, uint64(2), obj.Version.Parent.Version) - require.Equal(t, vers2.Region, obj.Version.Parent.Region) - require.True(t, obj.Tombstone()) - require.NotEmpty(t, obj.Version.Modified) - require.False(t, obj.Version.Modified.AsTime().IsZero()) - - // Cannot delete a deleted object - require.Error(t, vers1.Delete(obj)) - - // Cannot delete a nil object - require.Error(t, vers1.Delete(nil)) - - // Cannot delete an empty object - require.Error(t, vers1.Delete(&pb.Object{})) - require.Error(t, vers1.Delete(&pb.Object{Version: &pb.Version{}})) - - // Test Undelete the object - require.NoError(t, vers1.Update(obj)) - - // Expected object definition: - // &Object{ - // Key: "foo", - // Namespace: "awesome", - // Region: "us-east-2c", - // Owner: "8:mitchell", - // Version: &Version{ - // Pid: 8, - // Version: 4, - // Region: "us-east-2c", - // Parent: &Version{ - // Pid: 9, - // Version: 3, - // Region: "us-east-2c", - // }, - // Tombstone: false, - // }, - // } - - require.Equal(t, vers1.Region, obj.Region) - require.Equal(t, vers1.Owner, obj.Owner) - require.Equal(t, vers1.PID, obj.Version.Pid) - require.Equal(t, uint64(4), obj.Version.Version) - require.Equal(t, vers1.Region, obj.Version.Region) - require.NotEmpty(t, obj.Version.Parent) - require.False(t, obj.Version.Parent.IsZero()) - require.Equal(t, vers1.PID, obj.Version.Parent.Pid) - require.Equal(t, uint64(3), obj.Version.Parent.Version) - require.Equal(t, vers1.Region, obj.Version.Parent.Region) - require.False(t, obj.Tombstone()) - require.NotEmpty(t, obj.Version.Modified) - require.False(t, obj.Version.Modified.AsTime().IsZero()) -}