diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8b53fa32f..14789fc08 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,13 +5,16 @@ on: release: types: - published + pull_request: + paths-ignore: + - '**.md' env: BLOBBER_REGISTRY: ${{ secrets.BLOBBER_REGISTRY }} VALIDATOR_REGISTRY: ${{ secrets.VALIDATOR_REGISTRY }} jobs: - build: + test: runs-on: ubuntu-20.04 steps: - name: Install Go @@ -25,21 +28,15 @@ jobs: - uses: satackey/action-docker-layer-caching@v0.0.11 # Ignore the failure of a step and avoid terminating the job. continue-on-error: true - - name: Build + - name: Build test environment and run tests run: | + ./docker.local/bin/blobber.init.setup.sh docker network create --driver=bridge --subnet=198.18.0.0/15 --gateway=198.18.0.255 testnet0 ./docker.local/bin/build.blobber.sh - test: - runs-on: ubuntu-20.04 - steps: - - name: Install Go - uses: actions/setup-go@v2 - with: - go-version: 1.14.x - - uses: actions/checkout@v2 - - name: Test - run: make test - + cd docker.local/blobber1 + ../bin/blobber.start_bls.sh /dev/null & + cd ../.. + make integration-tests lint: runs-on: ubuntu-20.04 steps: @@ -76,10 +73,9 @@ jobs: git reset --hard - name: Generate Files run: | - cd code/go/0chain.net/blobbercore ./scripts/generate-grpc.sh - name: Fail if any file has changed - run: if output=$(git status --porcelain) && [ -z "$output" ]; then exit 0; else git status; exit 1; fi; + run: if output=$(git status --porcelain) && [ -z "$output" ]; then exit 0; else git status; git diff; exit 1; fi; dockerize_blobber: runs-on: ubuntu-20.04 diff --git a/Makefile b/Makefile index b85f580b9..ba3dd4b74 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,10 @@ -.PHONY: test lint +.PHONY: test lint integration-tests test: - cd code/go/0chain.net; go test ./...; + go test ./...; lint: - cd code/go/0chain.net; golangci-lint run; \ No newline at end of file + golangci-lint run --timeout 2m0s; + +integration-tests: + sudo go test ./... -args integration; diff --git a/code/go/0chain.net/blobber/integration_tests.go b/code/go/0chain.net/blobber/integration_tests.go index 381e5f963..5ac88c2fa 100644 --- a/code/go/0chain.net/blobber/integration_tests.go +++ b/code/go/0chain.net/blobber/integration_tests.go @@ -3,9 +3,9 @@ package main import ( - "0chain.net/core/logging" + "github.com/0chain/blobber/code/go/0chain.net/core/logging" - crpc "0chain.net/conductor/conductrpc" // integration tests + crpc "github.com/0chain/blobber/code/go/0chain.net/conductor/conductrpc" // integration tests ) // start lock, where the miner is ready to connect to blockchain (BC) diff --git a/code/go/0chain.net/blobber/main.go b/code/go/0chain.net/blobber/main.go index 2a1944721..071d0229b 100644 --- a/code/go/0chain.net/blobber/main.go +++ b/code/go/0chain.net/blobber/main.go @@ -12,27 +12,30 @@ import ( "runtime" "strconv" "time" - "go.uber.org/zap" + + "google.golang.org/grpc/reflection" + + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/allocation" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/challenge" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/config" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/datastore" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/filestore" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/handler" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/readmarker" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/writemarker" + "github.com/0chain/blobber/code/go/0chain.net/core/build" + "github.com/0chain/blobber/code/go/0chain.net/core/chain" + "github.com/0chain/blobber/code/go/0chain.net/core/common" + "github.com/0chain/blobber/code/go/0chain.net/core/encryption" + "github.com/0chain/blobber/code/go/0chain.net/core/logging" + . "github.com/0chain/blobber/code/go/0chain.net/core/logging" + "github.com/0chain/blobber/code/go/0chain.net/core/node" + + "github.com/0chain/gosdk/zcncore" "github.com/gorilla/handlers" "github.com/gorilla/mux" "github.com/spf13/viper" - - "github.com/0chain/gosdk/zcncore" - "0chain.net/blobbercore/allocation" - "0chain.net/blobbercore/challenge" - "0chain.net/blobbercore/config" - "0chain.net/blobbercore/datastore" - "0chain.net/blobbercore/filestore" - "0chain.net/blobbercore/handler" - "0chain.net/blobbercore/readmarker" - "0chain.net/blobbercore/writemarker" - "0chain.net/core/build" - "0chain.net/core/chain" - "0chain.net/core/common" - "0chain.net/core/encryption" - "0chain.net/core/node" - "0chain.net/core/logging" - . "0chain.net/core/logging" + "go.uber.org/zap" ) var startTime time.Time @@ -41,7 +44,7 @@ var filesDir *string var metadataDB *string func initHandlers(r *mux.Router) { - r.HandleFunc("/", func (w http.ResponseWriter, r *http.Request) { + r.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { mc := chain.GetServerChain() fmt.Fprintf(w, "
Running since %v ...\n", startTime) @@ -285,7 +288,7 @@ func healthCheckOnChainWorker() { func setup(logDir string) error { // init blockchain related stuff - zcncore.SetLogFile(logDir + "/0chainBlobber.log", false) + zcncore.SetLogFile(logDir+"/0chainBlobber.log", false) zcncore.SetLogLevel(3) if err := zcncore.InitZCNSDK(serverChain.BlockWorker, config.Configuration.SignatureScheme); err != nil { return err @@ -335,7 +338,7 @@ func main() { flag.Parse() config.SetupDefaultConfig() - config.SetupConfig() + config.SetupConfig("./config") config.Configuration.DeploymentMode = byte(*deploymentMode) @@ -364,10 +367,6 @@ func main() { panic("Please specify --port which is the port on which requests are accepted") } - if *grpcPortString == "" { - panic("Please specify --grpc_port which is the grpc port on which requests are accepted") - } - reader, err := os.Open(*keysFile) if err != nil { panic(err) @@ -452,11 +451,14 @@ func main() { methodsOk := handlers.AllowedMethods([]string{"GET", "HEAD", "POST", "PUT", "DELETE", "OPTIONS"}) - rl := common.ConfigRateLimits() + common.ConfigRateLimits() initHandlers(r) - grpcServer := handler.NewServerWithMiddlewares(rl) - handler.RegisterGRPCServices(r, grpcServer) + grpcServer := handler.NewGRPCServerWithMiddlewares(common.NewGRPCRateLimiter(), r) + + if config.Development() { + reflection.Register(grpcServer) + } rHandler := handlers.CORS(originsOk, headersOk, methodsOk)(r) if config.Development() { @@ -482,12 +484,24 @@ func main() { Logger.Info("Ready to listen to the requests") startTime = time.Now().UTC() - go func(grpcPort string) { + go func(gp *string) { + var grpcPort string + if gp != nil { + grpcPort = *gp + } + + if grpcPort == "" { + Logger.Error("Could not start grpc server since grpc port has not been specified." + + " Please specify the grpc port in the --grpc_port build arguement to start the grpc server") + return + } + + Logger.Info("listening too grpc requests on port - " + grpcPort) lis, err := net.Listen("tcp", fmt.Sprintf(":%s", grpcPort)) if err != nil { log.Fatalf("failed to listen: %v", err) } log.Fatal(grpcServer.Serve(lis)) - }(*grpcPortString) + }(grpcPortString) log.Fatal(server.ListenAndServe()) } diff --git a/code/go/0chain.net/blobbercore/allocation/allocationchange.go b/code/go/0chain.net/blobbercore/allocation/allocationchange.go index 3f3a117b6..09c124885 100644 --- a/code/go/0chain.net/blobbercore/allocation/allocationchange.go +++ b/code/go/0chain.net/blobbercore/allocation/allocationchange.go @@ -4,10 +4,10 @@ import ( "context" "errors" - "0chain.net/blobbercore/datastore" - "0chain.net/blobbercore/reference" - "0chain.net/core/common" - "0chain.net/core/logging" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/datastore" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/reference" + "github.com/0chain/blobber/code/go/0chain.net/core/common" + "github.com/0chain/blobber/code/go/0chain.net/core/logging" "go.uber.org/zap" "gorm.io/gorm" diff --git a/code/go/0chain.net/blobbercore/allocation/attributesfilechange.go b/code/go/0chain.net/blobbercore/allocation/attributesfilechange.go index 64bb9807a..6b2860aab 100644 --- a/code/go/0chain.net/blobbercore/allocation/attributesfilechange.go +++ b/code/go/0chain.net/blobbercore/allocation/attributesfilechange.go @@ -5,11 +5,11 @@ import ( "encoding/json" "path/filepath" - "0chain.net/blobbercore/reference" - "0chain.net/blobbercore/stats" - "0chain.net/core/common" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/reference" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/stats" + "github.com/0chain/blobber/code/go/0chain.net/core/common" - . "0chain.net/core/logging" + . "github.com/0chain/blobber/code/go/0chain.net/core/logging" "go.uber.org/zap" ) diff --git a/code/go/0chain.net/blobbercore/allocation/copyfilechange.go b/code/go/0chain.net/blobbercore/allocation/copyfilechange.go index 63426ea0a..df52b209b 100644 --- a/code/go/0chain.net/blobbercore/allocation/copyfilechange.go +++ b/code/go/0chain.net/blobbercore/allocation/copyfilechange.go @@ -5,8 +5,8 @@ import ( "encoding/json" "path/filepath" - "0chain.net/blobbercore/reference" - "0chain.net/core/common" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/reference" + "github.com/0chain/blobber/code/go/0chain.net/core/common" "gorm.io/datatypes" ) diff --git a/code/go/0chain.net/blobbercore/allocation/deletefilechange.go b/code/go/0chain.net/blobbercore/allocation/deletefilechange.go index 83affa99e..114f7f0c7 100644 --- a/code/go/0chain.net/blobbercore/allocation/deletefilechange.go +++ b/code/go/0chain.net/blobbercore/allocation/deletefilechange.go @@ -5,11 +5,11 @@ import ( "encoding/json" "path/filepath" - "0chain.net/blobbercore/datastore" - "0chain.net/blobbercore/filestore" - "0chain.net/blobbercore/reference" - "0chain.net/core/common" - . "0chain.net/core/logging" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/datastore" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/filestore" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/reference" + "github.com/0chain/blobber/code/go/0chain.net/core/common" + . "github.com/0chain/blobber/code/go/0chain.net/core/logging" "go.uber.org/zap" ) diff --git a/code/go/0chain.net/blobbercore/allocation/entity.go b/code/go/0chain.net/blobbercore/allocation/entity.go index 3070b4d8d..463b65239 100644 --- a/code/go/0chain.net/blobbercore/allocation/entity.go +++ b/code/go/0chain.net/blobbercore/allocation/entity.go @@ -4,7 +4,7 @@ import ( "errors" "time" - "0chain.net/core/common" + "github.com/0chain/blobber/code/go/0chain.net/core/common" "gorm.io/gorm" "gorm.io/gorm/clause" diff --git a/code/go/0chain.net/blobbercore/allocation/newfilechange.go b/code/go/0chain.net/blobbercore/allocation/newfilechange.go index 346ea89fb..8683f1d65 100644 --- a/code/go/0chain.net/blobbercore/allocation/newfilechange.go +++ b/code/go/0chain.net/blobbercore/allocation/newfilechange.go @@ -6,11 +6,11 @@ import ( "path/filepath" "strings" - "0chain.net/blobbercore/filestore" - "0chain.net/blobbercore/reference" - "0chain.net/blobbercore/stats" - "0chain.net/blobbercore/util" - "0chain.net/core/common" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/filestore" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/reference" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/stats" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/util" + "github.com/0chain/blobber/code/go/0chain.net/core/common" ) type NewFileChange struct { diff --git a/code/go/0chain.net/blobbercore/allocation/protocol.go b/code/go/0chain.net/blobbercore/allocation/protocol.go index 9239ef701..a256435c4 100644 --- a/code/go/0chain.net/blobbercore/allocation/protocol.go +++ b/code/go/0chain.net/blobbercore/allocation/protocol.go @@ -6,12 +6,12 @@ import ( "errors" "fmt" - "0chain.net/blobbercore/datastore" - "0chain.net/core/chain" - "0chain.net/core/common" - . "0chain.net/core/logging" - "0chain.net/core/node" - "0chain.net/core/transaction" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/datastore" + "github.com/0chain/blobber/code/go/0chain.net/core/chain" + "github.com/0chain/blobber/code/go/0chain.net/core/common" + . "github.com/0chain/blobber/code/go/0chain.net/core/logging" + "github.com/0chain/blobber/code/go/0chain.net/core/node" + "github.com/0chain/blobber/code/go/0chain.net/core/transaction" "gorm.io/gorm" ) diff --git a/code/go/0chain.net/blobbercore/allocation/renamefilechange.go b/code/go/0chain.net/blobbercore/allocation/renamefilechange.go index fe04d10f8..b4b7d9e97 100644 --- a/code/go/0chain.net/blobbercore/allocation/renamefilechange.go +++ b/code/go/0chain.net/blobbercore/allocation/renamefilechange.go @@ -5,10 +5,10 @@ import ( "encoding/json" "path/filepath" - "0chain.net/blobbercore/reference" - "0chain.net/blobbercore/stats" - "0chain.net/core/common" - ."0chain.net/core/logging" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/reference" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/stats" + "github.com/0chain/blobber/code/go/0chain.net/core/common" + . "github.com/0chain/blobber/code/go/0chain.net/core/logging" "go.uber.org/zap" ) @@ -76,7 +76,7 @@ func (rf *RenameFileChange) ProcessChange(ctx context.Context, change *Allocatio } } if idx < 0 { - Logger.Error("error in file rename", zap.Any("change",rf)) + Logger.Error("error in file rename", zap.Any("change", rf)) return nil, common.NewError("file_not_found", "File to rename not found in blobber") } //dirRef.Children[idx] = affectedRef diff --git a/code/go/0chain.net/blobbercore/allocation/updatefilechange.go b/code/go/0chain.net/blobbercore/allocation/updatefilechange.go index 835cd36ce..d06006f12 100644 --- a/code/go/0chain.net/blobbercore/allocation/updatefilechange.go +++ b/code/go/0chain.net/blobbercore/allocation/updatefilechange.go @@ -5,12 +5,12 @@ import ( "encoding/json" "path/filepath" - "0chain.net/blobbercore/filestore" - "0chain.net/blobbercore/stats" - "0chain.net/blobbercore/reference" - "0chain.net/blobbercore/util" - "0chain.net/core/common" - . "0chain.net/core/logging" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/filestore" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/reference" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/stats" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/util" + "github.com/0chain/blobber/code/go/0chain.net/core/common" + . "github.com/0chain/blobber/code/go/0chain.net/core/logging" "go.uber.org/zap" ) diff --git a/code/go/0chain.net/blobbercore/allocation/workers.go b/code/go/0chain.net/blobbercore/allocation/workers.go index bbd0c1c37..be54375c5 100644 --- a/code/go/0chain.net/blobbercore/allocation/workers.go +++ b/code/go/0chain.net/blobbercore/allocation/workers.go @@ -8,16 +8,16 @@ import ( "math/big" "time" - "0chain.net/blobbercore/datastore" - "0chain.net/blobbercore/reference" - "0chain.net/core/chain" - "0chain.net/core/common" - "0chain.net/core/lock" - "0chain.net/core/transaction" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/datastore" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/reference" + "github.com/0chain/blobber/code/go/0chain.net/core/chain" + "github.com/0chain/blobber/code/go/0chain.net/core/common" + "github.com/0chain/blobber/code/go/0chain.net/core/lock" + "github.com/0chain/blobber/code/go/0chain.net/core/transaction" "gorm.io/gorm" - . "0chain.net/core/logging" + . "github.com/0chain/blobber/code/go/0chain.net/core/logging" "go.uber.org/zap" ) diff --git a/code/go/0chain.net/blobbercore/blobbergrpc/README.md b/code/go/0chain.net/blobbercore/blobbergrpc/README.md index 95e391dcc..5ac239d6a 100644 --- a/code/go/0chain.net/blobbercore/blobbergrpc/README.md +++ b/code/go/0chain.net/blobbercore/blobbergrpc/README.md @@ -1,10 +1,47 @@ -# GRPC Migration +# GRPC Endpoints -Modify the '.proto' file in `blobbergrpc/proto/blobber.proto` and run +## Development + +Modify the '.proto' file in `code/go/0chain.net/blobbercore/blobbergrpc/proto/blobber.proto` and run `scripts/generate-grpc.sh` to add new api's. -GRPC API is implemented in `handler/grpc_handler.go`. +GRPC API is implemented in `code/go/0chain.net/blobbercore/handler/grpc_handler.go`. + +## Installation + +Install the [protoc](https://grpc.io/docs/protoc-installation/) command line interface. + +``` +go install \ +github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway \ +github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2 \ +google.golang.org/protobuf/cmd/protoc-gen-go \ +google.golang.org/grpc/cmd/protoc-gen-go-grpc +``` + +Run this command to install all the GRPC related binaries required to generate GRPC related files using `protoc` CLI. + +Now you can run the script in `scripts/generate-grpc.sh`. ## Plugins + * [grpc-gateway](https://github.com/grpc-ecosystem/grpc-gateway) -plugin is being used to expose a REST api for grpc incompatible clients. \ No newline at end of file +plugin is being used to expose a REST api for grpc incompatible clients. + +## Testing + +The current grpc implementation supports server reflection in development environment. +You can interact with the api using https://github.com/gusaul/grpcox. While running locally make sure +to use docker network ip and not localhost. + +Make sure the server is running on `--deployment_mode 0` to use server reflection. + +You can use https://github.com/vektra/mockery to generate mocks for tests. + +## Documentation + +Basic documentation can be found here - https://grpc.io/docs/languages/go/basics/. + +Advanced documentation can be found here - https://github.com/grpc/grpc-go/tree/master/Documentation. + + diff --git a/code/go/0chain.net/blobbercore/blobbergrpc/blobber.pb.go b/code/go/0chain.net/blobbercore/blobbergrpc/blobber.pb.go index 2fb934d7c..c5723434b 100644 --- a/code/go/0chain.net/blobbercore/blobbergrpc/blobber.pb.go +++ b/code/go/0chain.net/blobbercore/blobbergrpc/blobber.pb.go @@ -21,18 +21,20 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) -type GetObjectTreeRequest struct { +type CollaboratorRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Context *RequestContext `protobuf:"bytes,1,opt,name=context,proto3" json:"context,omitempty"` - Path string `protobuf:"bytes,2,opt,name=path,proto3" json:"path,omitempty"` - Allocation string `protobuf:"bytes,3,opt,name=allocation,proto3" json:"allocation,omitempty"` + Allocation string `protobuf:"bytes,1,opt,name=allocation,proto3" json:"allocation,omitempty"` + CollabId string `protobuf:"bytes,2,opt,name=collab_id,json=collabId,proto3" json:"collab_id,omitempty"` + Method string `protobuf:"bytes,3,opt,name=method,proto3" json:"method,omitempty"` + Path string `protobuf:"bytes,4,opt,name=path,proto3" json:"path,omitempty"` + PathHash string `protobuf:"bytes,5,opt,name=path_hash,json=pathHash,proto3" json:"path_hash,omitempty"` } -func (x *GetObjectTreeRequest) Reset() { - *x = GetObjectTreeRequest{} +func (x *CollaboratorRequest) Reset() { + *x = CollaboratorRequest{} if protoimpl.UnsafeEnabled { mi := &file_blobber_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -40,13 +42,13 @@ func (x *GetObjectTreeRequest) Reset() { } } -func (x *GetObjectTreeRequest) String() string { +func (x *CollaboratorRequest) String() string { return protoimpl.X.MessageStringOf(x) } -func (*GetObjectTreeRequest) ProtoMessage() {} +func (*CollaboratorRequest) ProtoMessage() {} -func (x *GetObjectTreeRequest) ProtoReflect() protoreflect.Message { +func (x *CollaboratorRequest) ProtoReflect() protoreflect.Message { mi := &file_blobber_proto_msgTypes[0] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -58,43 +60,57 @@ func (x *GetObjectTreeRequest) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use GetObjectTreeRequest.ProtoReflect.Descriptor instead. -func (*GetObjectTreeRequest) Descriptor() ([]byte, []int) { +// Deprecated: Use CollaboratorRequest.ProtoReflect.Descriptor instead. +func (*CollaboratorRequest) Descriptor() ([]byte, []int) { return file_blobber_proto_rawDescGZIP(), []int{0} } -func (x *GetObjectTreeRequest) GetContext() *RequestContext { +func (x *CollaboratorRequest) GetAllocation() string { if x != nil { - return x.Context + return x.Allocation } - return nil + return "" } -func (x *GetObjectTreeRequest) GetPath() string { +func (x *CollaboratorRequest) GetCollabId() string { + if x != nil { + return x.CollabId + } + return "" +} + +func (x *CollaboratorRequest) GetMethod() string { + if x != nil { + return x.Method + } + return "" +} + +func (x *CollaboratorRequest) GetPath() string { if x != nil { return x.Path } return "" } -func (x *GetObjectTreeRequest) GetAllocation() string { +func (x *CollaboratorRequest) GetPathHash() string { if x != nil { - return x.Allocation + return x.PathHash } return "" } -type GetObjectTreeResponse struct { +type CollaboratorResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - ReferencePath *ReferencePath `protobuf:"bytes,1,opt,name=ReferencePath,proto3" json:"ReferencePath,omitempty"` - LatestWM *WriteMarker `protobuf:"bytes,2,opt,name=LatestWM,proto3" json:"LatestWM,omitempty"` + Message string `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"` + Collaborators []*Collaborator `protobuf:"bytes,2,rep,name=collaborators,proto3" json:"collaborators,omitempty"` } -func (x *GetObjectTreeResponse) Reset() { - *x = GetObjectTreeResponse{} +func (x *CollaboratorResponse) Reset() { + *x = CollaboratorResponse{} if protoimpl.UnsafeEnabled { mi := &file_blobber_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -102,13 +118,13 @@ func (x *GetObjectTreeResponse) Reset() { } } -func (x *GetObjectTreeResponse) String() string { +func (x *CollaboratorResponse) String() string { return protoimpl.X.MessageStringOf(x) } -func (*GetObjectTreeResponse) ProtoMessage() {} +func (*CollaboratorResponse) ProtoMessage() {} -func (x *GetObjectTreeResponse) ProtoReflect() protoreflect.Message { +func (x *CollaboratorResponse) ProtoReflect() protoreflect.Message { mi := &file_blobber_proto_msgTypes[1] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -120,38 +136,37 @@ func (x *GetObjectTreeResponse) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use GetObjectTreeResponse.ProtoReflect.Descriptor instead. -func (*GetObjectTreeResponse) Descriptor() ([]byte, []int) { +// Deprecated: Use CollaboratorResponse.ProtoReflect.Descriptor instead. +func (*CollaboratorResponse) Descriptor() ([]byte, []int) { return file_blobber_proto_rawDescGZIP(), []int{1} } -func (x *GetObjectTreeResponse) GetReferencePath() *ReferencePath { +func (x *CollaboratorResponse) GetMessage() string { if x != nil { - return x.ReferencePath + return x.Message } - return nil + return "" } -func (x *GetObjectTreeResponse) GetLatestWM() *WriteMarker { +func (x *CollaboratorResponse) GetCollaborators() []*Collaborator { if x != nil { - return x.LatestWM + return x.Collaborators } return nil } -type GetReferencePathRequest struct { +type CalculateHashRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Context *RequestContext `protobuf:"bytes,1,opt,name=Context,proto3" json:"Context,omitempty"` - Paths string `protobuf:"bytes,2,opt,name=Paths,proto3" json:"Paths,omitempty"` - Path string `protobuf:"bytes,3,opt,name=Path,proto3" json:"Path,omitempty"` - Allocation string `protobuf:"bytes,4,opt,name=allocation,proto3" json:"allocation,omitempty"` + Allocation string `protobuf:"bytes,1,opt,name=allocation,proto3" json:"allocation,omitempty"` + Path string `protobuf:"bytes,2,opt,name=path,proto3" json:"path,omitempty"` + Paths string `protobuf:"bytes,3,opt,name=paths,proto3" json:"paths,omitempty"` } -func (x *GetReferencePathRequest) Reset() { - *x = GetReferencePathRequest{} +func (x *CalculateHashRequest) Reset() { + *x = CalculateHashRequest{} if protoimpl.UnsafeEnabled { mi := &file_blobber_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -159,13 +174,13 @@ func (x *GetReferencePathRequest) Reset() { } } -func (x *GetReferencePathRequest) String() string { +func (x *CalculateHashRequest) String() string { return protoimpl.X.MessageStringOf(x) } -func (*GetReferencePathRequest) ProtoMessage() {} +func (*CalculateHashRequest) ProtoMessage() {} -func (x *GetReferencePathRequest) ProtoReflect() protoreflect.Message { +func (x *CalculateHashRequest) ProtoReflect() protoreflect.Message { mi := &file_blobber_proto_msgTypes[2] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -177,50 +192,42 @@ func (x *GetReferencePathRequest) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use GetReferencePathRequest.ProtoReflect.Descriptor instead. -func (*GetReferencePathRequest) Descriptor() ([]byte, []int) { +// Deprecated: Use CalculateHashRequest.ProtoReflect.Descriptor instead. +func (*CalculateHashRequest) Descriptor() ([]byte, []int) { return file_blobber_proto_rawDescGZIP(), []int{2} } -func (x *GetReferencePathRequest) GetContext() *RequestContext { - if x != nil { - return x.Context - } - return nil -} - -func (x *GetReferencePathRequest) GetPaths() string { +func (x *CalculateHashRequest) GetAllocation() string { if x != nil { - return x.Paths + return x.Allocation } return "" } -func (x *GetReferencePathRequest) GetPath() string { +func (x *CalculateHashRequest) GetPath() string { if x != nil { return x.Path } return "" } -func (x *GetReferencePathRequest) GetAllocation() string { +func (x *CalculateHashRequest) GetPaths() string { if x != nil { - return x.Allocation + return x.Paths } return "" } -type GetReferencePathResponse struct { +type CalculateHashResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - ReferencePath *ReferencePath `protobuf:"bytes,1,opt,name=ReferencePath,proto3" json:"ReferencePath,omitempty"` - LatestWM *WriteMarker `protobuf:"bytes,2,opt,name=LatestWM,proto3" json:"LatestWM,omitempty"` + Message string `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"` } -func (x *GetReferencePathResponse) Reset() { - *x = GetReferencePathResponse{} +func (x *CalculateHashResponse) Reset() { + *x = CalculateHashResponse{} if protoimpl.UnsafeEnabled { mi := &file_blobber_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -228,13 +235,13 @@ func (x *GetReferencePathResponse) Reset() { } } -func (x *GetReferencePathResponse) String() string { +func (x *CalculateHashResponse) String() string { return protoimpl.X.MessageStringOf(x) } -func (*GetReferencePathResponse) ProtoMessage() {} +func (*CalculateHashResponse) ProtoMessage() {} -func (x *GetReferencePathResponse) ProtoReflect() protoreflect.Message { +func (x *CalculateHashResponse) ProtoReflect() protoreflect.Message { mi := &file_blobber_proto_msgTypes[3] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -246,36 +253,30 @@ func (x *GetReferencePathResponse) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use GetReferencePathResponse.ProtoReflect.Descriptor instead. -func (*GetReferencePathResponse) Descriptor() ([]byte, []int) { +// Deprecated: Use CalculateHashResponse.ProtoReflect.Descriptor instead. +func (*CalculateHashResponse) Descriptor() ([]byte, []int) { return file_blobber_proto_rawDescGZIP(), []int{3} } -func (x *GetReferencePathResponse) GetReferencePath() *ReferencePath { - if x != nil { - return x.ReferencePath - } - return nil -} - -func (x *GetReferencePathResponse) GetLatestWM() *WriteMarker { +func (x *CalculateHashResponse) GetMessage() string { if x != nil { - return x.LatestWM + return x.Message } - return nil + return "" } -type ReferencePath struct { +type CommitRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - MetaData *FileRef `protobuf:"bytes,1,opt,name=MetaData,proto3" json:"MetaData,omitempty"` - List []*ReferencePath `protobuf:"bytes,2,rep,name=List,proto3" json:"List,omitempty"` + Allocation string `protobuf:"bytes,1,opt,name=allocation,proto3" json:"allocation,omitempty"` + ConnectionId string `protobuf:"bytes,2,opt,name=connection_id,json=connectionId,proto3" json:"connection_id,omitempty"` + WriteMarker string `protobuf:"bytes,3,opt,name=write_marker,json=writeMarker,proto3" json:"write_marker,omitempty"` } -func (x *ReferencePath) Reset() { - *x = ReferencePath{} +func (x *CommitRequest) Reset() { + *x = CommitRequest{} if protoimpl.UnsafeEnabled { mi := &file_blobber_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -283,13 +284,13 @@ func (x *ReferencePath) Reset() { } } -func (x *ReferencePath) String() string { +func (x *CommitRequest) String() string { return protoimpl.X.MessageStringOf(x) } -func (*ReferencePath) ProtoMessage() {} +func (*CommitRequest) ProtoMessage() {} -func (x *ReferencePath) ProtoReflect() protoreflect.Message { +func (x *CommitRequest) ProtoReflect() protoreflect.Message { mi := &file_blobber_proto_msgTypes[4] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -301,38 +302,45 @@ func (x *ReferencePath) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use ReferencePath.ProtoReflect.Descriptor instead. -func (*ReferencePath) Descriptor() ([]byte, []int) { +// Deprecated: Use CommitRequest.ProtoReflect.Descriptor instead. +func (*CommitRequest) Descriptor() ([]byte, []int) { return file_blobber_proto_rawDescGZIP(), []int{4} } -func (x *ReferencePath) GetMetaData() *FileRef { +func (x *CommitRequest) GetAllocation() string { if x != nil { - return x.MetaData + return x.Allocation } - return nil + return "" } -func (x *ReferencePath) GetList() []*ReferencePath { +func (x *CommitRequest) GetConnectionId() string { if x != nil { - return x.List + return x.ConnectionId } - return nil + return "" } -type GetObjectPathRequest struct { +func (x *CommitRequest) GetWriteMarker() string { + if x != nil { + return x.WriteMarker + } + return "" +} + +type CommitResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Context *RequestContext `protobuf:"bytes,1,opt,name=context,proto3" json:"context,omitempty"` - Allocation string `protobuf:"bytes,2,opt,name=allocation,proto3" json:"allocation,omitempty"` - Path string `protobuf:"bytes,3,opt,name=Path,proto3" json:"Path,omitempty"` - BlockNum string `protobuf:"bytes,4,opt,name=BlockNum,proto3" json:"BlockNum,omitempty"` + AllocationRoot string `protobuf:"bytes,1,opt,name=allocation_root,json=allocationRoot,proto3" json:"allocation_root,omitempty"` + WriteMarker *WriteMarker `protobuf:"bytes,2,opt,name=write_marker,json=writeMarker,proto3" json:"write_marker,omitempty"` + ErrorMessage string `protobuf:"bytes,3,opt,name=error_message,json=errorMessage,proto3" json:"error_message,omitempty"` + Success bool `protobuf:"varint,4,opt,name=success,proto3" json:"success,omitempty"` } -func (x *GetObjectPathRequest) Reset() { - *x = GetObjectPathRequest{} +func (x *CommitResponse) Reset() { + *x = CommitResponse{} if protoimpl.UnsafeEnabled { mi := &file_blobber_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -340,13 +348,13 @@ func (x *GetObjectPathRequest) Reset() { } } -func (x *GetObjectPathRequest) String() string { +func (x *CommitResponse) String() string { return protoimpl.X.MessageStringOf(x) } -func (*GetObjectPathRequest) ProtoMessage() {} +func (*CommitResponse) ProtoMessage() {} -func (x *GetObjectPathRequest) ProtoReflect() protoreflect.Message { +func (x *CommitResponse) ProtoReflect() protoreflect.Message { mi := &file_blobber_proto_msgTypes[5] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -358,50 +366,53 @@ func (x *GetObjectPathRequest) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use GetObjectPathRequest.ProtoReflect.Descriptor instead. -func (*GetObjectPathRequest) Descriptor() ([]byte, []int) { +// Deprecated: Use CommitResponse.ProtoReflect.Descriptor instead. +func (*CommitResponse) Descriptor() ([]byte, []int) { return file_blobber_proto_rawDescGZIP(), []int{5} } -func (x *GetObjectPathRequest) GetContext() *RequestContext { +func (x *CommitResponse) GetAllocationRoot() string { if x != nil { - return x.Context + return x.AllocationRoot } - return nil + return "" } -func (x *GetObjectPathRequest) GetAllocation() string { +func (x *CommitResponse) GetWriteMarker() *WriteMarker { if x != nil { - return x.Allocation + return x.WriteMarker } - return "" + return nil } -func (x *GetObjectPathRequest) GetPath() string { +func (x *CommitResponse) GetErrorMessage() string { if x != nil { - return x.Path + return x.ErrorMessage } return "" } -func (x *GetObjectPathRequest) GetBlockNum() string { +func (x *CommitResponse) GetSuccess() bool { if x != nil { - return x.BlockNum + return x.Success } - return "" + return false } -type GetObjectPathResponse struct { +type CommitMetaTxnRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - ObjectPath *ObjectPath `protobuf:"bytes,1,opt,name=ObjectPath,proto3" json:"ObjectPath,omitempty"` - LatestWriteMarker *WriteMarker `protobuf:"bytes,2,opt,name=LatestWriteMarker,proto3" json:"LatestWriteMarker,omitempty"` + Path string `protobuf:"bytes,1,opt,name=path,proto3" json:"path,omitempty"` + PathHash string `protobuf:"bytes,2,opt,name=path_hash,json=pathHash,proto3" json:"path_hash,omitempty"` + AuthToken string `protobuf:"bytes,3,opt,name=auth_token,json=authToken,proto3" json:"auth_token,omitempty"` + Allocation string `protobuf:"bytes,4,opt,name=allocation,proto3" json:"allocation,omitempty"` + TxnId string `protobuf:"bytes,5,opt,name=txn_id,json=txnId,proto3" json:"txn_id,omitempty"` } -func (x *GetObjectPathResponse) Reset() { - *x = GetObjectPathResponse{} +func (x *CommitMetaTxnRequest) Reset() { + *x = CommitMetaTxnRequest{} if protoimpl.UnsafeEnabled { mi := &file_blobber_proto_msgTypes[6] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -409,13 +420,13 @@ func (x *GetObjectPathResponse) Reset() { } } -func (x *GetObjectPathResponse) String() string { +func (x *CommitMetaTxnRequest) String() string { return protoimpl.X.MessageStringOf(x) } -func (*GetObjectPathResponse) ProtoMessage() {} +func (*CommitMetaTxnRequest) ProtoMessage() {} -func (x *GetObjectPathResponse) ProtoReflect() protoreflect.Message { +func (x *CommitMetaTxnRequest) ProtoReflect() protoreflect.Message { mi := &file_blobber_proto_msgTypes[6] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -427,38 +438,56 @@ func (x *GetObjectPathResponse) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use GetObjectPathResponse.ProtoReflect.Descriptor instead. -func (*GetObjectPathResponse) Descriptor() ([]byte, []int) { +// Deprecated: Use CommitMetaTxnRequest.ProtoReflect.Descriptor instead. +func (*CommitMetaTxnRequest) Descriptor() ([]byte, []int) { return file_blobber_proto_rawDescGZIP(), []int{6} } -func (x *GetObjectPathResponse) GetObjectPath() *ObjectPath { +func (x *CommitMetaTxnRequest) GetPath() string { if x != nil { - return x.ObjectPath + return x.Path } - return nil + return "" } -func (x *GetObjectPathResponse) GetLatestWriteMarker() *WriteMarker { +func (x *CommitMetaTxnRequest) GetPathHash() string { if x != nil { - return x.LatestWriteMarker + return x.PathHash } - return nil + return "" } -type ObjectPath struct { +func (x *CommitMetaTxnRequest) GetAuthToken() string { + if x != nil { + return x.AuthToken + } + return "" +} + +func (x *CommitMetaTxnRequest) GetAllocation() string { + if x != nil { + return x.Allocation + } + return "" +} + +func (x *CommitMetaTxnRequest) GetTxnId() string { + if x != nil { + return x.TxnId + } + return "" +} + +type CommitMetaTxnResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - RootHash string `protobuf:"bytes,1,opt,name=RootHash,proto3" json:"RootHash,omitempty"` - Meta *FileRef `protobuf:"bytes,2,opt,name=Meta,proto3" json:"Meta,omitempty"` - Path *FileRef `protobuf:"bytes,3,opt,name=Path,proto3" json:"Path,omitempty"` - FileBlockNum int64 `protobuf:"varint,4,opt,name=FileBlockNum,proto3" json:"FileBlockNum,omitempty"` + Message string `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"` } -func (x *ObjectPath) Reset() { - *x = ObjectPath{} +func (x *CommitMetaTxnResponse) Reset() { + *x = CommitMetaTxnResponse{} if protoimpl.UnsafeEnabled { mi := &file_blobber_proto_msgTypes[7] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -466,13 +495,13 @@ func (x *ObjectPath) Reset() { } } -func (x *ObjectPath) String() string { +func (x *CommitMetaTxnResponse) String() string { return protoimpl.X.MessageStringOf(x) } -func (*ObjectPath) ProtoMessage() {} +func (*CommitMetaTxnResponse) ProtoMessage() {} -func (x *ObjectPath) ProtoReflect() protoreflect.Message { +func (x *CommitMetaTxnResponse) ProtoReflect() protoreflect.Message { mi := &file_blobber_proto_msgTypes[7] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -484,56 +513,29 @@ func (x *ObjectPath) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use ObjectPath.ProtoReflect.Descriptor instead. -func (*ObjectPath) Descriptor() ([]byte, []int) { +// Deprecated: Use CommitMetaTxnResponse.ProtoReflect.Descriptor instead. +func (*CommitMetaTxnResponse) Descriptor() ([]byte, []int) { return file_blobber_proto_rawDescGZIP(), []int{7} } -func (x *ObjectPath) GetRootHash() string { +func (x *CommitMetaTxnResponse) GetMessage() string { if x != nil { - return x.RootHash + return x.Message } return "" } -func (x *ObjectPath) GetMeta() *FileRef { - if x != nil { - return x.Meta - } - return nil -} - -func (x *ObjectPath) GetPath() *FileRef { - if x != nil { - return x.Path - } - return nil -} - -func (x *ObjectPath) GetFileBlockNum() int64 { - if x != nil { - return x.FileBlockNum - } - return 0 -} - -type WriteMarker struct { +type GetObjectTreeRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - AllocationRoot string `protobuf:"bytes,1,opt,name=AllocationRoot,proto3" json:"AllocationRoot,omitempty"` - PreviousAllocationRoot string `protobuf:"bytes,2,opt,name=PreviousAllocationRoot,proto3" json:"PreviousAllocationRoot,omitempty"` - AllocationID string `protobuf:"bytes,3,opt,name=AllocationID,proto3" json:"AllocationID,omitempty"` - Size int64 `protobuf:"varint,4,opt,name=Size,proto3" json:"Size,omitempty"` - BlobberID string `protobuf:"bytes,5,opt,name=BlobberID,proto3" json:"BlobberID,omitempty"` - Timestamp int64 `protobuf:"varint,6,opt,name=Timestamp,proto3" json:"Timestamp,omitempty"` - ClientID string `protobuf:"bytes,7,opt,name=ClientID,proto3" json:"ClientID,omitempty"` - Signature string `protobuf:"bytes,8,opt,name=Signature,proto3" json:"Signature,omitempty"` + Path string `protobuf:"bytes,1,opt,name=path,proto3" json:"path,omitempty"` + Allocation string `protobuf:"bytes,2,opt,name=allocation,proto3" json:"allocation,omitempty"` } -func (x *WriteMarker) Reset() { - *x = WriteMarker{} +func (x *GetObjectTreeRequest) Reset() { + *x = GetObjectTreeRequest{} if protoimpl.UnsafeEnabled { mi := &file_blobber_proto_msgTypes[8] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -541,13 +543,13 @@ func (x *WriteMarker) Reset() { } } -func (x *WriteMarker) String() string { +func (x *GetObjectTreeRequest) String() string { return protoimpl.X.MessageStringOf(x) } -func (*WriteMarker) ProtoMessage() {} +func (*GetObjectTreeRequest) ProtoMessage() {} -func (x *WriteMarker) ProtoReflect() protoreflect.Message { +func (x *GetObjectTreeRequest) ProtoReflect() protoreflect.Message { mi := &file_blobber_proto_msgTypes[8] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -559,81 +561,36 @@ func (x *WriteMarker) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use WriteMarker.ProtoReflect.Descriptor instead. -func (*WriteMarker) Descriptor() ([]byte, []int) { +// Deprecated: Use GetObjectTreeRequest.ProtoReflect.Descriptor instead. +func (*GetObjectTreeRequest) Descriptor() ([]byte, []int) { return file_blobber_proto_rawDescGZIP(), []int{8} } -func (x *WriteMarker) GetAllocationRoot() string { - if x != nil { - return x.AllocationRoot - } - return "" -} - -func (x *WriteMarker) GetPreviousAllocationRoot() string { - if x != nil { - return x.PreviousAllocationRoot - } - return "" -} - -func (x *WriteMarker) GetAllocationID() string { - if x != nil { - return x.AllocationID - } - return "" -} - -func (x *WriteMarker) GetSize() int64 { - if x != nil { - return x.Size - } - return 0 -} - -func (x *WriteMarker) GetBlobberID() string { - if x != nil { - return x.BlobberID - } - return "" -} - -func (x *WriteMarker) GetTimestamp() int64 { - if x != nil { - return x.Timestamp - } - return 0 -} - -func (x *WriteMarker) GetClientID() string { +func (x *GetObjectTreeRequest) GetPath() string { if x != nil { - return x.ClientID + return x.Path } return "" } -func (x *WriteMarker) GetSignature() string { +func (x *GetObjectTreeRequest) GetAllocation() string { if x != nil { - return x.Signature + return x.Allocation } return "" } -type ListEntitiesRequest struct { +type GetObjectTreeResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Context *RequestContext `protobuf:"bytes,1,opt,name=context,proto3" json:"context,omitempty"` - Path string `protobuf:"bytes,2,opt,name=path,proto3" json:"path,omitempty"` - PathHash string `protobuf:"bytes,3,opt,name=path_hash,json=pathHash,proto3" json:"path_hash,omitempty"` - AuthToken string `protobuf:"bytes,4,opt,name=auth_token,json=authToken,proto3" json:"auth_token,omitempty"` - Allocation string `protobuf:"bytes,5,opt,name=allocation,proto3" json:"allocation,omitempty"` + ReferencePath *ReferencePath `protobuf:"bytes,1,opt,name=reference_path,json=referencePath,proto3" json:"reference_path,omitempty"` + LatestWm *WriteMarker `protobuf:"bytes,2,opt,name=latest_wm,json=latestWm,proto3" json:"latest_wm,omitempty"` } -func (x *ListEntitiesRequest) Reset() { - *x = ListEntitiesRequest{} +func (x *GetObjectTreeResponse) Reset() { + *x = GetObjectTreeResponse{} if protoimpl.UnsafeEnabled { mi := &file_blobber_proto_msgTypes[9] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -641,13 +598,13 @@ func (x *ListEntitiesRequest) Reset() { } } -func (x *ListEntitiesRequest) String() string { +func (x *GetObjectTreeResponse) String() string { return protoimpl.X.MessageStringOf(x) } -func (*ListEntitiesRequest) ProtoMessage() {} +func (*GetObjectTreeResponse) ProtoMessage() {} -func (x *ListEntitiesRequest) ProtoReflect() protoreflect.Message { +func (x *GetObjectTreeResponse) ProtoReflect() protoreflect.Message { mi := &file_blobber_proto_msgTypes[9] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -659,57 +616,37 @@ func (x *ListEntitiesRequest) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use ListEntitiesRequest.ProtoReflect.Descriptor instead. -func (*ListEntitiesRequest) Descriptor() ([]byte, []int) { +// Deprecated: Use GetObjectTreeResponse.ProtoReflect.Descriptor instead. +func (*GetObjectTreeResponse) Descriptor() ([]byte, []int) { return file_blobber_proto_rawDescGZIP(), []int{9} } -func (x *ListEntitiesRequest) GetContext() *RequestContext { +func (x *GetObjectTreeResponse) GetReferencePath() *ReferencePath { if x != nil { - return x.Context + return x.ReferencePath } return nil } -func (x *ListEntitiesRequest) GetPath() string { - if x != nil { - return x.Path - } - return "" -} - -func (x *ListEntitiesRequest) GetPathHash() string { - if x != nil { - return x.PathHash - } - return "" -} - -func (x *ListEntitiesRequest) GetAuthToken() string { - if x != nil { - return x.AuthToken - } - return "" -} - -func (x *ListEntitiesRequest) GetAllocation() string { +func (x *GetObjectTreeResponse) GetLatestWm() *WriteMarker { if x != nil { - return x.Allocation + return x.LatestWm } - return "" + return nil } -type ListEntitiesResponse struct { +type GetReferencePathRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - AllocationRoot string `protobuf:"bytes,1,opt,name=AllocationRoot,proto3" json:"AllocationRoot,omitempty"` - MetaData *FileRef `protobuf:"bytes,2,opt,name=MetaData,proto3" json:"MetaData,omitempty"` + Paths string `protobuf:"bytes,1,opt,name=paths,proto3" json:"paths,omitempty"` + Path string `protobuf:"bytes,2,opt,name=path,proto3" json:"path,omitempty"` + Allocation string `protobuf:"bytes,3,opt,name=allocation,proto3" json:"allocation,omitempty"` } -func (x *ListEntitiesResponse) Reset() { - *x = ListEntitiesResponse{} +func (x *GetReferencePathRequest) Reset() { + *x = GetReferencePathRequest{} if protoimpl.UnsafeEnabled { mi := &file_blobber_proto_msgTypes[10] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -717,13 +654,13 @@ func (x *ListEntitiesResponse) Reset() { } } -func (x *ListEntitiesResponse) String() string { +func (x *GetReferencePathRequest) String() string { return protoimpl.X.MessageStringOf(x) } -func (*ListEntitiesResponse) ProtoMessage() {} +func (*GetReferencePathRequest) ProtoMessage() {} -func (x *ListEntitiesResponse) ProtoReflect() protoreflect.Message { +func (x *GetReferencePathRequest) ProtoReflect() protoreflect.Message { mi := &file_blobber_proto_msgTypes[10] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -735,38 +672,43 @@ func (x *ListEntitiesResponse) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use ListEntitiesResponse.ProtoReflect.Descriptor instead. -func (*ListEntitiesResponse) Descriptor() ([]byte, []int) { +// Deprecated: Use GetReferencePathRequest.ProtoReflect.Descriptor instead. +func (*GetReferencePathRequest) Descriptor() ([]byte, []int) { return file_blobber_proto_rawDescGZIP(), []int{10} } -func (x *ListEntitiesResponse) GetAllocationRoot() string { +func (x *GetReferencePathRequest) GetPaths() string { if x != nil { - return x.AllocationRoot + return x.Paths } return "" } -func (x *ListEntitiesResponse) GetMetaData() *FileRef { +func (x *GetReferencePathRequest) GetPath() string { if x != nil { - return x.MetaData + return x.Path } - return nil + return "" } -type GetFileStatsRequest struct { +func (x *GetReferencePathRequest) GetAllocation() string { + if x != nil { + return x.Allocation + } + return "" +} + +type GetReferencePathResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Context *RequestContext `protobuf:"bytes,1,opt,name=context,proto3" json:"context,omitempty"` - Path string `protobuf:"bytes,2,opt,name=path,proto3" json:"path,omitempty"` - PathHash string `protobuf:"bytes,3,opt,name=path_hash,json=pathHash,proto3" json:"path_hash,omitempty"` - Allocation string `protobuf:"bytes,4,opt,name=allocation,proto3" json:"allocation,omitempty"` + ReferencePath *ReferencePath `protobuf:"bytes,1,opt,name=reference_path,json=referencePath,proto3" json:"reference_path,omitempty"` + LatestWm *WriteMarker `protobuf:"bytes,2,opt,name=latest_wm,json=latestWm,proto3" json:"latest_wm,omitempty"` } -func (x *GetFileStatsRequest) Reset() { - *x = GetFileStatsRequest{} +func (x *GetReferencePathResponse) Reset() { + *x = GetReferencePathResponse{} if protoimpl.UnsafeEnabled { mi := &file_blobber_proto_msgTypes[11] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -774,13 +716,13 @@ func (x *GetFileStatsRequest) Reset() { } } -func (x *GetFileStatsRequest) String() string { +func (x *GetReferencePathResponse) String() string { return protoimpl.X.MessageStringOf(x) } -func (*GetFileStatsRequest) ProtoMessage() {} +func (*GetReferencePathResponse) ProtoMessage() {} -func (x *GetFileStatsRequest) ProtoReflect() protoreflect.Message { +func (x *GetReferencePathResponse) ProtoReflect() protoreflect.Message { mi := &file_blobber_proto_msgTypes[11] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -792,50 +734,36 @@ func (x *GetFileStatsRequest) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use GetFileStatsRequest.ProtoReflect.Descriptor instead. -func (*GetFileStatsRequest) Descriptor() ([]byte, []int) { +// Deprecated: Use GetReferencePathResponse.ProtoReflect.Descriptor instead. +func (*GetReferencePathResponse) Descriptor() ([]byte, []int) { return file_blobber_proto_rawDescGZIP(), []int{11} } -func (x *GetFileStatsRequest) GetContext() *RequestContext { +func (x *GetReferencePathResponse) GetReferencePath() *ReferencePath { if x != nil { - return x.Context + return x.ReferencePath } return nil } -func (x *GetFileStatsRequest) GetPath() string { - if x != nil { - return x.Path - } - return "" -} - -func (x *GetFileStatsRequest) GetPathHash() string { - if x != nil { - return x.PathHash - } - return "" -} - -func (x *GetFileStatsRequest) GetAllocation() string { +func (x *GetReferencePathResponse) GetLatestWm() *WriteMarker { if x != nil { - return x.Allocation + return x.LatestWm } - return "" + return nil } -type GetFileStatsResponse struct { +type ReferencePath struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - MetaData *FileRef `protobuf:"bytes,1,opt,name=MetaData,proto3" json:"MetaData,omitempty"` - Stats *FileStats `protobuf:"bytes,2,opt,name=Stats,proto3" json:"Stats,omitempty"` + MetaData *FileRef `protobuf:"bytes,1,opt,name=meta_data,json=metaData,proto3" json:"meta_data,omitempty"` + List []*ReferencePath `protobuf:"bytes,2,rep,name=list,proto3" json:"list,omitempty"` } -func (x *GetFileStatsResponse) Reset() { - *x = GetFileStatsResponse{} +func (x *ReferencePath) Reset() { + *x = ReferencePath{} if protoimpl.UnsafeEnabled { mi := &file_blobber_proto_msgTypes[12] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -843,13 +771,13 @@ func (x *GetFileStatsResponse) Reset() { } } -func (x *GetFileStatsResponse) String() string { +func (x *ReferencePath) String() string { return protoimpl.X.MessageStringOf(x) } -func (*GetFileStatsResponse) ProtoMessage() {} +func (*ReferencePath) ProtoMessage() {} -func (x *GetFileStatsResponse) ProtoReflect() protoreflect.Message { +func (x *ReferencePath) ProtoReflect() protoreflect.Message { mi := &file_blobber_proto_msgTypes[12] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -861,44 +789,37 @@ func (x *GetFileStatsResponse) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use GetFileStatsResponse.ProtoReflect.Descriptor instead. -func (*GetFileStatsResponse) Descriptor() ([]byte, []int) { +// Deprecated: Use ReferencePath.ProtoReflect.Descriptor instead. +func (*ReferencePath) Descriptor() ([]byte, []int) { return file_blobber_proto_rawDescGZIP(), []int{12} } -func (x *GetFileStatsResponse) GetMetaData() *FileRef { +func (x *ReferencePath) GetMetaData() *FileRef { if x != nil { return x.MetaData } return nil } -func (x *GetFileStatsResponse) GetStats() *FileStats { +func (x *ReferencePath) GetList() []*ReferencePath { if x != nil { - return x.Stats + return x.List } return nil } -type FileStats struct { +type GetObjectPathRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - ID int64 `protobuf:"varint,1,opt,name=ID,proto3" json:"ID,omitempty"` - RefID int64 `protobuf:"varint,2,opt,name=RefID,proto3" json:"RefID,omitempty"` - NumUpdates int64 `protobuf:"varint,3,opt,name=NumUpdates,proto3" json:"NumUpdates,omitempty"` - NumBlockDownloads int64 `protobuf:"varint,4,opt,name=NumBlockDownloads,proto3" json:"NumBlockDownloads,omitempty"` - SuccessChallenges int64 `protobuf:"varint,5,opt,name=SuccessChallenges,proto3" json:"SuccessChallenges,omitempty"` - FailedChallenges int64 `protobuf:"varint,6,opt,name=FailedChallenges,proto3" json:"FailedChallenges,omitempty"` - LastChallengeResponseTxn string `protobuf:"bytes,7,opt,name=LastChallengeResponseTxn,proto3" json:"LastChallengeResponseTxn,omitempty"` - WriteMarkerRedeemTxn string `protobuf:"bytes,8,opt,name=WriteMarkerRedeemTxn,proto3" json:"WriteMarkerRedeemTxn,omitempty"` - CreatedAt int64 `protobuf:"varint,9,opt,name=CreatedAt,proto3" json:"CreatedAt,omitempty"` - UpdatedAt int64 `protobuf:"varint,10,opt,name=UpdatedAt,proto3" json:"UpdatedAt,omitempty"` + Allocation string `protobuf:"bytes,1,opt,name=allocation,proto3" json:"allocation,omitempty"` + Path string `protobuf:"bytes,2,opt,name=path,proto3" json:"path,omitempty"` + BlockNum string `protobuf:"bytes,3,opt,name=block_num,json=blockNum,proto3" json:"block_num,omitempty"` } -func (x *FileStats) Reset() { - *x = FileStats{} +func (x *GetObjectPathRequest) Reset() { + *x = GetObjectPathRequest{} if protoimpl.UnsafeEnabled { mi := &file_blobber_proto_msgTypes[13] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -906,13 +827,13 @@ func (x *FileStats) Reset() { } } -func (x *FileStats) String() string { +func (x *GetObjectPathRequest) String() string { return protoimpl.X.MessageStringOf(x) } -func (*FileStats) ProtoMessage() {} +func (*GetObjectPathRequest) ProtoMessage() {} -func (x *FileStats) ProtoReflect() protoreflect.Message { +func (x *GetObjectPathRequest) ProtoReflect() protoreflect.Message { mi := &file_blobber_proto_msgTypes[13] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -924,110 +845,1458 @@ func (x *FileStats) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use FileStats.ProtoReflect.Descriptor instead. -func (*FileStats) Descriptor() ([]byte, []int) { +// Deprecated: Use GetObjectPathRequest.ProtoReflect.Descriptor instead. +func (*GetObjectPathRequest) Descriptor() ([]byte, []int) { return file_blobber_proto_rawDescGZIP(), []int{13} } -func (x *FileStats) GetID() int64 { +func (x *GetObjectPathRequest) GetAllocation() string { if x != nil { - return x.ID + return x.Allocation } - return 0 + return "" } -func (x *FileStats) GetRefID() int64 { +func (x *GetObjectPathRequest) GetPath() string { if x != nil { - return x.RefID + return x.Path } - return 0 + return "" } -func (x *FileStats) GetNumUpdates() int64 { +func (x *GetObjectPathRequest) GetBlockNum() string { if x != nil { - return x.NumUpdates + return x.BlockNum } - return 0 + return "" } -func (x *FileStats) GetNumBlockDownloads() int64 { - if x != nil { - return x.NumBlockDownloads - } - return 0 +type GetObjectPathResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ObjectPath *ObjectPath `protobuf:"bytes,1,opt,name=object_path,json=objectPath,proto3" json:"object_path,omitempty"` + LatestWriteMarker *WriteMarker `protobuf:"bytes,2,opt,name=latest_write_marker,json=latestWriteMarker,proto3" json:"latest_write_marker,omitempty"` } -func (x *FileStats) GetSuccessChallenges() int64 { - if x != nil { - return x.SuccessChallenges +func (x *GetObjectPathResponse) Reset() { + *x = GetObjectPathResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_blobber_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } - return 0 } -func (x *FileStats) GetFailedChallenges() int64 { - if x != nil { - return x.FailedChallenges - } - return 0 +func (x *GetObjectPathResponse) String() string { + return protoimpl.X.MessageStringOf(x) } -func (x *FileStats) GetLastChallengeResponseTxn() string { - if x != nil { - return x.LastChallengeResponseTxn +func (*GetObjectPathResponse) ProtoMessage() {} + +func (x *GetObjectPathResponse) ProtoReflect() protoreflect.Message { + mi := &file_blobber_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 "" + return mi.MessageOf(x) } -func (x *FileStats) GetWriteMarkerRedeemTxn() string { - if x != nil { - return x.WriteMarkerRedeemTxn - } - return "" +// Deprecated: Use GetObjectPathResponse.ProtoReflect.Descriptor instead. +func (*GetObjectPathResponse) Descriptor() ([]byte, []int) { + return file_blobber_proto_rawDescGZIP(), []int{14} } -func (x *FileStats) GetCreatedAt() int64 { +func (x *GetObjectPathResponse) GetObjectPath() *ObjectPath { if x != nil { - return x.CreatedAt + return x.ObjectPath } - return 0 + return nil } -func (x *FileStats) GetUpdatedAt() int64 { +func (x *GetObjectPathResponse) GetLatestWriteMarker() *WriteMarker { if x != nil { - return x.UpdatedAt + return x.LatestWriteMarker } - return 0 + return nil } -type GetFileMetaDataRequest struct { +type ObjectPath struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Context *RequestContext `protobuf:"bytes,1,opt,name=context,proto3" json:"context,omitempty"` - Path string `protobuf:"bytes,2,opt,name=path,proto3" json:"path,omitempty"` - PathHash string `protobuf:"bytes,3,opt,name=path_hash,json=pathHash,proto3" json:"path_hash,omitempty"` - AuthToken string `protobuf:"bytes,4,opt,name=auth_token,json=authToken,proto3" json:"auth_token,omitempty"` - Allocation string `protobuf:"bytes,5,opt,name=allocation,proto3" json:"allocation,omitempty"` + RootHash string `protobuf:"bytes,1,opt,name=root_hash,json=rootHash,proto3" json:"root_hash,omitempty"` + Meta *FileRef `protobuf:"bytes,2,opt,name=meta,proto3" json:"meta,omitempty"` + Path *FileRef `protobuf:"bytes,3,opt,name=path,proto3" json:"path,omitempty"` + PathList []*FileRef `protobuf:"bytes,4,rep,name=path_list,json=pathList,proto3" json:"path_list,omitempty"` + FileBlockNum int64 `protobuf:"varint,5,opt,name=file_block_num,json=fileBlockNum,proto3" json:"file_block_num,omitempty"` } -func (x *GetFileMetaDataRequest) Reset() { - *x = GetFileMetaDataRequest{} +func (x *ObjectPath) Reset() { + *x = ObjectPath{} if protoimpl.UnsafeEnabled { - mi := &file_blobber_proto_msgTypes[14] + mi := &file_blobber_proto_msgTypes[15] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ObjectPath) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ObjectPath) ProtoMessage() {} + +func (x *ObjectPath) ProtoReflect() protoreflect.Message { + mi := &file_blobber_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 ObjectPath.ProtoReflect.Descriptor instead. +func (*ObjectPath) Descriptor() ([]byte, []int) { + return file_blobber_proto_rawDescGZIP(), []int{15} +} + +func (x *ObjectPath) GetRootHash() string { + if x != nil { + return x.RootHash + } + return "" +} + +func (x *ObjectPath) GetMeta() *FileRef { + if x != nil { + return x.Meta + } + return nil +} + +func (x *ObjectPath) GetPath() *FileRef { + if x != nil { + return x.Path + } + return nil +} + +func (x *ObjectPath) GetPathList() []*FileRef { + if x != nil { + return x.PathList + } + return nil +} + +func (x *ObjectPath) GetFileBlockNum() int64 { + if x != nil { + return x.FileBlockNum + } + return 0 +} + +type WriteMarker struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + AllocationRoot string `protobuf:"bytes,1,opt,name=allocation_root,json=allocationRoot,proto3" json:"allocation_root,omitempty"` + PreviousAllocationRoot string `protobuf:"bytes,2,opt,name=previous_allocation_root,json=previousAllocationRoot,proto3" json:"previous_allocation_root,omitempty"` + AllocationId string `protobuf:"bytes,3,opt,name=allocation_id,json=allocationId,proto3" json:"allocation_id,omitempty"` + Size int64 `protobuf:"varint,4,opt,name=size,proto3" json:"size,omitempty"` + BlobberId string `protobuf:"bytes,5,opt,name=blobber_id,json=blobberId,proto3" json:"blobber_id,omitempty"` + Timestamp int64 `protobuf:"varint,6,opt,name=timestamp,proto3" json:"timestamp,omitempty"` + ClientId string `protobuf:"bytes,7,opt,name=client_id,json=clientId,proto3" json:"client_id,omitempty"` + Signature string `protobuf:"bytes,8,opt,name=signature,proto3" json:"signature,omitempty"` +} + +func (x *WriteMarker) Reset() { + *x = WriteMarker{} + if protoimpl.UnsafeEnabled { + mi := &file_blobber_proto_msgTypes[16] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *WriteMarker) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*WriteMarker) ProtoMessage() {} + +func (x *WriteMarker) ProtoReflect() protoreflect.Message { + mi := &file_blobber_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 WriteMarker.ProtoReflect.Descriptor instead. +func (*WriteMarker) Descriptor() ([]byte, []int) { + return file_blobber_proto_rawDescGZIP(), []int{16} +} + +func (x *WriteMarker) GetAllocationRoot() string { + if x != nil { + return x.AllocationRoot + } + return "" +} + +func (x *WriteMarker) GetPreviousAllocationRoot() string { + if x != nil { + return x.PreviousAllocationRoot + } + return "" +} + +func (x *WriteMarker) GetAllocationId() string { + if x != nil { + return x.AllocationId + } + return "" +} + +func (x *WriteMarker) GetSize() int64 { + if x != nil { + return x.Size + } + return 0 +} + +func (x *WriteMarker) GetBlobberId() string { + if x != nil { + return x.BlobberId + } + return "" +} + +func (x *WriteMarker) GetTimestamp() int64 { + if x != nil { + return x.Timestamp + } + return 0 +} + +func (x *WriteMarker) GetClientId() string { + if x != nil { + return x.ClientId + } + return "" +} + +func (x *WriteMarker) GetSignature() string { + if x != nil { + return x.Signature + } + return "" +} + +type ListEntitiesRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Path string `protobuf:"bytes,1,opt,name=path,proto3" json:"path,omitempty"` + PathHash string `protobuf:"bytes,2,opt,name=path_hash,json=pathHash,proto3" json:"path_hash,omitempty"` + AuthToken string `protobuf:"bytes,3,opt,name=auth_token,json=authToken,proto3" json:"auth_token,omitempty"` + Allocation string `protobuf:"bytes,4,opt,name=allocation,proto3" json:"allocation,omitempty"` +} + +func (x *ListEntitiesRequest) Reset() { + *x = ListEntitiesRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_blobber_proto_msgTypes[17] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListEntitiesRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListEntitiesRequest) ProtoMessage() {} + +func (x *ListEntitiesRequest) ProtoReflect() protoreflect.Message { + mi := &file_blobber_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 ListEntitiesRequest.ProtoReflect.Descriptor instead. +func (*ListEntitiesRequest) Descriptor() ([]byte, []int) { + return file_blobber_proto_rawDescGZIP(), []int{17} +} + +func (x *ListEntitiesRequest) GetPath() string { + if x != nil { + return x.Path + } + return "" +} + +func (x *ListEntitiesRequest) GetPathHash() string { + if x != nil { + return x.PathHash + } + return "" +} + +func (x *ListEntitiesRequest) GetAuthToken() string { + if x != nil { + return x.AuthToken + } + return "" +} + +func (x *ListEntitiesRequest) GetAllocation() string { + if x != nil { + return x.Allocation + } + return "" +} + +type ListEntitiesResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + AllocationRoot string `protobuf:"bytes,1,opt,name=allocation_root,json=allocationRoot,proto3" json:"allocation_root,omitempty"` + MetaData *FileRef `protobuf:"bytes,2,opt,name=meta_data,json=metaData,proto3" json:"meta_data,omitempty"` + Entities []*FileRef `protobuf:"bytes,3,rep,name=entities,proto3" json:"entities,omitempty"` +} + +func (x *ListEntitiesResponse) Reset() { + *x = ListEntitiesResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_blobber_proto_msgTypes[18] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListEntitiesResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListEntitiesResponse) ProtoMessage() {} + +func (x *ListEntitiesResponse) ProtoReflect() protoreflect.Message { + mi := &file_blobber_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 ListEntitiesResponse.ProtoReflect.Descriptor instead. +func (*ListEntitiesResponse) Descriptor() ([]byte, []int) { + return file_blobber_proto_rawDescGZIP(), []int{18} +} + +func (x *ListEntitiesResponse) GetAllocationRoot() string { + if x != nil { + return x.AllocationRoot + } + return "" +} + +func (x *ListEntitiesResponse) GetMetaData() *FileRef { + if x != nil { + return x.MetaData + } + return nil +} + +func (x *ListEntitiesResponse) GetEntities() []*FileRef { + if x != nil { + return x.Entities + } + return nil +} + +type GetFileStatsRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Path string `protobuf:"bytes,1,opt,name=path,proto3" json:"path,omitempty"` + PathHash string `protobuf:"bytes,2,opt,name=path_hash,json=pathHash,proto3" json:"path_hash,omitempty"` + Allocation string `protobuf:"bytes,3,opt,name=allocation,proto3" json:"allocation,omitempty"` +} + +func (x *GetFileStatsRequest) Reset() { + *x = GetFileStatsRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_blobber_proto_msgTypes[19] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetFileStatsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetFileStatsRequest) ProtoMessage() {} + +func (x *GetFileStatsRequest) ProtoReflect() protoreflect.Message { + mi := &file_blobber_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 GetFileStatsRequest.ProtoReflect.Descriptor instead. +func (*GetFileStatsRequest) Descriptor() ([]byte, []int) { + return file_blobber_proto_rawDescGZIP(), []int{19} +} + +func (x *GetFileStatsRequest) GetPath() string { + if x != nil { + return x.Path + } + return "" +} + +func (x *GetFileStatsRequest) GetPathHash() string { + if x != nil { + return x.PathHash + } + return "" +} + +func (x *GetFileStatsRequest) GetAllocation() string { + if x != nil { + return x.Allocation + } + return "" +} + +type GetFileStatsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + MetaData *FileRef `protobuf:"bytes,1,opt,name=meta_data,json=metaData,proto3" json:"meta_data,omitempty"` + Stats *FileStats `protobuf:"bytes,2,opt,name=stats,proto3" json:"stats,omitempty"` +} + +func (x *GetFileStatsResponse) Reset() { + *x = GetFileStatsResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_blobber_proto_msgTypes[20] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetFileStatsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetFileStatsResponse) ProtoMessage() {} + +func (x *GetFileStatsResponse) ProtoReflect() protoreflect.Message { + mi := &file_blobber_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 GetFileStatsResponse.ProtoReflect.Descriptor instead. +func (*GetFileStatsResponse) Descriptor() ([]byte, []int) { + return file_blobber_proto_rawDescGZIP(), []int{20} +} + +func (x *GetFileStatsResponse) GetMetaData() *FileRef { + if x != nil { + return x.MetaData + } + return nil +} + +func (x *GetFileStatsResponse) GetStats() *FileStats { + if x != nil { + return x.Stats + } + return nil +} + +type FileStats struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + RefId int64 `protobuf:"varint,2,opt,name=ref_id,json=refId,proto3" json:"ref_id,omitempty"` + NumUpdates int64 `protobuf:"varint,3,opt,name=num_updates,json=numUpdates,proto3" json:"num_updates,omitempty"` + NumBlockDownloads int64 `protobuf:"varint,4,opt,name=num_block_downloads,json=numBlockDownloads,proto3" json:"num_block_downloads,omitempty"` + SuccessChallenges int64 `protobuf:"varint,5,opt,name=success_challenges,json=successChallenges,proto3" json:"success_challenges,omitempty"` + FailedChallenges int64 `protobuf:"varint,6,opt,name=failed_challenges,json=failedChallenges,proto3" json:"failed_challenges,omitempty"` + LastChallengeResponseTxn string `protobuf:"bytes,7,opt,name=last_challenge_response_txn,json=lastChallengeResponseTxn,proto3" json:"last_challenge_response_txn,omitempty"` + WriteMarkerRedeemTxn string `protobuf:"bytes,8,opt,name=write_marker_redeem_txn,json=writeMarkerRedeemTxn,proto3" json:"write_marker_redeem_txn,omitempty"` + CreatedAt int64 `protobuf:"varint,9,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"` + UpdatedAt int64 `protobuf:"varint,10,opt,name=updated_at,json=updatedAt,proto3" json:"updated_at,omitempty"` +} + +func (x *FileStats) Reset() { + *x = FileStats{} + if protoimpl.UnsafeEnabled { + mi := &file_blobber_proto_msgTypes[21] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *FileStats) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*FileStats) ProtoMessage() {} + +func (x *FileStats) ProtoReflect() protoreflect.Message { + mi := &file_blobber_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 FileStats.ProtoReflect.Descriptor instead. +func (*FileStats) Descriptor() ([]byte, []int) { + return file_blobber_proto_rawDescGZIP(), []int{21} +} + +func (x *FileStats) GetId() int64 { + if x != nil { + return x.Id + } + return 0 +} + +func (x *FileStats) GetRefId() int64 { + if x != nil { + return x.RefId + } + return 0 +} + +func (x *FileStats) GetNumUpdates() int64 { + if x != nil { + return x.NumUpdates + } + return 0 +} + +func (x *FileStats) GetNumBlockDownloads() int64 { + if x != nil { + return x.NumBlockDownloads + } + return 0 +} + +func (x *FileStats) GetSuccessChallenges() int64 { + if x != nil { + return x.SuccessChallenges + } + return 0 +} + +func (x *FileStats) GetFailedChallenges() int64 { + if x != nil { + return x.FailedChallenges + } + return 0 +} + +func (x *FileStats) GetLastChallengeResponseTxn() string { + if x != nil { + return x.LastChallengeResponseTxn + } + return "" +} + +func (x *FileStats) GetWriteMarkerRedeemTxn() string { + if x != nil { + return x.WriteMarkerRedeemTxn + } + return "" +} + +func (x *FileStats) GetCreatedAt() int64 { + if x != nil { + return x.CreatedAt + } + return 0 +} + +func (x *FileStats) GetUpdatedAt() int64 { + if x != nil { + return x.UpdatedAt + } + return 0 +} + +type GetFileMetaDataRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Path string `protobuf:"bytes,1,opt,name=path,proto3" json:"path,omitempty"` + PathHash string `protobuf:"bytes,2,opt,name=path_hash,json=pathHash,proto3" json:"path_hash,omitempty"` + AuthToken string `protobuf:"bytes,3,opt,name=auth_token,json=authToken,proto3" json:"auth_token,omitempty"` + Allocation string `protobuf:"bytes,4,opt,name=allocation,proto3" json:"allocation,omitempty"` +} + +func (x *GetFileMetaDataRequest) Reset() { + *x = GetFileMetaDataRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_blobber_proto_msgTypes[22] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetFileMetaDataRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetFileMetaDataRequest) ProtoMessage() {} + +func (x *GetFileMetaDataRequest) ProtoReflect() protoreflect.Message { + mi := &file_blobber_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 GetFileMetaDataRequest.ProtoReflect.Descriptor instead. +func (*GetFileMetaDataRequest) Descriptor() ([]byte, []int) { + return file_blobber_proto_rawDescGZIP(), []int{22} +} + +func (x *GetFileMetaDataRequest) GetPath() string { + if x != nil { + return x.Path + } + return "" +} + +func (x *GetFileMetaDataRequest) GetPathHash() string { + if x != nil { + return x.PathHash + } + return "" +} + +func (x *GetFileMetaDataRequest) GetAuthToken() string { + if x != nil { + return x.AuthToken + } + return "" +} + +func (x *GetFileMetaDataRequest) GetAllocation() string { + if x != nil { + return x.Allocation + } + return "" +} + +type GetFileMetaDataResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + MetaData *FileRef `protobuf:"bytes,1,opt,name=meta_data,json=metaData,proto3" json:"meta_data,omitempty"` + Collaborators []*Collaborator `protobuf:"bytes,2,rep,name=collaborators,proto3" json:"collaborators,omitempty"` +} + +func (x *GetFileMetaDataResponse) Reset() { + *x = GetFileMetaDataResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_blobber_proto_msgTypes[23] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetFileMetaDataResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetFileMetaDataResponse) ProtoMessage() {} + +func (x *GetFileMetaDataResponse) ProtoReflect() protoreflect.Message { + mi := &file_blobber_proto_msgTypes[23] + 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 GetFileMetaDataResponse.ProtoReflect.Descriptor instead. +func (*GetFileMetaDataResponse) Descriptor() ([]byte, []int) { + return file_blobber_proto_rawDescGZIP(), []int{23} +} + +func (x *GetFileMetaDataResponse) GetMetaData() *FileRef { + if x != nil { + return x.MetaData + } + return nil +} + +func (x *GetFileMetaDataResponse) GetCollaborators() []*Collaborator { + if x != nil { + return x.Collaborators + } + return nil +} + +type CommitMetaTxn struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + RefId int64 `protobuf:"varint,1,opt,name=ref_id,json=refId,proto3" json:"ref_id,omitempty"` + TxnId string `protobuf:"bytes,2,opt,name=txn_id,json=txnId,proto3" json:"txn_id,omitempty"` + CreatedAt int64 `protobuf:"varint,3,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"` +} + +func (x *CommitMetaTxn) Reset() { + *x = CommitMetaTxn{} + if protoimpl.UnsafeEnabled { + mi := &file_blobber_proto_msgTypes[24] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CommitMetaTxn) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CommitMetaTxn) ProtoMessage() {} + +func (x *CommitMetaTxn) ProtoReflect() protoreflect.Message { + mi := &file_blobber_proto_msgTypes[24] + 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 CommitMetaTxn.ProtoReflect.Descriptor instead. +func (*CommitMetaTxn) Descriptor() ([]byte, []int) { + return file_blobber_proto_rawDescGZIP(), []int{24} +} + +func (x *CommitMetaTxn) GetRefId() int64 { + if x != nil { + return x.RefId + } + return 0 +} + +func (x *CommitMetaTxn) GetTxnId() string { + if x != nil { + return x.TxnId + } + return "" +} + +func (x *CommitMetaTxn) GetCreatedAt() int64 { + if x != nil { + return x.CreatedAt + } + return 0 +} + +type Collaborator struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + RefId int64 `protobuf:"varint,1,opt,name=ref_id,json=refId,proto3" json:"ref_id,omitempty"` + ClientId string `protobuf:"bytes,2,opt,name=client_id,json=clientId,proto3" json:"client_id,omitempty"` + CreatedAt int64 `protobuf:"varint,3,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"` +} + +func (x *Collaborator) Reset() { + *x = Collaborator{} + if protoimpl.UnsafeEnabled { + mi := &file_blobber_proto_msgTypes[25] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Collaborator) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Collaborator) ProtoMessage() {} + +func (x *Collaborator) ProtoReflect() protoreflect.Message { + mi := &file_blobber_proto_msgTypes[25] + 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 Collaborator.ProtoReflect.Descriptor instead. +func (*Collaborator) Descriptor() ([]byte, []int) { + return file_blobber_proto_rawDescGZIP(), []int{25} +} + +func (x *Collaborator) GetRefId() int64 { + if x != nil { + return x.RefId + } + return 0 +} + +func (x *Collaborator) GetClientId() string { + if x != nil { + return x.ClientId + } + return "" +} + +func (x *Collaborator) GetCreatedAt() int64 { + if x != nil { + return x.CreatedAt + } + return 0 +} + +type GetAllocationRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` +} + +func (x *GetAllocationRequest) Reset() { + *x = GetAllocationRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_blobber_proto_msgTypes[26] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetAllocationRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetAllocationRequest) ProtoMessage() {} + +func (x *GetAllocationRequest) ProtoReflect() protoreflect.Message { + mi := &file_blobber_proto_msgTypes[26] + 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 GetAllocationRequest.ProtoReflect.Descriptor instead. +func (*GetAllocationRequest) Descriptor() ([]byte, []int) { + return file_blobber_proto_rawDescGZIP(), []int{26} +} + +func (x *GetAllocationRequest) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +type GetAllocationResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Allocation *Allocation `protobuf:"bytes,1,opt,name=allocation,proto3" json:"allocation,omitempty"` +} + +func (x *GetAllocationResponse) Reset() { + *x = GetAllocationResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_blobber_proto_msgTypes[27] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetAllocationResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetAllocationResponse) ProtoMessage() {} + +func (x *GetAllocationResponse) ProtoReflect() protoreflect.Message { + mi := &file_blobber_proto_msgTypes[27] + 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 GetAllocationResponse.ProtoReflect.Descriptor instead. +func (*GetAllocationResponse) Descriptor() ([]byte, []int) { + return file_blobber_proto_rawDescGZIP(), []int{27} +} + +func (x *GetAllocationResponse) GetAllocation() *Allocation { + if x != nil { + return x.Allocation + } + return nil +} + +type DownloadFileRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Allocation string `protobuf:"bytes,1,opt,name=allocation,proto3" json:"allocation,omitempty"` + Path string `protobuf:"bytes,2,opt,name=path,proto3" json:"path,omitempty"` + PathHash string `protobuf:"bytes,3,opt,name=path_hash,json=pathHash,proto3" json:"path_hash,omitempty"` + RxPay string `protobuf:"bytes,4,opt,name=rx_pay,json=rxPay,proto3" json:"rx_pay,omitempty"` + BlockNum string `protobuf:"bytes,5,opt,name=block_num,json=blockNum,proto3" json:"block_num,omitempty"` + NumBlocks string `protobuf:"bytes,6,opt,name=num_blocks,json=numBlocks,proto3" json:"num_blocks,omitempty"` + ReadMarker string `protobuf:"bytes,7,opt,name=read_marker,json=readMarker,proto3" json:"read_marker,omitempty"` + AuthToken string `protobuf:"bytes,8,opt,name=auth_token,json=authToken,proto3" json:"auth_token,omitempty"` + Content string `protobuf:"bytes,9,opt,name=content,proto3" json:"content,omitempty"` +} + +func (x *DownloadFileRequest) Reset() { + *x = DownloadFileRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_blobber_proto_msgTypes[28] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DownloadFileRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DownloadFileRequest) ProtoMessage() {} + +func (x *DownloadFileRequest) ProtoReflect() protoreflect.Message { + mi := &file_blobber_proto_msgTypes[28] + 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 DownloadFileRequest.ProtoReflect.Descriptor instead. +func (*DownloadFileRequest) Descriptor() ([]byte, []int) { + return file_blobber_proto_rawDescGZIP(), []int{28} +} + +func (x *DownloadFileRequest) GetAllocation() string { + if x != nil { + return x.Allocation + } + return "" +} + +func (x *DownloadFileRequest) GetPath() string { + if x != nil { + return x.Path + } + return "" +} + +func (x *DownloadFileRequest) GetPathHash() string { + if x != nil { + return x.PathHash + } + return "" +} + +func (x *DownloadFileRequest) GetRxPay() string { + if x != nil { + return x.RxPay + } + return "" +} + +func (x *DownloadFileRequest) GetBlockNum() string { + if x != nil { + return x.BlockNum + } + return "" +} + +func (x *DownloadFileRequest) GetNumBlocks() string { + if x != nil { + return x.NumBlocks + } + return "" +} + +func (x *DownloadFileRequest) GetReadMarker() string { + if x != nil { + return x.ReadMarker + } + return "" +} + +func (x *DownloadFileRequest) GetAuthToken() string { + if x != nil { + return x.AuthToken + } + return "" +} + +func (x *DownloadFileRequest) GetContent() string { + if x != nil { + return x.Content + } + return "" +} + +type DownloadFileResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + Data []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"` + AllocationId string `protobuf:"bytes,3,opt,name=allocation_id,json=allocationId,proto3" json:"allocation_id,omitempty"` + Path string `protobuf:"bytes,4,opt,name=path,proto3" json:"path,omitempty"` + LatestRm *ReadMaker `protobuf:"bytes,5,opt,name=latest_rm,json=latestRm,proto3" json:"latest_rm,omitempty"` +} + +func (x *DownloadFileResponse) Reset() { + *x = DownloadFileResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_blobber_proto_msgTypes[29] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DownloadFileResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DownloadFileResponse) ProtoMessage() {} + +func (x *DownloadFileResponse) ProtoReflect() protoreflect.Message { + mi := &file_blobber_proto_msgTypes[29] + 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 DownloadFileResponse.ProtoReflect.Descriptor instead. +func (*DownloadFileResponse) Descriptor() ([]byte, []int) { + return file_blobber_proto_rawDescGZIP(), []int{29} +} + +func (x *DownloadFileResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *DownloadFileResponse) GetData() []byte { + if x != nil { + return x.Data + } + return nil +} + +func (x *DownloadFileResponse) GetAllocationId() string { + if x != nil { + return x.AllocationId + } + return "" +} + +func (x *DownloadFileResponse) GetPath() string { + if x != nil { + return x.Path + } + return "" +} + +func (x *DownloadFileResponse) GetLatestRm() *ReadMaker { + if x != nil { + return x.LatestRm + } + return nil +} + +type ReadMaker struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ClientId string `protobuf:"bytes,1,opt,name=client_id,json=clientId,proto3" json:"client_id,omitempty"` + ClientPublicKey string `protobuf:"bytes,2,opt,name=client_public_key,json=clientPublicKey,proto3" json:"client_public_key,omitempty"` + BlobberId string `protobuf:"bytes,3,opt,name=blobber_id,json=blobberId,proto3" json:"blobber_id,omitempty"` + AllocationId string `protobuf:"bytes,4,opt,name=allocation_id,json=allocationId,proto3" json:"allocation_id,omitempty"` + OwnerId string `protobuf:"bytes,5,opt,name=owner_id,json=ownerId,proto3" json:"owner_id,omitempty"` + Timestamp int64 `protobuf:"varint,6,opt,name=timestamp,proto3" json:"timestamp,omitempty"` + Counter int64 `protobuf:"varint,7,opt,name=counter,proto3" json:"counter,omitempty"` + Signature string `protobuf:"bytes,8,opt,name=signature,proto3" json:"signature,omitempty"` + Suspend int64 `protobuf:"varint,9,opt,name=suspend,proto3" json:"suspend,omitempty"` + PayerId string `protobuf:"bytes,10,opt,name=payer_id,json=payerId,proto3" json:"payer_id,omitempty"` + AuthTicket []byte `protobuf:"bytes,11,opt,name=auth_ticket,json=authTicket,proto3" json:"auth_ticket,omitempty"` +} + +func (x *ReadMaker) Reset() { + *x = ReadMaker{} + if protoimpl.UnsafeEnabled { + mi := &file_blobber_proto_msgTypes[30] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ReadMaker) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ReadMaker) ProtoMessage() {} + +func (x *ReadMaker) ProtoReflect() protoreflect.Message { + mi := &file_blobber_proto_msgTypes[30] + 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 ReadMaker.ProtoReflect.Descriptor instead. +func (*ReadMaker) Descriptor() ([]byte, []int) { + return file_blobber_proto_rawDescGZIP(), []int{30} +} + +func (x *ReadMaker) GetClientId() string { + if x != nil { + return x.ClientId + } + return "" +} + +func (x *ReadMaker) GetClientPublicKey() string { + if x != nil { + return x.ClientPublicKey + } + return "" +} + +func (x *ReadMaker) GetBlobberId() string { + if x != nil { + return x.BlobberId + } + return "" +} + +func (x *ReadMaker) GetAllocationId() string { + if x != nil { + return x.AllocationId + } + return "" +} + +func (x *ReadMaker) GetOwnerId() string { + if x != nil { + return x.OwnerId + } + return "" +} + +func (x *ReadMaker) GetTimestamp() int64 { + if x != nil { + return x.Timestamp + } + return 0 +} + +func (x *ReadMaker) GetCounter() int64 { + if x != nil { + return x.Counter + } + return 0 +} + +func (x *ReadMaker) GetSignature() string { + if x != nil { + return x.Signature + } + return "" +} + +func (x *ReadMaker) GetSuspend() int64 { + if x != nil { + return x.Suspend + } + return 0 +} + +func (x *ReadMaker) GetPayerId() string { + if x != nil { + return x.PayerId + } + return "" +} + +func (x *ReadMaker) GetAuthTicket() []byte { + if x != nil { + return x.AuthTicket + } + return nil +} + +type UpdateObjectAttributesRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Allocation string `protobuf:"bytes,1,opt,name=allocation,proto3" json:"allocation,omitempty"` + Path string `protobuf:"bytes,2,opt,name=path,proto3" json:"path,omitempty"` + PathHash string `protobuf:"bytes,3,opt,name=path_hash,json=pathHash,proto3" json:"path_hash,omitempty"` + ConnectionId string `protobuf:"bytes,4,opt,name=connection_id,json=connectionId,proto3" json:"connection_id,omitempty"` + Attributes string `protobuf:"bytes,5,opt,name=attributes,proto3" json:"attributes,omitempty"` +} + +func (x *UpdateObjectAttributesRequest) Reset() { + *x = UpdateObjectAttributesRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_blobber_proto_msgTypes[31] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UpdateObjectAttributesRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateObjectAttributesRequest) ProtoMessage() {} + +func (x *UpdateObjectAttributesRequest) ProtoReflect() protoreflect.Message { + mi := &file_blobber_proto_msgTypes[31] + 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 UpdateObjectAttributesRequest.ProtoReflect.Descriptor instead. +func (*UpdateObjectAttributesRequest) Descriptor() ([]byte, []int) { + return file_blobber_proto_rawDescGZIP(), []int{31} +} + +func (x *UpdateObjectAttributesRequest) GetAllocation() string { + if x != nil { + return x.Allocation + } + return "" +} + +func (x *UpdateObjectAttributesRequest) GetPath() string { + if x != nil { + return x.Path + } + return "" +} + +func (x *UpdateObjectAttributesRequest) GetPathHash() string { + if x != nil { + return x.PathHash + } + return "" +} + +func (x *UpdateObjectAttributesRequest) GetConnectionId() string { + if x != nil { + return x.ConnectionId + } + return "" +} + +func (x *UpdateObjectAttributesRequest) GetAttributes() string { + if x != nil { + return x.Attributes + } + return "" +} + +type UpdateObjectAttributesResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + WhoPaysForReads int64 `protobuf:"varint,1,opt,name=who_pays_for_reads,json=whoPaysForReads,proto3" json:"who_pays_for_reads,omitempty"` +} + +func (x *UpdateObjectAttributesResponse) Reset() { + *x = UpdateObjectAttributesResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_blobber_proto_msgTypes[32] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UpdateObjectAttributesResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateObjectAttributesResponse) ProtoMessage() {} + +func (x *UpdateObjectAttributesResponse) ProtoReflect() protoreflect.Message { + mi := &file_blobber_proto_msgTypes[32] + 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 UpdateObjectAttributesResponse.ProtoReflect.Descriptor instead. +func (*UpdateObjectAttributesResponse) Descriptor() ([]byte, []int) { + return file_blobber_proto_rawDescGZIP(), []int{32} +} + +func (x *UpdateObjectAttributesResponse) GetWhoPaysForReads() int64 { + if x != nil { + return x.WhoPaysForReads + } + return 0 +} + +type CopyObjectRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Allocation string `protobuf:"bytes,1,opt,name=allocation,proto3" json:"allocation,omitempty"` + Path string `protobuf:"bytes,2,opt,name=path,proto3" json:"path,omitempty"` + PathHash string `protobuf:"bytes,3,opt,name=path_hash,json=pathHash,proto3" json:"path_hash,omitempty"` + ConnectionId string `protobuf:"bytes,4,opt,name=connection_id,json=connectionId,proto3" json:"connection_id,omitempty"` + Dest string `protobuf:"bytes,5,opt,name=dest,proto3" json:"dest,omitempty"` +} + +func (x *CopyObjectRequest) Reset() { + *x = CopyObjectRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_blobber_proto_msgTypes[33] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } -func (x *GetFileMetaDataRequest) String() string { +func (x *CopyObjectRequest) String() string { return protoimpl.X.MessageStringOf(x) } -func (*GetFileMetaDataRequest) ProtoMessage() {} +func (*CopyObjectRequest) ProtoMessage() {} -func (x *GetFileMetaDataRequest) ProtoReflect() protoreflect.Message { - mi := &file_blobber_proto_msgTypes[14] +func (x *CopyObjectRequest) ProtoReflect() protoreflect.Message { + mi := &file_blobber_proto_msgTypes[33] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1038,72 +2307,78 @@ func (x *GetFileMetaDataRequest) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use GetFileMetaDataRequest.ProtoReflect.Descriptor instead. -func (*GetFileMetaDataRequest) Descriptor() ([]byte, []int) { - return file_blobber_proto_rawDescGZIP(), []int{14} +// Deprecated: Use CopyObjectRequest.ProtoReflect.Descriptor instead. +func (*CopyObjectRequest) Descriptor() ([]byte, []int) { + return file_blobber_proto_rawDescGZIP(), []int{33} } -func (x *GetFileMetaDataRequest) GetContext() *RequestContext { +func (x *CopyObjectRequest) GetAllocation() string { if x != nil { - return x.Context + return x.Allocation } - return nil + return "" } -func (x *GetFileMetaDataRequest) GetPath() string { +func (x *CopyObjectRequest) GetPath() string { if x != nil { return x.Path } return "" } -func (x *GetFileMetaDataRequest) GetPathHash() string { +func (x *CopyObjectRequest) GetPathHash() string { if x != nil { return x.PathHash } return "" } -func (x *GetFileMetaDataRequest) GetAuthToken() string { +func (x *CopyObjectRequest) GetConnectionId() string { if x != nil { - return x.AuthToken + return x.ConnectionId } return "" } -func (x *GetFileMetaDataRequest) GetAllocation() string { +func (x *CopyObjectRequest) GetDest() string { if x != nil { - return x.Allocation + return x.Dest } return "" } -type GetFileMetaDataResponse struct { +type CopyObjectResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - MetaData *FileRef `protobuf:"bytes,1,opt,name=MetaData,proto3" json:"MetaData,omitempty"` - Collaborators []*Collaborator `protobuf:"bytes,2,rep,name=Collaborators,proto3" json:"Collaborators,omitempty"` + Filename string `protobuf:"bytes,1,opt,name=filename,proto3" json:"filename,omitempty"` + Size int64 `protobuf:"varint,2,opt,name=size,proto3" json:"size,omitempty"` + ContentHash string `protobuf:"bytes,3,opt,name=content_hash,json=contentHash,proto3" json:"content_hash,omitempty"` + MerkleRoot string `protobuf:"bytes,4,opt,name=merkle_root,json=merkleRoot,proto3" json:"merkle_root,omitempty"` + //UploadLength indicates the size of the entire upload in bytes. The value MUST be a non-negative integer. + UploadLength int64 `protobuf:"varint,5,opt,name=upload_length,json=uploadLength,proto3" json:"upload_length,omitempty"` + //Upload-Offset indicates a byte offset within a resource. The value MUST be a non-negative integer. + UploadOffset int64 `protobuf:"varint,6,opt,name=upload_offset,json=uploadOffset,proto3" json:"upload_offset,omitempty"` } -func (x *GetFileMetaDataResponse) Reset() { - *x = GetFileMetaDataResponse{} +func (x *CopyObjectResponse) Reset() { + *x = CopyObjectResponse{} if protoimpl.UnsafeEnabled { - mi := &file_blobber_proto_msgTypes[15] + mi := &file_blobber_proto_msgTypes[34] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } -func (x *GetFileMetaDataResponse) String() string { +func (x *CopyObjectResponse) String() string { return protoimpl.X.MessageStringOf(x) } -func (*GetFileMetaDataResponse) ProtoMessage() {} +func (*CopyObjectResponse) ProtoMessage() {} -func (x *GetFileMetaDataResponse) ProtoReflect() protoreflect.Message { - mi := &file_blobber_proto_msgTypes[15] +func (x *CopyObjectResponse) ProtoReflect() protoreflect.Message { + mi := &file_blobber_proto_msgTypes[34] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1114,52 +2389,82 @@ func (x *GetFileMetaDataResponse) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use GetFileMetaDataResponse.ProtoReflect.Descriptor instead. -func (*GetFileMetaDataResponse) Descriptor() ([]byte, []int) { - return file_blobber_proto_rawDescGZIP(), []int{15} +// Deprecated: Use CopyObjectResponse.ProtoReflect.Descriptor instead. +func (*CopyObjectResponse) Descriptor() ([]byte, []int) { + return file_blobber_proto_rawDescGZIP(), []int{34} } -func (x *GetFileMetaDataResponse) GetMetaData() *FileRef { +func (x *CopyObjectResponse) GetFilename() string { if x != nil { - return x.MetaData + return x.Filename } - return nil + return "" } -func (x *GetFileMetaDataResponse) GetCollaborators() []*Collaborator { +func (x *CopyObjectResponse) GetSize() int64 { if x != nil { - return x.Collaborators + return x.Size } - return nil + return 0 } -type CommitMetaTxn struct { +func (x *CopyObjectResponse) GetContentHash() string { + if x != nil { + return x.ContentHash + } + return "" +} + +func (x *CopyObjectResponse) GetMerkleRoot() string { + if x != nil { + return x.MerkleRoot + } + return "" +} + +func (x *CopyObjectResponse) GetUploadLength() int64 { + if x != nil { + return x.UploadLength + } + return 0 +} + +func (x *CopyObjectResponse) GetUploadOffset() int64 { + if x != nil { + return x.UploadOffset + } + return 0 +} + +type RenameObjectRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - RefId int64 `protobuf:"varint,1,opt,name=RefId,proto3" json:"RefId,omitempty"` - TxnId string `protobuf:"bytes,2,opt,name=TxnId,proto3" json:"TxnId,omitempty"` - CreatedAt int64 `protobuf:"varint,3,opt,name=CreatedAt,proto3" json:"CreatedAt,omitempty"` + Allocation string `protobuf:"bytes,1,opt,name=allocation,proto3" json:"allocation,omitempty"` + Path string `protobuf:"bytes,2,opt,name=path,proto3" json:"path,omitempty"` + PathHash string `protobuf:"bytes,3,opt,name=path_hash,json=pathHash,proto3" json:"path_hash,omitempty"` + ConnectionId string `protobuf:"bytes,4,opt,name=connection_id,json=connectionId,proto3" json:"connection_id,omitempty"` + NewName string `protobuf:"bytes,5,opt,name=new_name,json=newName,proto3" json:"new_name,omitempty"` } -func (x *CommitMetaTxn) Reset() { - *x = CommitMetaTxn{} +func (x *RenameObjectRequest) Reset() { + *x = RenameObjectRequest{} if protoimpl.UnsafeEnabled { - mi := &file_blobber_proto_msgTypes[16] + mi := &file_blobber_proto_msgTypes[35] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } -func (x *CommitMetaTxn) String() string { +func (x *RenameObjectRequest) String() string { return protoimpl.X.MessageStringOf(x) } -func (*CommitMetaTxn) ProtoMessage() {} +func (*RenameObjectRequest) ProtoMessage() {} -func (x *CommitMetaTxn) ProtoReflect() protoreflect.Message { - mi := &file_blobber_proto_msgTypes[16] +func (x *RenameObjectRequest) ProtoReflect() protoreflect.Message { + mi := &file_blobber_proto_msgTypes[35] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1170,59 +2475,78 @@ func (x *CommitMetaTxn) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use CommitMetaTxn.ProtoReflect.Descriptor instead. -func (*CommitMetaTxn) Descriptor() ([]byte, []int) { - return file_blobber_proto_rawDescGZIP(), []int{16} +// Deprecated: Use RenameObjectRequest.ProtoReflect.Descriptor instead. +func (*RenameObjectRequest) Descriptor() ([]byte, []int) { + return file_blobber_proto_rawDescGZIP(), []int{35} } -func (x *CommitMetaTxn) GetRefId() int64 { +func (x *RenameObjectRequest) GetAllocation() string { if x != nil { - return x.RefId + return x.Allocation } - return 0 + return "" } -func (x *CommitMetaTxn) GetTxnId() string { +func (x *RenameObjectRequest) GetPath() string { if x != nil { - return x.TxnId + return x.Path } return "" } -func (x *CommitMetaTxn) GetCreatedAt() int64 { +func (x *RenameObjectRequest) GetPathHash() string { if x != nil { - return x.CreatedAt + return x.PathHash } - return 0 + return "" } -type Collaborator struct { +func (x *RenameObjectRequest) GetConnectionId() string { + if x != nil { + return x.ConnectionId + } + return "" +} + +func (x *RenameObjectRequest) GetNewName() string { + if x != nil { + return x.NewName + } + return "" +} + +type RenameObjectResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - RefId int64 `protobuf:"varint,1,opt,name=RefId,proto3" json:"RefId,omitempty"` - ClientId string `protobuf:"bytes,2,opt,name=ClientId,proto3" json:"ClientId,omitempty"` - CreatedAt int64 `protobuf:"varint,3,opt,name=CreatedAt,proto3" json:"CreatedAt,omitempty"` + Filename string `protobuf:"bytes,1,opt,name=filename,proto3" json:"filename,omitempty"` + Size int64 `protobuf:"varint,2,opt,name=size,proto3" json:"size,omitempty"` + ContentHash string `protobuf:"bytes,3,opt,name=content_hash,json=contentHash,proto3" json:"content_hash,omitempty"` + MerkleRoot string `protobuf:"bytes,4,opt,name=merkle_root,json=merkleRoot,proto3" json:"merkle_root,omitempty"` + //UploadLength indicates the size of the entire upload in bytes. The value MUST be a non-negative integer. + UploadLength int64 `protobuf:"varint,5,opt,name=upload_length,json=uploadLength,proto3" json:"upload_length,omitempty"` + //Upload-Offset indicates a byte offset within a resource. The value MUST be a non-negative integer. + UploadOffset int64 `protobuf:"varint,6,opt,name=upload_offset,json=uploadOffset,proto3" json:"upload_offset,omitempty"` } -func (x *Collaborator) Reset() { - *x = Collaborator{} +func (x *RenameObjectResponse) Reset() { + *x = RenameObjectResponse{} if protoimpl.UnsafeEnabled { - mi := &file_blobber_proto_msgTypes[17] + mi := &file_blobber_proto_msgTypes[36] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } -func (x *Collaborator) String() string { +func (x *RenameObjectResponse) String() string { return protoimpl.X.MessageStringOf(x) } -func (*Collaborator) ProtoMessage() {} +func (*RenameObjectResponse) ProtoMessage() {} -func (x *Collaborator) ProtoReflect() protoreflect.Message { - mi := &file_blobber_proto_msgTypes[17] +func (x *RenameObjectResponse) ProtoReflect() protoreflect.Message { + mi := &file_blobber_proto_msgTypes[36] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1233,59 +2557,85 @@ func (x *Collaborator) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use Collaborator.ProtoReflect.Descriptor instead. -func (*Collaborator) Descriptor() ([]byte, []int) { - return file_blobber_proto_rawDescGZIP(), []int{17} +// Deprecated: Use RenameObjectResponse.ProtoReflect.Descriptor instead. +func (*RenameObjectResponse) Descriptor() ([]byte, []int) { + return file_blobber_proto_rawDescGZIP(), []int{36} } -func (x *Collaborator) GetRefId() int64 { +func (x *RenameObjectResponse) GetFilename() string { if x != nil { - return x.RefId + return x.Filename + } + return "" +} + +func (x *RenameObjectResponse) GetSize() int64 { + if x != nil { + return x.Size } return 0 } -func (x *Collaborator) GetClientId() string { +func (x *RenameObjectResponse) GetContentHash() string { if x != nil { - return x.ClientId + return x.ContentHash } return "" } -func (x *Collaborator) GetCreatedAt() int64 { +func (x *RenameObjectResponse) GetMerkleRoot() string { if x != nil { - return x.CreatedAt + return x.MerkleRoot + } + return "" +} + +func (x *RenameObjectResponse) GetUploadLength() int64 { + if x != nil { + return x.UploadLength + } + return 0 +} + +func (x *RenameObjectResponse) GetUploadOffset() int64 { + if x != nil { + return x.UploadOffset } return 0 } -type RequestContext struct { +type UploadFileRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Client string `protobuf:"bytes,1,opt,name=client,proto3" json:"client,omitempty"` - ClientKey string `protobuf:"bytes,2,opt,name=client_key,json=clientKey,proto3" json:"client_key,omitempty"` - Allocation string `protobuf:"bytes,3,opt,name=allocation,proto3" json:"allocation,omitempty"` + Allocation string `protobuf:"bytes,1,opt,name=allocation,proto3" json:"allocation,omitempty"` + Path string `protobuf:"bytes,2,opt,name=path,proto3" json:"path,omitempty"` + ConnectionId string `protobuf:"bytes,3,opt,name=connection_id,json=connectionId,proto3" json:"connection_id,omitempty"` + Method string `protobuf:"bytes,4,opt,name=method,proto3" json:"method,omitempty"` + UploadMeta string `protobuf:"bytes,5,opt,name=upload_meta,json=uploadMeta,proto3" json:"upload_meta,omitempty"` + UpdateMeta string `protobuf:"bytes,6,opt,name=update_meta,json=updateMeta,proto3" json:"update_meta,omitempty"` + UploadFile []byte `protobuf:"bytes,7,opt,name=upload_file,json=uploadFile,proto3" json:"upload_file,omitempty"` + UploadThumbnailFile []byte `protobuf:"bytes,8,opt,name=upload_thumbnail_file,json=uploadThumbnailFile,proto3" json:"upload_thumbnail_file,omitempty"` } -func (x *RequestContext) Reset() { - *x = RequestContext{} +func (x *UploadFileRequest) Reset() { + *x = UploadFileRequest{} if protoimpl.UnsafeEnabled { - mi := &file_blobber_proto_msgTypes[18] + mi := &file_blobber_proto_msgTypes[37] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } -func (x *RequestContext) String() string { +func (x *UploadFileRequest) String() string { return protoimpl.X.MessageStringOf(x) } -func (*RequestContext) ProtoMessage() {} +func (*UploadFileRequest) ProtoMessage() {} -func (x *RequestContext) ProtoReflect() protoreflect.Message { - mi := &file_blobber_proto_msgTypes[18] +func (x *UploadFileRequest) ProtoReflect() protoreflect.Message { + mi := &file_blobber_proto_msgTypes[37] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1296,112 +2646,99 @@ func (x *RequestContext) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use RequestContext.ProtoReflect.Descriptor instead. -func (*RequestContext) Descriptor() ([]byte, []int) { - return file_blobber_proto_rawDescGZIP(), []int{18} +// Deprecated: Use UploadFileRequest.ProtoReflect.Descriptor instead. +func (*UploadFileRequest) Descriptor() ([]byte, []int) { + return file_blobber_proto_rawDescGZIP(), []int{37} } -func (x *RequestContext) GetClient() string { +func (x *UploadFileRequest) GetAllocation() string { if x != nil { - return x.Client + return x.Allocation } return "" } -func (x *RequestContext) GetClientKey() string { +func (x *UploadFileRequest) GetPath() string { if x != nil { - return x.ClientKey + return x.Path } return "" } -func (x *RequestContext) GetAllocation() string { +func (x *UploadFileRequest) GetConnectionId() string { if x != nil { - return x.Allocation + return x.ConnectionId } return "" } -type GetAllocationRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Context *RequestContext `protobuf:"bytes,1,opt,name=context,proto3" json:"context,omitempty"` - Id string `protobuf:"bytes,2,opt,name=id,proto3" json:"id,omitempty"` -} - -func (x *GetAllocationRequest) Reset() { - *x = GetAllocationRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_blobber_proto_msgTypes[19] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) +func (x *UploadFileRequest) GetMethod() string { + if x != nil { + return x.Method } + return "" } -func (x *GetAllocationRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GetAllocationRequest) ProtoMessage() {} - -func (x *GetAllocationRequest) ProtoReflect() protoreflect.Message { - mi := &file_blobber_proto_msgTypes[19] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms +func (x *UploadFileRequest) GetUploadMeta() string { + if x != nil { + return x.UploadMeta } - return mi.MessageOf(x) + return "" } -// Deprecated: Use GetAllocationRequest.ProtoReflect.Descriptor instead. -func (*GetAllocationRequest) Descriptor() ([]byte, []int) { - return file_blobber_proto_rawDescGZIP(), []int{19} +func (x *UploadFileRequest) GetUpdateMeta() string { + if x != nil { + return x.UpdateMeta + } + return "" } -func (x *GetAllocationRequest) GetContext() *RequestContext { +func (x *UploadFileRequest) GetUploadFile() []byte { if x != nil { - return x.Context + return x.UploadFile } return nil } -func (x *GetAllocationRequest) GetId() string { +func (x *UploadFileRequest) GetUploadThumbnailFile() []byte { if x != nil { - return x.Id + return x.UploadThumbnailFile } - return "" + return nil } -type GetAllocationResponse struct { +type UploadFileResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Allocation *Allocation `protobuf:"bytes,1,opt,name=allocation,proto3" json:"allocation,omitempty"` + Filename string `protobuf:"bytes,1,opt,name=filename,proto3" json:"filename,omitempty"` + Size int64 `protobuf:"varint,2,opt,name=size,proto3" json:"size,omitempty"` + ContentHash string `protobuf:"bytes,3,opt,name=content_hash,json=contentHash,proto3" json:"content_hash,omitempty"` + MerkleRoot string `protobuf:"bytes,4,opt,name=merkle_root,json=merkleRoot,proto3" json:"merkle_root,omitempty"` + //UploadLength indicates the size of the entire upload in bytes. The value MUST be a non-negative integer. + UploadLength int64 `protobuf:"varint,5,opt,name=upload_length,json=uploadLength,proto3" json:"upload_length,omitempty"` + //Upload-Offset indicates a byte offset within a resource. The value MUST be a non-negative integer. + UploadOffset int64 `protobuf:"varint,6,opt,name=upload_offset,json=uploadOffset,proto3" json:"upload_offset,omitempty"` } -func (x *GetAllocationResponse) Reset() { - *x = GetAllocationResponse{} +func (x *UploadFileResponse) Reset() { + *x = UploadFileResponse{} if protoimpl.UnsafeEnabled { - mi := &file_blobber_proto_msgTypes[20] + mi := &file_blobber_proto_msgTypes[38] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } -func (x *GetAllocationResponse) String() string { +func (x *UploadFileResponse) String() string { return protoimpl.X.MessageStringOf(x) } -func (*GetAllocationResponse) ProtoMessage() {} +func (*UploadFileResponse) ProtoMessage() {} -func (x *GetAllocationResponse) ProtoReflect() protoreflect.Message { - mi := &file_blobber_proto_msgTypes[20] +func (x *UploadFileResponse) ProtoReflect() protoreflect.Message { + mi := &file_blobber_proto_msgTypes[38] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1412,16 +2749,51 @@ func (x *GetAllocationResponse) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use GetAllocationResponse.ProtoReflect.Descriptor instead. -func (*GetAllocationResponse) Descriptor() ([]byte, []int) { - return file_blobber_proto_rawDescGZIP(), []int{20} +// Deprecated: Use UploadFileResponse.ProtoReflect.Descriptor instead. +func (*UploadFileResponse) Descriptor() ([]byte, []int) { + return file_blobber_proto_rawDescGZIP(), []int{38} } -func (x *GetAllocationResponse) GetAllocation() *Allocation { +func (x *UploadFileResponse) GetFilename() string { if x != nil { - return x.Allocation + return x.Filename } - return nil + return "" +} + +func (x *UploadFileResponse) GetSize() int64 { + if x != nil { + return x.Size + } + return 0 +} + +func (x *UploadFileResponse) GetContentHash() string { + if x != nil { + return x.ContentHash + } + return "" +} + +func (x *UploadFileResponse) GetMerkleRoot() string { + if x != nil { + return x.MerkleRoot + } + return "" +} + +func (x *UploadFileResponse) GetUploadLength() int64 { + if x != nil { + return x.UploadLength + } + return 0 +} + +func (x *UploadFileResponse) GetUploadOffset() int64 { + if x != nil { + return x.UploadOffset + } + return 0 } type Allocation struct { @@ -1429,30 +2801,30 @@ type Allocation struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - ID string `protobuf:"bytes,1,opt,name=ID,proto3" json:"ID,omitempty"` - Tx string `protobuf:"bytes,2,opt,name=Tx,proto3" json:"Tx,omitempty"` - TotalSize int64 `protobuf:"varint,3,opt,name=TotalSize,proto3" json:"TotalSize,omitempty"` - UsedSize int64 `protobuf:"varint,4,opt,name=UsedSize,proto3" json:"UsedSize,omitempty"` - OwnerID string `protobuf:"bytes,5,opt,name=OwnerID,proto3" json:"OwnerID,omitempty"` - OwnerPublicKey string `protobuf:"bytes,6,opt,name=OwnerPublicKey,proto3" json:"OwnerPublicKey,omitempty"` - RepairerID string `protobuf:"bytes,7,opt,name=RepairerID,proto3" json:"RepairerID,omitempty"` - PayerID string `protobuf:"bytes,8,opt,name=PayerID,proto3" json:"PayerID,omitempty"` - Expiration int64 `protobuf:"varint,9,opt,name=Expiration,proto3" json:"Expiration,omitempty"` - AllocationRoot string `protobuf:"bytes,10,opt,name=AllocationRoot,proto3" json:"AllocationRoot,omitempty"` - BlobberSize int64 `protobuf:"varint,11,opt,name=BlobberSize,proto3" json:"BlobberSize,omitempty"` - BlobberSizeUsed int64 `protobuf:"varint,12,opt,name=BlobberSizeUsed,proto3" json:"BlobberSizeUsed,omitempty"` - LatestRedeemedWM string `protobuf:"bytes,13,opt,name=LatestRedeemedWM,proto3" json:"LatestRedeemedWM,omitempty"` - IsRedeemRequired bool `protobuf:"varint,14,opt,name=IsRedeemRequired,proto3" json:"IsRedeemRequired,omitempty"` - TimeUnit int64 `protobuf:"varint,15,opt,name=TimeUnit,proto3" json:"TimeUnit,omitempty"` - CleanedUp bool `protobuf:"varint,16,opt,name=CleanedUp,proto3" json:"CleanedUp,omitempty"` - Finalized bool `protobuf:"varint,17,opt,name=Finalized,proto3" json:"Finalized,omitempty"` - Terms []*Term `protobuf:"bytes,18,rep,name=Terms,proto3" json:"Terms,omitempty"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Tx string `protobuf:"bytes,2,opt,name=tx,proto3" json:"tx,omitempty"` + TotalSize int64 `protobuf:"varint,3,opt,name=total_size,json=totalSize,proto3" json:"total_size,omitempty"` + UsedSize int64 `protobuf:"varint,4,opt,name=used_size,json=usedSize,proto3" json:"used_size,omitempty"` + OwnerId string `protobuf:"bytes,5,opt,name=owner_id,json=ownerId,proto3" json:"owner_id,omitempty"` + OwnerPublicKey string `protobuf:"bytes,6,opt,name=owner_public_key,json=ownerPublicKey,proto3" json:"owner_public_key,omitempty"` + RepairerId string `protobuf:"bytes,7,opt,name=repairer_id,json=repairerId,proto3" json:"repairer_id,omitempty"` + PayerId string `protobuf:"bytes,8,opt,name=payer_id,json=payerId,proto3" json:"payer_id,omitempty"` + Expiration int64 `protobuf:"varint,9,opt,name=expiration,proto3" json:"expiration,omitempty"` + AllocationRoot string `protobuf:"bytes,10,opt,name=allocation_root,json=allocationRoot,proto3" json:"allocation_root,omitempty"` + BlobberSize int64 `protobuf:"varint,11,opt,name=blobber_size,json=blobberSize,proto3" json:"blobber_size,omitempty"` + BlobberSizeUsed int64 `protobuf:"varint,12,opt,name=blobber_size_used,json=blobberSizeUsed,proto3" json:"blobber_size_used,omitempty"` + LatestRedeemedWm string `protobuf:"bytes,13,opt,name=latest_redeemed_wm,json=latestRedeemedWm,proto3" json:"latest_redeemed_wm,omitempty"` + IsRedeemRequired bool `protobuf:"varint,14,opt,name=is_redeem_required,json=isRedeemRequired,proto3" json:"is_redeem_required,omitempty"` + TimeUnit int64 `protobuf:"varint,15,opt,name=time_unit,json=timeUnit,proto3" json:"time_unit,omitempty"` + CleanedUp bool `protobuf:"varint,16,opt,name=cleaned_up,json=cleanedUp,proto3" json:"cleaned_up,omitempty"` + Finalized bool `protobuf:"varint,17,opt,name=finalized,proto3" json:"finalized,omitempty"` + Terms []*Term `protobuf:"bytes,18,rep,name=terms,proto3" json:"terms,omitempty"` } func (x *Allocation) Reset() { *x = Allocation{} if protoimpl.UnsafeEnabled { - mi := &file_blobber_proto_msgTypes[21] + mi := &file_blobber_proto_msgTypes[39] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1465,7 +2837,7 @@ func (x *Allocation) String() string { func (*Allocation) ProtoMessage() {} func (x *Allocation) ProtoReflect() protoreflect.Message { - mi := &file_blobber_proto_msgTypes[21] + mi := &file_blobber_proto_msgTypes[39] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1478,12 +2850,12 @@ func (x *Allocation) ProtoReflect() protoreflect.Message { // Deprecated: Use Allocation.ProtoReflect.Descriptor instead. func (*Allocation) Descriptor() ([]byte, []int) { - return file_blobber_proto_rawDescGZIP(), []int{21} + return file_blobber_proto_rawDescGZIP(), []int{39} } -func (x *Allocation) GetID() string { +func (x *Allocation) GetId() string { if x != nil { - return x.ID + return x.Id } return "" } @@ -1509,9 +2881,9 @@ func (x *Allocation) GetUsedSize() int64 { return 0 } -func (x *Allocation) GetOwnerID() string { +func (x *Allocation) GetOwnerId() string { if x != nil { - return x.OwnerID + return x.OwnerId } return "" } @@ -1523,16 +2895,16 @@ func (x *Allocation) GetOwnerPublicKey() string { return "" } -func (x *Allocation) GetRepairerID() string { +func (x *Allocation) GetRepairerId() string { if x != nil { - return x.RepairerID + return x.RepairerId } return "" } -func (x *Allocation) GetPayerID() string { +func (x *Allocation) GetPayerId() string { if x != nil { - return x.PayerID + return x.PayerId } return "" } @@ -1565,9 +2937,9 @@ func (x *Allocation) GetBlobberSizeUsed() int64 { return 0 } -func (x *Allocation) GetLatestRedeemedWM() string { +func (x *Allocation) GetLatestRedeemedWm() string { if x != nil { - return x.LatestRedeemedWM + return x.LatestRedeemedWm } return "" } @@ -1612,17 +2984,17 @@ type Term struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - ID int64 `protobuf:"varint,1,opt,name=ID,proto3" json:"ID,omitempty"` - BlobberID string `protobuf:"bytes,2,opt,name=BlobberID,proto3" json:"BlobberID,omitempty"` - AllocationID string `protobuf:"bytes,3,opt,name=AllocationID,proto3" json:"AllocationID,omitempty"` - ReadPrice int64 `protobuf:"varint,4,opt,name=ReadPrice,proto3" json:"ReadPrice,omitempty"` - WritePrice int64 `protobuf:"varint,5,opt,name=WritePrice,proto3" json:"WritePrice,omitempty"` + Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + BlobberId string `protobuf:"bytes,2,opt,name=blobber_id,json=blobberId,proto3" json:"blobber_id,omitempty"` + AllocationId string `protobuf:"bytes,3,opt,name=allocation_id,json=allocationId,proto3" json:"allocation_id,omitempty"` + ReadPrice int64 `protobuf:"varint,4,opt,name=read_price,json=readPrice,proto3" json:"read_price,omitempty"` + WritePrice int64 `protobuf:"varint,5,opt,name=write_price,json=writePrice,proto3" json:"write_price,omitempty"` } func (x *Term) Reset() { *x = Term{} if protoimpl.UnsafeEnabled { - mi := &file_blobber_proto_msgTypes[22] + mi := &file_blobber_proto_msgTypes[40] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1635,7 +3007,7 @@ func (x *Term) String() string { func (*Term) ProtoMessage() {} func (x *Term) ProtoReflect() protoreflect.Message { - mi := &file_blobber_proto_msgTypes[22] + mi := &file_blobber_proto_msgTypes[40] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1648,26 +3020,26 @@ func (x *Term) ProtoReflect() protoreflect.Message { // Deprecated: Use Term.ProtoReflect.Descriptor instead. func (*Term) Descriptor() ([]byte, []int) { - return file_blobber_proto_rawDescGZIP(), []int{22} + return file_blobber_proto_rawDescGZIP(), []int{40} } -func (x *Term) GetID() int64 { +func (x *Term) GetId() int64 { if x != nil { - return x.ID + return x.Id } return 0 } -func (x *Term) GetBlobberID() string { +func (x *Term) GetBlobberId() string { if x != nil { - return x.BlobberID + return x.BlobberId } return "" } -func (x *Term) GetAllocationID() string { +func (x *Term) GetAllocationId() string { if x != nil { - return x.AllocationID + return x.AllocationId } return "" } @@ -1691,15 +3063,15 @@ type FileRef struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Type string `protobuf:"bytes,1,opt,name=Type,proto3" json:"Type,omitempty"` - FileMetaData *FileMetaData `protobuf:"bytes,2,opt,name=FileMetaData,proto3" json:"FileMetaData,omitempty"` - DirMetaData *DirMetaData `protobuf:"bytes,3,opt,name=DirMetaData,proto3" json:"DirMetaData,omitempty"` + Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"` + FileMetaData *FileMetaData `protobuf:"bytes,2,opt,name=file_meta_data,json=fileMetaData,proto3" json:"file_meta_data,omitempty"` + DirMetaData *DirMetaData `protobuf:"bytes,3,opt,name=dir_meta_data,json=dirMetaData,proto3" json:"dir_meta_data,omitempty"` } func (x *FileRef) Reset() { *x = FileRef{} if protoimpl.UnsafeEnabled { - mi := &file_blobber_proto_msgTypes[23] + mi := &file_blobber_proto_msgTypes[41] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1712,7 +3084,7 @@ func (x *FileRef) String() string { func (*FileRef) ProtoMessage() {} func (x *FileRef) ProtoReflect() protoreflect.Message { - mi := &file_blobber_proto_msgTypes[23] + mi := &file_blobber_proto_msgTypes[41] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1725,7 +3097,7 @@ func (x *FileRef) ProtoReflect() protoreflect.Message { // Deprecated: Use FileRef.ProtoReflect.Descriptor instead. func (*FileRef) Descriptor() ([]byte, []int) { - return file_blobber_proto_rawDescGZIP(), []int{23} + return file_blobber_proto_rawDescGZIP(), []int{41} } func (x *FileRef) GetType() string { @@ -1754,36 +3126,36 @@ type FileMetaData struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Type string `protobuf:"bytes,1,opt,name=Type,proto3" json:"Type,omitempty"` - LookupHash string `protobuf:"bytes,2,opt,name=LookupHash,proto3" json:"LookupHash,omitempty"` - Name string `protobuf:"bytes,3,opt,name=Name,proto3" json:"Name,omitempty"` - Path string `protobuf:"bytes,4,opt,name=Path,proto3" json:"Path,omitempty"` - Hash string `protobuf:"bytes,5,opt,name=Hash,proto3" json:"Hash,omitempty"` - NumBlocks int64 `protobuf:"varint,6,opt,name=NumBlocks,proto3" json:"NumBlocks,omitempty"` - PathHash string `protobuf:"bytes,7,opt,name=PathHash,proto3" json:"PathHash,omitempty"` - CustomMeta string `protobuf:"bytes,8,opt,name=CustomMeta,proto3" json:"CustomMeta,omitempty"` - ContentHash string `protobuf:"bytes,9,opt,name=ContentHash,proto3" json:"ContentHash,omitempty"` - Size int64 `protobuf:"varint,10,opt,name=Size,proto3" json:"Size,omitempty"` - MerkleRoot string `protobuf:"bytes,11,opt,name=MerkleRoot,proto3" json:"MerkleRoot,omitempty"` - ActualFileSize int64 `protobuf:"varint,12,opt,name=ActualFileSize,proto3" json:"ActualFileSize,omitempty"` - ActualFileHash string `protobuf:"bytes,13,opt,name=ActualFileHash,proto3" json:"ActualFileHash,omitempty"` - MimeType string `protobuf:"bytes,14,opt,name=MimeType,proto3" json:"MimeType,omitempty"` - ThumbnailSize int64 `protobuf:"varint,15,opt,name=ThumbnailSize,proto3" json:"ThumbnailSize,omitempty"` - ThumbnailHash string `protobuf:"bytes,16,opt,name=ThumbnailHash,proto3" json:"ThumbnailHash,omitempty"` - ActualThumbnailSize int64 `protobuf:"varint,17,opt,name=ActualThumbnailSize,proto3" json:"ActualThumbnailSize,omitempty"` - ActualThumbnailHash string `protobuf:"bytes,18,opt,name=ActualThumbnailHash,proto3" json:"ActualThumbnailHash,omitempty"` - EncryptedKey string `protobuf:"bytes,19,opt,name=EncryptedKey,proto3" json:"EncryptedKey,omitempty"` - Attributes []byte `protobuf:"bytes,20,opt,name=Attributes,proto3" json:"Attributes,omitempty"` - OnCloud bool `protobuf:"varint,21,opt,name=OnCloud,proto3" json:"OnCloud,omitempty"` - CommitMetaTxns []*CommitMetaTxn `protobuf:"bytes,22,rep,name=CommitMetaTxns,proto3" json:"CommitMetaTxns,omitempty"` - CreatedAt int64 `protobuf:"varint,23,opt,name=CreatedAt,proto3" json:"CreatedAt,omitempty"` - UpdatedAt int64 `protobuf:"varint,24,opt,name=UpdatedAt,proto3" json:"UpdatedAt,omitempty"` + Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"` + LookupHash string `protobuf:"bytes,2,opt,name=lookup_hash,json=lookupHash,proto3" json:"lookup_hash,omitempty"` + Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"` + Path string `protobuf:"bytes,4,opt,name=path,proto3" json:"path,omitempty"` + Hash string `protobuf:"bytes,5,opt,name=hash,proto3" json:"hash,omitempty"` + NumBlocks int64 `protobuf:"varint,6,opt,name=num_blocks,json=numBlocks,proto3" json:"num_blocks,omitempty"` + PathHash string `protobuf:"bytes,7,opt,name=path_hash,json=pathHash,proto3" json:"path_hash,omitempty"` + CustomMeta string `protobuf:"bytes,8,opt,name=custom_meta,json=customMeta,proto3" json:"custom_meta,omitempty"` + ContentHash string `protobuf:"bytes,9,opt,name=content_hash,json=contentHash,proto3" json:"content_hash,omitempty"` + Size int64 `protobuf:"varint,10,opt,name=size,proto3" json:"size,omitempty"` + MerkleRoot string `protobuf:"bytes,11,opt,name=merkle_root,json=merkleRoot,proto3" json:"merkle_root,omitempty"` + ActualFileSize int64 `protobuf:"varint,12,opt,name=actual_file_size,json=actualFileSize,proto3" json:"actual_file_size,omitempty"` + ActualFileHash string `protobuf:"bytes,13,opt,name=actual_file_hash,json=actualFileHash,proto3" json:"actual_file_hash,omitempty"` + MimeType string `protobuf:"bytes,14,opt,name=mime_type,json=mimeType,proto3" json:"mime_type,omitempty"` + ThumbnailSize int64 `protobuf:"varint,15,opt,name=thumbnail_size,json=thumbnailSize,proto3" json:"thumbnail_size,omitempty"` + ThumbnailHash string `protobuf:"bytes,16,opt,name=thumbnail_hash,json=thumbnailHash,proto3" json:"thumbnail_hash,omitempty"` + ActualThumbnailSize int64 `protobuf:"varint,17,opt,name=actual_thumbnail_size,json=actualThumbnailSize,proto3" json:"actual_thumbnail_size,omitempty"` + ActualThumbnailHash string `protobuf:"bytes,18,opt,name=actual_thumbnail_hash,json=actualThumbnailHash,proto3" json:"actual_thumbnail_hash,omitempty"` + EncryptedKey string `protobuf:"bytes,19,opt,name=encrypted_key,json=encryptedKey,proto3" json:"encrypted_key,omitempty"` + Attributes []byte `protobuf:"bytes,20,opt,name=attributes,proto3" json:"attributes,omitempty"` + OnCloud bool `protobuf:"varint,21,opt,name=on_cloud,json=onCloud,proto3" json:"on_cloud,omitempty"` + CommitMetaTxns []*CommitMetaTxn `protobuf:"bytes,22,rep,name=commit_meta_txns,json=commitMetaTxns,proto3" json:"commit_meta_txns,omitempty"` + CreatedAt int64 `protobuf:"varint,23,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"` + UpdatedAt int64 `protobuf:"varint,24,opt,name=updated_at,json=updatedAt,proto3" json:"updated_at,omitempty"` } func (x *FileMetaData) Reset() { *x = FileMetaData{} if protoimpl.UnsafeEnabled { - mi := &file_blobber_proto_msgTypes[24] + mi := &file_blobber_proto_msgTypes[42] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1796,7 +3168,7 @@ func (x *FileMetaData) String() string { func (*FileMetaData) ProtoMessage() {} func (x *FileMetaData) ProtoReflect() protoreflect.Message { - mi := &file_blobber_proto_msgTypes[24] + mi := &file_blobber_proto_msgTypes[42] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1809,7 +3181,7 @@ func (x *FileMetaData) ProtoReflect() protoreflect.Message { // Deprecated: Use FileMetaData.ProtoReflect.Descriptor instead. func (*FileMetaData) Descriptor() ([]byte, []int) { - return file_blobber_proto_rawDescGZIP(), []int{24} + return file_blobber_proto_rawDescGZIP(), []int{42} } func (x *FileMetaData) GetType() string { @@ -1985,23 +3357,22 @@ type DirMetaData struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Type string `protobuf:"bytes,1,opt,name=Type,proto3" json:"Type,omitempty"` - LookupHash string `protobuf:"bytes,2,opt,name=LookupHash,proto3" json:"LookupHash,omitempty"` - Name string `protobuf:"bytes,3,opt,name=Name,proto3" json:"Name,omitempty"` - Path string `protobuf:"bytes,4,opt,name=Path,proto3" json:"Path,omitempty"` - Hash string `protobuf:"bytes,5,opt,name=Hash,proto3" json:"Hash,omitempty"` - NumBlocks int64 `protobuf:"varint,6,opt,name=NumBlocks,proto3" json:"NumBlocks,omitempty"` - PathHash string `protobuf:"bytes,7,opt,name=PathHash,proto3" json:"PathHash,omitempty"` - Size int64 `protobuf:"varint,8,opt,name=Size,proto3" json:"Size,omitempty"` - CreatedAt int64 `protobuf:"varint,9,opt,name=CreatedAt,proto3" json:"CreatedAt,omitempty"` - UpdatedAt int64 `protobuf:"varint,10,opt,name=UpdatedAt,proto3" json:"UpdatedAt,omitempty"` - Children []*FileRef `protobuf:"bytes,11,rep,name=Children,proto3" json:"Children,omitempty"` + Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"` + LookupHash string `protobuf:"bytes,2,opt,name=lookup_hash,json=lookupHash,proto3" json:"lookup_hash,omitempty"` + Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"` + Path string `protobuf:"bytes,4,opt,name=path,proto3" json:"path,omitempty"` + Hash string `protobuf:"bytes,5,opt,name=hash,proto3" json:"hash,omitempty"` + NumBlocks int64 `protobuf:"varint,6,opt,name=num_blocks,json=numBlocks,proto3" json:"num_blocks,omitempty"` + PathHash string `protobuf:"bytes,7,opt,name=path_hash,json=pathHash,proto3" json:"path_hash,omitempty"` + Size int64 `protobuf:"varint,8,opt,name=size,proto3" json:"size,omitempty"` + CreatedAt int64 `protobuf:"varint,9,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"` + UpdatedAt int64 `protobuf:"varint,10,opt,name=updated_at,json=updatedAt,proto3" json:"updated_at,omitempty"` } func (x *DirMetaData) Reset() { *x = DirMetaData{} if protoimpl.UnsafeEnabled { - mi := &file_blobber_proto_msgTypes[25] + mi := &file_blobber_proto_msgTypes[43] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2014,7 +3385,7 @@ func (x *DirMetaData) String() string { func (*DirMetaData) ProtoMessage() {} func (x *DirMetaData) ProtoReflect() protoreflect.Message { - mi := &file_blobber_proto_msgTypes[25] + mi := &file_blobber_proto_msgTypes[43] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2027,7 +3398,7 @@ func (x *DirMetaData) ProtoReflect() protoreflect.Message { // Deprecated: Use DirMetaData.ProtoReflect.Descriptor instead. func (*DirMetaData) Descriptor() ([]byte, []int) { - return file_blobber_proto_rawDescGZIP(), []int{25} + return file_blobber_proto_rawDescGZIP(), []int{43} } func (x *DirMetaData) GetType() string { @@ -2100,13 +3471,6 @@ func (x *DirMetaData) GetUpdatedAt() int64 { return 0 } -func (x *DirMetaData) GetChildren() []*FileRef { - if x != nil { - return x.Children - } - return nil -} - var File_blobber_proto protoreflect.FileDescriptor var file_blobber_proto_rawDesc = []byte{ @@ -2114,413 +3478,682 @@ var file_blobber_proto_rawDesc = []byte{ 0x12, 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x22, 0x88, 0x01, 0x0a, 0x14, 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x54, - 0x72, 0x65, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x3c, 0x0a, 0x07, 0x63, 0x6f, - 0x6e, 0x74, 0x65, 0x78, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x62, 0x6c, - 0x6f, 0x62, 0x62, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x76, 0x31, - 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x52, - 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, + 0x6f, 0x22, 0x9b, 0x01, 0x0a, 0x13, 0x43, 0x6f, 0x6c, 0x6c, 0x61, 0x62, 0x6f, 0x72, 0x61, 0x74, + 0x6f, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1e, 0x0a, 0x0a, 0x61, 0x6c, 0x6c, + 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x61, + 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1b, 0x0a, 0x09, 0x63, 0x6f, 0x6c, + 0x6c, 0x61, 0x62, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x63, 0x6f, + 0x6c, 0x6c, 0x61, 0x62, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x12, 0x12, + 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x70, 0x61, + 0x74, 0x68, 0x12, 0x1b, 0x0a, 0x09, 0x70, 0x61, 0x74, 0x68, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, + 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x61, 0x74, 0x68, 0x48, 0x61, 0x73, 0x68, 0x22, + 0x78, 0x0a, 0x14, 0x43, 0x6f, 0x6c, 0x6c, 0x61, 0x62, 0x6f, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, + 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, + 0x65, 0x12, 0x46, 0x0a, 0x0d, 0x63, 0x6f, 0x6c, 0x6c, 0x61, 0x62, 0x6f, 0x72, 0x61, 0x74, 0x6f, + 0x72, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x62, 0x6c, 0x6f, 0x62, 0x62, + 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x6f, + 0x6c, 0x6c, 0x61, 0x62, 0x6f, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x52, 0x0d, 0x63, 0x6f, 0x6c, 0x6c, + 0x61, 0x62, 0x6f, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x73, 0x22, 0x60, 0x0a, 0x14, 0x43, 0x61, 0x6c, + 0x63, 0x75, 0x6c, 0x61, 0x74, 0x65, 0x48, 0x61, 0x73, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x12, 0x1e, 0x0a, 0x0a, 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x04, 0x70, 0x61, 0x74, 0x68, 0x12, 0x14, 0x0a, 0x05, 0x70, 0x61, 0x74, 0x68, 0x73, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x70, 0x61, 0x74, 0x68, 0x73, 0x22, 0x31, 0x0a, 0x15, 0x43, + 0x61, 0x6c, 0x63, 0x75, 0x6c, 0x61, 0x74, 0x65, 0x48, 0x61, 0x73, 0x68, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x77, + 0x0a, 0x0d, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, + 0x1e, 0x0a, 0x0a, 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0a, 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, + 0x23, 0x0a, 0x0d, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, + 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x21, 0x0a, 0x0c, 0x77, 0x72, 0x69, 0x74, 0x65, 0x5f, 0x6d, 0x61, + 0x72, 0x6b, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x77, 0x72, 0x69, 0x74, + 0x65, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x72, 0x22, 0xbc, 0x01, 0x0a, 0x0e, 0x43, 0x6f, 0x6d, 0x6d, + 0x69, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x27, 0x0a, 0x0f, 0x61, 0x6c, + 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x72, 0x6f, 0x6f, 0x74, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0e, 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, + 0x6f, 0x6f, 0x74, 0x12, 0x42, 0x0a, 0x0c, 0x77, 0x72, 0x69, 0x74, 0x65, 0x5f, 0x6d, 0x61, 0x72, + 0x6b, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x62, 0x6c, 0x6f, 0x62, + 0x62, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x57, + 0x72, 0x69, 0x74, 0x65, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x72, 0x52, 0x0b, 0x77, 0x72, 0x69, 0x74, + 0x65, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x72, 0x12, 0x23, 0x0a, 0x0d, 0x65, 0x72, 0x72, 0x6f, 0x72, + 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, + 0x65, 0x72, 0x72, 0x6f, 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x18, 0x0a, 0x07, + 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x73, + 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x22, 0x9d, 0x01, 0x0a, 0x14, 0x43, 0x6f, 0x6d, 0x6d, 0x69, + 0x74, 0x4d, 0x65, 0x74, 0x61, 0x54, 0x78, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, + 0x12, 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x70, + 0x61, 0x74, 0x68, 0x12, 0x1b, 0x0a, 0x09, 0x70, 0x61, 0x74, 0x68, 0x5f, 0x68, 0x61, 0x73, 0x68, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x61, 0x74, 0x68, 0x48, 0x61, 0x73, 0x68, + 0x12, 0x1d, 0x0a, 0x0a, 0x61, 0x75, 0x74, 0x68, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x61, 0x75, 0x74, 0x68, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, + 0x1e, 0x0a, 0x0a, 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0a, 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, + 0x15, 0x0a, 0x06, 0x74, 0x78, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x05, 0x74, 0x78, 0x6e, 0x49, 0x64, 0x22, 0x31, 0x0a, 0x15, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, + 0x4d, 0x65, 0x74, 0x61, 0x54, 0x78, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x4a, 0x0a, 0x14, 0x47, 0x65, 0x74, + 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x54, 0x72, 0x65, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x04, 0x70, 0x61, 0x74, 0x68, 0x12, 0x1e, 0x0a, 0x0a, 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x61, 0x6c, 0x6c, 0x6f, 0x63, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x9f, 0x01, 0x0a, 0x15, 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6a, + 0x65, 0x63, 0x74, 0x54, 0x72, 0x65, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x48, 0x0a, 0x0e, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x5f, 0x70, 0x61, 0x74, + 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, + 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x65, 0x66, + 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x50, 0x61, 0x74, 0x68, 0x52, 0x0d, 0x72, 0x65, 0x66, 0x65, + 0x72, 0x65, 0x6e, 0x63, 0x65, 0x50, 0x61, 0x74, 0x68, 0x12, 0x3c, 0x0a, 0x09, 0x6c, 0x61, 0x74, + 0x65, 0x73, 0x74, 0x5f, 0x77, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x62, + 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x76, + 0x31, 0x2e, 0x57, 0x72, 0x69, 0x74, 0x65, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x72, 0x52, 0x08, 0x6c, + 0x61, 0x74, 0x65, 0x73, 0x74, 0x57, 0x6d, 0x22, 0x63, 0x0a, 0x17, 0x47, 0x65, 0x74, 0x52, 0x65, + 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x50, 0x61, 0x74, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x70, 0x61, 0x74, 0x68, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x05, 0x70, 0x61, 0x74, 0x68, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x70, 0x61, 0x74, 0x68, 0x12, 0x1e, 0x0a, 0x0a, 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x0a, 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x9d, 0x01, 0x0a, - 0x15, 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x54, 0x72, 0x65, 0x65, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x47, 0x0a, 0x0d, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, - 0x6e, 0x63, 0x65, 0x50, 0x61, 0x74, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, - 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, - 0x76, 0x31, 0x2e, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x50, 0x61, 0x74, 0x68, - 0x52, 0x0d, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x50, 0x61, 0x74, 0x68, 0x12, - 0x3b, 0x0a, 0x08, 0x4c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x57, 0x4d, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x1f, 0x2e, 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, - 0x69, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x57, 0x72, 0x69, 0x74, 0x65, 0x4d, 0x61, 0x72, 0x6b, - 0x65, 0x72, 0x52, 0x08, 0x4c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x57, 0x4d, 0x22, 0xa1, 0x01, 0x0a, - 0x17, 0x47, 0x65, 0x74, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x50, 0x61, 0x74, - 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x3c, 0x0a, 0x07, 0x43, 0x6f, 0x6e, 0x74, - 0x65, 0x78, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x62, 0x6c, 0x6f, 0x62, - 0x62, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x52, 0x07, 0x43, - 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x50, 0x61, 0x74, 0x68, 0x73, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x50, 0x61, 0x74, 0x68, 0x73, 0x12, 0x12, 0x0a, 0x04, - 0x50, 0x61, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x50, 0x61, 0x74, 0x68, - 0x12, 0x1e, 0x0a, 0x0a, 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x22, 0xa0, 0x01, 0x0a, 0x18, 0x47, 0x65, 0x74, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, - 0x65, 0x50, 0x61, 0x74, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x47, 0x0a, - 0x0d, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x50, 0x61, 0x74, 0x68, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x2e, 0x73, - 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, - 0x6e, 0x63, 0x65, 0x50, 0x61, 0x74, 0x68, 0x52, 0x0d, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, - 0x63, 0x65, 0x50, 0x61, 0x74, 0x68, 0x12, 0x3b, 0x0a, 0x08, 0x4c, 0x61, 0x74, 0x65, 0x73, 0x74, - 0x57, 0x4d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x62, 0x6c, 0x6f, 0x62, 0x62, - 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x57, 0x72, - 0x69, 0x74, 0x65, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x72, 0x52, 0x08, 0x4c, 0x61, 0x74, 0x65, 0x73, - 0x74, 0x57, 0x4d, 0x22, 0x7f, 0x0a, 0x0d, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, - 0x50, 0x61, 0x74, 0x68, 0x12, 0x37, 0x0a, 0x08, 0x4d, 0x65, 0x74, 0x61, 0x44, 0x61, 0x74, 0x61, + 0x52, 0x0a, 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0xa2, 0x01, 0x0a, + 0x18, 0x47, 0x65, 0x74, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x50, 0x61, 0x74, + 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x48, 0x0a, 0x0e, 0x72, 0x65, 0x66, + 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x5f, 0x70, 0x61, 0x74, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x21, 0x2e, 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, + 0x69, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, + 0x50, 0x61, 0x74, 0x68, 0x52, 0x0d, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x50, + 0x61, 0x74, 0x68, 0x12, 0x3c, 0x0a, 0x09, 0x6c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x77, 0x6d, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, + 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x57, 0x72, 0x69, 0x74, + 0x65, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x72, 0x52, 0x08, 0x6c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x57, + 0x6d, 0x22, 0x80, 0x01, 0x0a, 0x0d, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x50, + 0x61, 0x74, 0x68, 0x12, 0x38, 0x0a, 0x09, 0x6d, 0x65, 0x74, 0x61, 0x5f, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x46, 0x69, 0x6c, 0x65, - 0x52, 0x65, 0x66, 0x52, 0x08, 0x4d, 0x65, 0x74, 0x61, 0x44, 0x61, 0x74, 0x61, 0x12, 0x35, 0x0a, - 0x04, 0x4c, 0x69, 0x73, 0x74, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x62, 0x6c, + 0x52, 0x65, 0x66, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x44, 0x61, 0x74, 0x61, 0x12, 0x35, 0x0a, + 0x04, 0x6c, 0x69, 0x73, 0x74, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x50, 0x61, 0x74, 0x68, 0x52, 0x04, - 0x4c, 0x69, 0x73, 0x74, 0x22, 0xa4, 0x01, 0x0a, 0x14, 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6a, 0x65, - 0x63, 0x74, 0x50, 0x61, 0x74, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x3c, 0x0a, - 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, - 0x2e, 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, - 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x65, - 0x78, 0x74, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x12, 0x1e, 0x0a, 0x0a, 0x61, - 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x0a, 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x50, - 0x61, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x50, 0x61, 0x74, 0x68, 0x12, - 0x1a, 0x0a, 0x08, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x4e, 0x75, 0x6d, 0x18, 0x04, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x08, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x4e, 0x75, 0x6d, 0x22, 0xa6, 0x01, 0x0a, 0x15, - 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x50, 0x61, 0x74, 0x68, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3e, 0x0a, 0x0a, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x50, - 0x61, 0x74, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x62, 0x6c, 0x6f, 0x62, - 0x62, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4f, - 0x62, 0x6a, 0x65, 0x63, 0x74, 0x50, 0x61, 0x74, 0x68, 0x52, 0x0a, 0x4f, 0x62, 0x6a, 0x65, 0x63, - 0x74, 0x50, 0x61, 0x74, 0x68, 0x12, 0x4d, 0x0a, 0x11, 0x4c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x57, - 0x72, 0x69, 0x74, 0x65, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x1f, 0x2e, 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, - 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x57, 0x72, 0x69, 0x74, 0x65, 0x4d, 0x61, 0x72, 0x6b, 0x65, - 0x72, 0x52, 0x11, 0x4c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x57, 0x72, 0x69, 0x74, 0x65, 0x4d, 0x61, - 0x72, 0x6b, 0x65, 0x72, 0x22, 0xae, 0x01, 0x0a, 0x0a, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x50, - 0x61, 0x74, 0x68, 0x12, 0x1a, 0x0a, 0x08, 0x52, 0x6f, 0x6f, 0x74, 0x48, 0x61, 0x73, 0x68, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x52, 0x6f, 0x6f, 0x74, 0x48, 0x61, 0x73, 0x68, 0x12, - 0x2f, 0x0a, 0x04, 0x4d, 0x65, 0x74, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, - 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, - 0x76, 0x31, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x66, 0x52, 0x04, 0x4d, 0x65, 0x74, 0x61, - 0x12, 0x2f, 0x0a, 0x04, 0x50, 0x61, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, - 0x2e, 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, - 0x2e, 0x76, 0x31, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x66, 0x52, 0x04, 0x50, 0x61, 0x74, - 0x68, 0x12, 0x22, 0x0a, 0x0c, 0x46, 0x69, 0x6c, 0x65, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x4e, 0x75, - 0x6d, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0c, 0x46, 0x69, 0x6c, 0x65, 0x42, 0x6c, 0x6f, - 0x63, 0x6b, 0x4e, 0x75, 0x6d, 0x22, 0x9b, 0x02, 0x0a, 0x0b, 0x57, 0x72, 0x69, 0x74, 0x65, 0x4d, - 0x61, 0x72, 0x6b, 0x65, 0x72, 0x12, 0x26, 0x0a, 0x0e, 0x41, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x52, 0x6f, 0x6f, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x41, - 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x6f, 0x6f, 0x74, 0x12, 0x36, 0x0a, - 0x16, 0x50, 0x72, 0x65, 0x76, 0x69, 0x6f, 0x75, 0x73, 0x41, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x52, 0x6f, 0x6f, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x16, 0x50, - 0x72, 0x65, 0x76, 0x69, 0x6f, 0x75, 0x73, 0x41, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x52, 0x6f, 0x6f, 0x74, 0x12, 0x22, 0x0a, 0x0c, 0x41, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x49, 0x44, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x41, 0x6c, 0x6c, - 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x44, 0x12, 0x12, 0x0a, 0x04, 0x53, 0x69, 0x7a, - 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x1c, 0x0a, - 0x09, 0x42, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x49, 0x44, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x09, 0x42, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x49, 0x44, 0x12, 0x1c, 0x0a, 0x09, 0x54, - 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, - 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, 0x1a, 0x0a, 0x08, 0x43, 0x6c, 0x69, - 0x65, 0x6e, 0x74, 0x49, 0x44, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x43, 0x6c, 0x69, - 0x65, 0x6e, 0x74, 0x49, 0x44, 0x12, 0x1c, 0x0a, 0x09, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, - 0x72, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, - 0x75, 0x72, 0x65, 0x22, 0xc3, 0x01, 0x0a, 0x13, 0x4c, 0x69, 0x73, 0x74, 0x45, 0x6e, 0x74, 0x69, - 0x74, 0x69, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x3c, 0x0a, 0x07, 0x63, - 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x62, + 0x6c, 0x69, 0x73, 0x74, 0x22, 0x67, 0x0a, 0x14, 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6a, 0x65, 0x63, + 0x74, 0x50, 0x61, 0x74, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1e, 0x0a, 0x0a, + 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x0a, 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, + 0x70, 0x61, 0x74, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x70, 0x61, 0x74, 0x68, + 0x12, 0x1b, 0x0a, 0x09, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x6e, 0x75, 0x6d, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x08, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x4e, 0x75, 0x6d, 0x22, 0xa9, 0x01, + 0x0a, 0x15, 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x50, 0x61, 0x74, 0x68, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3f, 0x0a, 0x0b, 0x6f, 0x62, 0x6a, 0x65, 0x63, + 0x74, 0x5f, 0x70, 0x61, 0x74, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x76, - 0x31, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, - 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x74, - 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x70, 0x61, 0x74, 0x68, 0x12, 0x1b, 0x0a, - 0x09, 0x70, 0x61, 0x74, 0x68, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x08, 0x70, 0x61, 0x74, 0x68, 0x48, 0x61, 0x73, 0x68, 0x12, 0x1d, 0x0a, 0x0a, 0x61, 0x75, - 0x74, 0x68, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, - 0x61, 0x75, 0x74, 0x68, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x1e, 0x0a, 0x0a, 0x61, 0x6c, 0x6c, - 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x61, - 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x77, 0x0a, 0x14, 0x4c, 0x69, 0x73, - 0x74, 0x45, 0x6e, 0x74, 0x69, 0x74, 0x69, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x12, 0x26, 0x0a, 0x0e, 0x41, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, - 0x6f, 0x6f, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x41, 0x6c, 0x6c, 0x6f, 0x63, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x6f, 0x6f, 0x74, 0x12, 0x37, 0x0a, 0x08, 0x4d, 0x65, 0x74, - 0x61, 0x44, 0x61, 0x74, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x62, 0x6c, - 0x6f, 0x62, 0x62, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x76, 0x31, - 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x66, 0x52, 0x08, 0x4d, 0x65, 0x74, 0x61, 0x44, 0x61, - 0x74, 0x61, 0x22, 0xa4, 0x01, 0x0a, 0x13, 0x47, 0x65, 0x74, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, - 0x61, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x3c, 0x0a, 0x07, 0x63, 0x6f, - 0x6e, 0x74, 0x65, 0x78, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x62, 0x6c, - 0x6f, 0x62, 0x62, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x76, 0x31, - 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x52, - 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x70, 0x61, 0x74, 0x68, 0x12, 0x1b, 0x0a, 0x09, - 0x70, 0x61, 0x74, 0x68, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x08, 0x70, 0x61, 0x74, 0x68, 0x48, 0x61, 0x73, 0x68, 0x12, 0x1e, 0x0a, 0x0a, 0x61, 0x6c, 0x6c, - 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x61, - 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x84, 0x01, 0x0a, 0x14, 0x47, 0x65, - 0x74, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x61, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x12, 0x37, 0x0a, 0x08, 0x4d, 0x65, 0x74, 0x61, 0x44, 0x61, 0x74, 0x61, 0x18, 0x01, + 0x31, 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x50, 0x61, 0x74, 0x68, 0x52, 0x0a, 0x6f, 0x62, + 0x6a, 0x65, 0x63, 0x74, 0x50, 0x61, 0x74, 0x68, 0x12, 0x4f, 0x0a, 0x13, 0x6c, 0x61, 0x74, 0x65, + 0x73, 0x74, 0x5f, 0x77, 0x72, 0x69, 0x74, 0x65, 0x5f, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x72, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x2e, + 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x57, 0x72, 0x69, 0x74, 0x65, + 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x72, 0x52, 0x11, 0x6c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x57, 0x72, + 0x69, 0x74, 0x65, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x72, 0x22, 0xeb, 0x01, 0x0a, 0x0a, 0x4f, 0x62, + 0x6a, 0x65, 0x63, 0x74, 0x50, 0x61, 0x74, 0x68, 0x12, 0x1b, 0x0a, 0x09, 0x72, 0x6f, 0x6f, 0x74, + 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x72, 0x6f, 0x6f, + 0x74, 0x48, 0x61, 0x73, 0x68, 0x12, 0x2f, 0x0a, 0x04, 0x6d, 0x65, 0x74, 0x61, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x2e, 0x73, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x66, + 0x52, 0x04, 0x6d, 0x65, 0x74, 0x61, 0x12, 0x2f, 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x65, - 0x66, 0x52, 0x08, 0x4d, 0x65, 0x74, 0x61, 0x44, 0x61, 0x74, 0x61, 0x12, 0x33, 0x0a, 0x05, 0x53, - 0x74, 0x61, 0x74, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x62, 0x6c, 0x6f, + 0x66, 0x52, 0x04, 0x70, 0x61, 0x74, 0x68, 0x12, 0x38, 0x0a, 0x09, 0x70, 0x61, 0x74, 0x68, 0x5f, + 0x6c, 0x69, 0x73, 0x74, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, - 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x61, 0x74, 0x73, 0x52, 0x05, 0x53, 0x74, 0x61, 0x74, 0x73, - 0x22, 0x85, 0x03, 0x0a, 0x09, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x61, 0x74, 0x73, 0x12, 0x0e, - 0x0a, 0x02, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x49, 0x44, 0x12, 0x14, - 0x0a, 0x05, 0x52, 0x65, 0x66, 0x49, 0x44, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x52, - 0x65, 0x66, 0x49, 0x44, 0x12, 0x1e, 0x0a, 0x0a, 0x4e, 0x75, 0x6d, 0x55, 0x70, 0x64, 0x61, 0x74, - 0x65, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x4e, 0x75, 0x6d, 0x55, 0x70, 0x64, - 0x61, 0x74, 0x65, 0x73, 0x12, 0x2c, 0x0a, 0x11, 0x4e, 0x75, 0x6d, 0x42, 0x6c, 0x6f, 0x63, 0x6b, - 0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, - 0x11, 0x4e, 0x75, 0x6d, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, - 0x64, 0x73, 0x12, 0x2c, 0x0a, 0x11, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x43, 0x68, 0x61, - 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x11, 0x53, - 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x43, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, 0x73, - 0x12, 0x2a, 0x0a, 0x10, 0x46, 0x61, 0x69, 0x6c, 0x65, 0x64, 0x43, 0x68, 0x61, 0x6c, 0x6c, 0x65, - 0x6e, 0x67, 0x65, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x10, 0x46, 0x61, 0x69, 0x6c, - 0x65, 0x64, 0x43, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, 0x73, 0x12, 0x3a, 0x0a, 0x18, - 0x4c, 0x61, 0x73, 0x74, 0x43, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x54, 0x78, 0x6e, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x18, - 0x4c, 0x61, 0x73, 0x74, 0x43, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x54, 0x78, 0x6e, 0x12, 0x32, 0x0a, 0x14, 0x57, 0x72, 0x69, 0x74, + 0x46, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x66, 0x52, 0x08, 0x70, 0x61, 0x74, 0x68, 0x4c, 0x69, 0x73, + 0x74, 0x12, 0x24, 0x0a, 0x0e, 0x66, 0x69, 0x6c, 0x65, 0x5f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, + 0x6e, 0x75, 0x6d, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0c, 0x66, 0x69, 0x6c, 0x65, 0x42, + 0x6c, 0x6f, 0x63, 0x6b, 0x4e, 0x75, 0x6d, 0x22, 0xa1, 0x02, 0x0a, 0x0b, 0x57, 0x72, 0x69, 0x74, + 0x65, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x72, 0x12, 0x27, 0x0a, 0x0f, 0x61, 0x6c, 0x6c, 0x6f, 0x63, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x72, 0x6f, 0x6f, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x0e, 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x6f, 0x6f, 0x74, + 0x12, 0x38, 0x0a, 0x18, 0x70, 0x72, 0x65, 0x76, 0x69, 0x6f, 0x75, 0x73, 0x5f, 0x61, 0x6c, 0x6c, + 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x72, 0x6f, 0x6f, 0x74, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x16, 0x70, 0x72, 0x65, 0x76, 0x69, 0x6f, 0x75, 0x73, 0x41, 0x6c, 0x6c, 0x6f, + 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x6f, 0x6f, 0x74, 0x12, 0x23, 0x0a, 0x0d, 0x61, 0x6c, + 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x0c, 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, + 0x12, 0x0a, 0x04, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x73, + 0x69, 0x7a, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x5f, 0x69, + 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, + 0x49, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, + 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, + 0x12, 0x1b, 0x0a, 0x09, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x07, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x08, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x12, 0x1c, 0x0a, + 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x22, 0x85, 0x01, 0x0a, 0x13, + 0x4c, 0x69, 0x73, 0x74, 0x45, 0x6e, 0x74, 0x69, 0x74, 0x69, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x04, 0x70, 0x61, 0x74, 0x68, 0x12, 0x1b, 0x0a, 0x09, 0x70, 0x61, 0x74, 0x68, 0x5f, + 0x68, 0x61, 0x73, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x61, 0x74, 0x68, + 0x48, 0x61, 0x73, 0x68, 0x12, 0x1d, 0x0a, 0x0a, 0x61, 0x75, 0x74, 0x68, 0x5f, 0x74, 0x6f, 0x6b, + 0x65, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x61, 0x75, 0x74, 0x68, 0x54, 0x6f, + 0x6b, 0x65, 0x6e, 0x12, 0x1e, 0x0a, 0x0a, 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x22, 0xb2, 0x01, 0x0a, 0x14, 0x4c, 0x69, 0x73, 0x74, 0x45, 0x6e, 0x74, 0x69, + 0x74, 0x69, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x27, 0x0a, 0x0f, + 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x72, 0x6f, 0x6f, 0x74, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x52, 0x6f, 0x6f, 0x74, 0x12, 0x38, 0x0a, 0x09, 0x6d, 0x65, 0x74, 0x61, 0x5f, 0x64, 0x61, + 0x74, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x62, 0x6c, 0x6f, 0x62, 0x62, + 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x46, 0x69, + 0x6c, 0x65, 0x52, 0x65, 0x66, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x44, 0x61, 0x74, 0x61, 0x12, + 0x37, 0x0a, 0x08, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x69, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, + 0x0b, 0x32, 0x1b, 0x2e, 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, + 0x69, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x66, 0x52, 0x08, + 0x65, 0x6e, 0x74, 0x69, 0x74, 0x69, 0x65, 0x73, 0x22, 0x66, 0x0a, 0x13, 0x47, 0x65, 0x74, 0x46, + 0x69, 0x6c, 0x65, 0x53, 0x74, 0x61, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, + 0x12, 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x70, + 0x61, 0x74, 0x68, 0x12, 0x1b, 0x0a, 0x09, 0x70, 0x61, 0x74, 0x68, 0x5f, 0x68, 0x61, 0x73, 0x68, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x61, 0x74, 0x68, 0x48, 0x61, 0x73, 0x68, + 0x12, 0x1e, 0x0a, 0x0a, 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x22, 0x85, 0x01, 0x0a, 0x14, 0x47, 0x65, 0x74, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x61, 0x74, + 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x38, 0x0a, 0x09, 0x6d, 0x65, 0x74, + 0x61, 0x5f, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x62, + 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x76, + 0x31, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x66, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x44, + 0x61, 0x74, 0x61, 0x12, 0x33, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x73, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x61, 0x74, + 0x73, 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x73, 0x22, 0x93, 0x03, 0x0a, 0x09, 0x46, 0x69, 0x6c, + 0x65, 0x53, 0x74, 0x61, 0x74, 0x73, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x03, 0x52, 0x02, 0x69, 0x64, 0x12, 0x15, 0x0a, 0x06, 0x72, 0x65, 0x66, 0x5f, 0x69, 0x64, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x72, 0x65, 0x66, 0x49, 0x64, 0x12, 0x1f, 0x0a, + 0x0b, 0x6e, 0x75, 0x6d, 0x5f, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x73, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x03, 0x52, 0x0a, 0x6e, 0x75, 0x6d, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x73, 0x12, 0x2e, + 0x0a, 0x13, 0x6e, 0x75, 0x6d, 0x5f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x64, 0x6f, 0x77, 0x6e, + 0x6c, 0x6f, 0x61, 0x64, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x11, 0x6e, 0x75, 0x6d, + 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x73, 0x12, 0x2d, + 0x0a, 0x12, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x5f, 0x63, 0x68, 0x61, 0x6c, 0x6c, 0x65, + 0x6e, 0x67, 0x65, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x11, 0x73, 0x75, 0x63, 0x63, + 0x65, 0x73, 0x73, 0x43, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, 0x73, 0x12, 0x2b, 0x0a, + 0x11, 0x66, 0x61, 0x69, 0x6c, 0x65, 0x64, 0x5f, 0x63, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, + 0x65, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x10, 0x66, 0x61, 0x69, 0x6c, 0x65, 0x64, + 0x43, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, 0x73, 0x12, 0x3d, 0x0a, 0x1b, 0x6c, 0x61, + 0x73, 0x74, 0x5f, 0x63, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, 0x5f, 0x72, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x5f, 0x74, 0x78, 0x6e, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x18, 0x6c, 0x61, 0x73, 0x74, 0x43, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x54, 0x78, 0x6e, 0x12, 0x35, 0x0a, 0x17, 0x77, 0x72, 0x69, + 0x74, 0x65, 0x5f, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x72, 0x5f, 0x72, 0x65, 0x64, 0x65, 0x65, 0x6d, + 0x5f, 0x74, 0x78, 0x6e, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x14, 0x77, 0x72, 0x69, 0x74, 0x65, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x72, 0x52, 0x65, 0x64, 0x65, 0x65, 0x6d, 0x54, 0x78, 0x6e, - 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x14, 0x57, 0x72, 0x69, 0x74, 0x65, 0x4d, 0x61, 0x72, - 0x6b, 0x65, 0x72, 0x52, 0x65, 0x64, 0x65, 0x65, 0x6d, 0x54, 0x78, 0x6e, 0x12, 0x1c, 0x0a, 0x09, - 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x18, 0x09, 0x20, 0x01, 0x28, 0x03, 0x52, - 0x09, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x55, 0x70, - 0x64, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x55, - 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x22, 0xc6, 0x01, 0x0a, 0x16, 0x47, 0x65, 0x74, - 0x46, 0x69, 0x6c, 0x65, 0x4d, 0x65, 0x74, 0x61, 0x44, 0x61, 0x74, 0x61, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x12, 0x3c, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x2e, 0x73, - 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, - 0x74, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x12, 0x1d, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x09, + 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x12, + 0x1d, 0x0a, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x0a, 0x20, + 0x01, 0x28, 0x03, 0x52, 0x09, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x22, 0x88, + 0x01, 0x0a, 0x16, 0x47, 0x65, 0x74, 0x46, 0x69, 0x6c, 0x65, 0x4d, 0x65, 0x74, 0x61, 0x44, 0x61, + 0x74, 0x61, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x74, + 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x70, 0x61, 0x74, 0x68, 0x12, 0x1b, 0x0a, + 0x09, 0x70, 0x61, 0x74, 0x68, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x08, 0x70, 0x61, 0x74, 0x68, 0x48, 0x61, 0x73, 0x68, 0x12, 0x1d, 0x0a, 0x0a, 0x61, 0x75, + 0x74, 0x68, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, + 0x61, 0x75, 0x74, 0x68, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x1e, 0x0a, 0x0a, 0x61, 0x6c, 0x6c, + 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x61, + 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x9b, 0x01, 0x0a, 0x17, 0x47, 0x65, + 0x74, 0x46, 0x69, 0x6c, 0x65, 0x4d, 0x65, 0x74, 0x61, 0x44, 0x61, 0x74, 0x61, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x38, 0x0a, 0x09, 0x6d, 0x65, 0x74, 0x61, 0x5f, 0x64, 0x61, + 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x62, 0x6c, 0x6f, 0x62, 0x62, + 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x46, 0x69, + 0x6c, 0x65, 0x52, 0x65, 0x66, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x44, 0x61, 0x74, 0x61, 0x12, + 0x46, 0x0a, 0x0d, 0x63, 0x6f, 0x6c, 0x6c, 0x61, 0x62, 0x6f, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x73, + 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, + 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x6f, 0x6c, 0x6c, + 0x61, 0x62, 0x6f, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x52, 0x0d, 0x63, 0x6f, 0x6c, 0x6c, 0x61, 0x62, + 0x6f, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x73, 0x22, 0x5c, 0x0a, 0x0d, 0x43, 0x6f, 0x6d, 0x6d, 0x69, + 0x74, 0x4d, 0x65, 0x74, 0x61, 0x54, 0x78, 0x6e, 0x12, 0x15, 0x0a, 0x06, 0x72, 0x65, 0x66, 0x5f, + 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x72, 0x65, 0x66, 0x49, 0x64, 0x12, + 0x15, 0x0a, 0x06, 0x74, 0x78, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x05, 0x74, 0x78, 0x6e, 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, + 0x64, 0x5f, 0x61, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x63, 0x72, 0x65, 0x61, + 0x74, 0x65, 0x64, 0x41, 0x74, 0x22, 0x61, 0x0a, 0x0c, 0x43, 0x6f, 0x6c, 0x6c, 0x61, 0x62, 0x6f, + 0x72, 0x61, 0x74, 0x6f, 0x72, 0x12, 0x15, 0x0a, 0x06, 0x72, 0x65, 0x66, 0x5f, 0x69, 0x64, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x72, 0x65, 0x66, 0x49, 0x64, 0x12, 0x1b, 0x0a, 0x09, + 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x08, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x63, 0x72, 0x65, + 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x63, + 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x22, 0x26, 0x0a, 0x14, 0x47, 0x65, 0x74, 0x41, + 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, + 0x22, 0x57, 0x0a, 0x15, 0x47, 0x65, 0x74, 0x41, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3e, 0x0a, 0x0a, 0x61, 0x6c, 0x6c, + 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, + 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, + 0x76, 0x31, 0x2e, 0x41, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0a, 0x61, + 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x93, 0x02, 0x0a, 0x13, 0x44, 0x6f, + 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x12, 0x1e, 0x0a, 0x0a, 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x70, 0x61, 0x74, 0x68, 0x12, 0x1b, 0x0a, 0x09, 0x70, 0x61, 0x74, 0x68, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x61, 0x74, 0x68, 0x48, 0x61, - 0x73, 0x68, 0x12, 0x1d, 0x0a, 0x0a, 0x61, 0x75, 0x74, 0x68, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, - 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x61, 0x75, 0x74, 0x68, 0x54, 0x6f, 0x6b, 0x65, - 0x6e, 0x12, 0x1e, 0x0a, 0x0a, 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, - 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x22, 0x9a, 0x01, 0x0a, 0x17, 0x47, 0x65, 0x74, 0x46, 0x69, 0x6c, 0x65, 0x4d, 0x65, 0x74, - 0x61, 0x44, 0x61, 0x74, 0x61, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x37, 0x0a, - 0x08, 0x4d, 0x65, 0x74, 0x61, 0x44, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x1b, 0x2e, 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, - 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x66, 0x52, 0x08, 0x4d, 0x65, - 0x74, 0x61, 0x44, 0x61, 0x74, 0x61, 0x12, 0x46, 0x0a, 0x0d, 0x43, 0x6f, 0x6c, 0x6c, 0x61, 0x62, - 0x6f, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x20, 0x2e, - 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, - 0x76, 0x31, 0x2e, 0x43, 0x6f, 0x6c, 0x6c, 0x61, 0x62, 0x6f, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x52, - 0x0d, 0x43, 0x6f, 0x6c, 0x6c, 0x61, 0x62, 0x6f, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x73, 0x22, 0x59, - 0x0a, 0x0d, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x54, 0x78, 0x6e, 0x12, - 0x14, 0x0a, 0x05, 0x52, 0x65, 0x66, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, - 0x52, 0x65, 0x66, 0x49, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x54, 0x78, 0x6e, 0x49, 0x64, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x54, 0x78, 0x6e, 0x49, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x43, - 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, - 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x22, 0x5e, 0x0a, 0x0c, 0x43, 0x6f, 0x6c, - 0x6c, 0x61, 0x62, 0x6f, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x52, 0x65, 0x66, - 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x52, 0x65, 0x66, 0x49, 0x64, 0x12, - 0x1a, 0x0a, 0x08, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x08, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x43, - 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, - 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x22, 0x67, 0x0a, 0x0e, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x63, - 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x63, 0x6c, 0x69, - 0x65, 0x6e, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x6b, 0x65, - 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x4b, - 0x65, 0x79, 0x12, 0x1e, 0x0a, 0x0a, 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x22, 0x64, 0x0a, 0x14, 0x47, 0x65, 0x74, 0x41, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x3c, 0x0a, 0x07, 0x63, 0x6f, - 0x6e, 0x74, 0x65, 0x78, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x62, 0x6c, - 0x6f, 0x62, 0x62, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x76, 0x31, - 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x52, - 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, 0x57, 0x0a, 0x15, 0x47, 0x65, 0x74, 0x41, - 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x12, 0x3e, 0x0a, 0x0a, 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x2e, - 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x6c, 0x6c, 0x6f, 0x63, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0a, 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x22, 0xd6, 0x04, 0x0a, 0x0a, 0x41, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x12, 0x0e, 0x0a, 0x02, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x49, 0x44, - 0x12, 0x0e, 0x0a, 0x02, 0x54, 0x78, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x54, 0x78, - 0x12, 0x1c, 0x0a, 0x09, 0x54, 0x6f, 0x74, 0x61, 0x6c, 0x53, 0x69, 0x7a, 0x65, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x03, 0x52, 0x09, 0x54, 0x6f, 0x74, 0x61, 0x6c, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x1a, - 0x0a, 0x08, 0x55, 0x73, 0x65, 0x64, 0x53, 0x69, 0x7a, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, - 0x52, 0x08, 0x55, 0x73, 0x65, 0x64, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x4f, 0x77, - 0x6e, 0x65, 0x72, 0x49, 0x44, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x4f, 0x77, 0x6e, - 0x65, 0x72, 0x49, 0x44, 0x12, 0x26, 0x0a, 0x0e, 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x50, 0x75, 0x62, - 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x4f, 0x77, - 0x6e, 0x65, 0x72, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x12, 0x1e, 0x0a, 0x0a, - 0x52, 0x65, 0x70, 0x61, 0x69, 0x72, 0x65, 0x72, 0x49, 0x44, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x0a, 0x52, 0x65, 0x70, 0x61, 0x69, 0x72, 0x65, 0x72, 0x49, 0x44, 0x12, 0x18, 0x0a, 0x07, - 0x50, 0x61, 0x79, 0x65, 0x72, 0x49, 0x44, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x50, - 0x61, 0x79, 0x65, 0x72, 0x49, 0x44, 0x12, 0x1e, 0x0a, 0x0a, 0x45, 0x78, 0x70, 0x69, 0x72, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x09, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x45, 0x78, 0x70, 0x69, - 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x26, 0x0a, 0x0e, 0x41, 0x6c, 0x6c, 0x6f, 0x63, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x6f, 0x6f, 0x74, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, - 0x41, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x6f, 0x6f, 0x74, 0x12, 0x20, - 0x0a, 0x0b, 0x42, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x53, 0x69, 0x7a, 0x65, 0x18, 0x0b, 0x20, - 0x01, 0x28, 0x03, 0x52, 0x0b, 0x42, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x53, 0x69, 0x7a, 0x65, - 0x12, 0x28, 0x0a, 0x0f, 0x42, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x53, 0x69, 0x7a, 0x65, 0x55, - 0x73, 0x65, 0x64, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0f, 0x42, 0x6c, 0x6f, 0x62, 0x62, - 0x65, 0x72, 0x53, 0x69, 0x7a, 0x65, 0x55, 0x73, 0x65, 0x64, 0x12, 0x2a, 0x0a, 0x10, 0x4c, 0x61, - 0x74, 0x65, 0x73, 0x74, 0x52, 0x65, 0x64, 0x65, 0x65, 0x6d, 0x65, 0x64, 0x57, 0x4d, 0x18, 0x0d, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x4c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x52, 0x65, 0x64, 0x65, - 0x65, 0x6d, 0x65, 0x64, 0x57, 0x4d, 0x12, 0x2a, 0x0a, 0x10, 0x49, 0x73, 0x52, 0x65, 0x64, 0x65, - 0x65, 0x6d, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x08, - 0x52, 0x10, 0x49, 0x73, 0x52, 0x65, 0x64, 0x65, 0x65, 0x6d, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, - 0x65, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x54, 0x69, 0x6d, 0x65, 0x55, 0x6e, 0x69, 0x74, 0x18, 0x0f, - 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x54, 0x69, 0x6d, 0x65, 0x55, 0x6e, 0x69, 0x74, 0x12, 0x1c, - 0x0a, 0x09, 0x43, 0x6c, 0x65, 0x61, 0x6e, 0x65, 0x64, 0x55, 0x70, 0x18, 0x10, 0x20, 0x01, 0x28, - 0x08, 0x52, 0x09, 0x43, 0x6c, 0x65, 0x61, 0x6e, 0x65, 0x64, 0x55, 0x70, 0x12, 0x1c, 0x0a, 0x09, - 0x46, 0x69, 0x6e, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x64, 0x18, 0x11, 0x20, 0x01, 0x28, 0x08, 0x52, - 0x09, 0x46, 0x69, 0x6e, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x64, 0x12, 0x2e, 0x0a, 0x05, 0x54, 0x65, - 0x72, 0x6d, 0x73, 0x18, 0x12, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x62, 0x6c, 0x6f, 0x62, - 0x62, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x54, - 0x65, 0x72, 0x6d, 0x52, 0x05, 0x54, 0x65, 0x72, 0x6d, 0x73, 0x22, 0x96, 0x01, 0x0a, 0x04, 0x54, - 0x65, 0x72, 0x6d, 0x12, 0x0e, 0x0a, 0x02, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, - 0x02, 0x49, 0x44, 0x12, 0x1c, 0x0a, 0x09, 0x42, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x49, 0x44, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x42, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x49, - 0x44, 0x12, 0x22, 0x0a, 0x0c, 0x41, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, - 0x44, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x41, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x49, 0x44, 0x12, 0x1c, 0x0a, 0x09, 0x52, 0x65, 0x61, 0x64, 0x50, 0x72, 0x69, - 0x63, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x52, 0x65, 0x61, 0x64, 0x50, 0x72, - 0x69, 0x63, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x57, 0x72, 0x69, 0x74, 0x65, 0x50, 0x72, 0x69, 0x63, - 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x57, 0x72, 0x69, 0x74, 0x65, 0x50, 0x72, - 0x69, 0x63, 0x65, 0x22, 0xa6, 0x01, 0x0a, 0x07, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x66, 0x12, - 0x12, 0x0a, 0x04, 0x54, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x54, - 0x79, 0x70, 0x65, 0x12, 0x44, 0x0a, 0x0c, 0x46, 0x69, 0x6c, 0x65, 0x4d, 0x65, 0x74, 0x61, 0x44, - 0x61, 0x74, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x62, 0x6c, 0x6f, 0x62, - 0x62, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x46, - 0x69, 0x6c, 0x65, 0x4d, 0x65, 0x74, 0x61, 0x44, 0x61, 0x74, 0x61, 0x52, 0x0c, 0x46, 0x69, 0x6c, - 0x65, 0x4d, 0x65, 0x74, 0x61, 0x44, 0x61, 0x74, 0x61, 0x12, 0x41, 0x0a, 0x0b, 0x44, 0x69, 0x72, - 0x4d, 0x65, 0x74, 0x61, 0x44, 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, - 0x2e, 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, - 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x69, 0x72, 0x4d, 0x65, 0x74, 0x61, 0x44, 0x61, 0x74, 0x61, 0x52, - 0x0b, 0x44, 0x69, 0x72, 0x4d, 0x65, 0x74, 0x61, 0x44, 0x61, 0x74, 0x61, 0x22, 0xaf, 0x06, 0x0a, - 0x0c, 0x46, 0x69, 0x6c, 0x65, 0x4d, 0x65, 0x74, 0x61, 0x44, 0x61, 0x74, 0x61, 0x12, 0x12, 0x0a, - 0x04, 0x54, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x54, 0x79, 0x70, - 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x4c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x48, 0x61, 0x73, 0x68, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x4c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x48, 0x61, 0x73, - 0x68, 0x12, 0x12, 0x0a, 0x04, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x04, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x50, 0x61, 0x74, 0x68, 0x18, 0x04, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x04, 0x50, 0x61, 0x74, 0x68, 0x12, 0x12, 0x0a, 0x04, 0x48, 0x61, 0x73, - 0x68, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x48, 0x61, 0x73, 0x68, 0x12, 0x1c, 0x0a, - 0x09, 0x4e, 0x75, 0x6d, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, - 0x52, 0x09, 0x4e, 0x75, 0x6d, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x50, - 0x61, 0x74, 0x68, 0x48, 0x61, 0x73, 0x68, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x50, - 0x61, 0x74, 0x68, 0x48, 0x61, 0x73, 0x68, 0x12, 0x1e, 0x0a, 0x0a, 0x43, 0x75, 0x73, 0x74, 0x6f, - 0x6d, 0x4d, 0x65, 0x74, 0x61, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x43, 0x75, 0x73, - 0x74, 0x6f, 0x6d, 0x4d, 0x65, 0x74, 0x61, 0x12, 0x20, 0x0a, 0x0b, 0x43, 0x6f, 0x6e, 0x74, 0x65, - 0x6e, 0x74, 0x48, 0x61, 0x73, 0x68, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x43, 0x6f, - 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x48, 0x61, 0x73, 0x68, 0x12, 0x12, 0x0a, 0x04, 0x53, 0x69, 0x7a, - 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x1e, 0x0a, - 0x0a, 0x4d, 0x65, 0x72, 0x6b, 0x6c, 0x65, 0x52, 0x6f, 0x6f, 0x74, 0x18, 0x0b, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x0a, 0x4d, 0x65, 0x72, 0x6b, 0x6c, 0x65, 0x52, 0x6f, 0x6f, 0x74, 0x12, 0x26, 0x0a, - 0x0e, 0x41, 0x63, 0x74, 0x75, 0x61, 0x6c, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x18, - 0x0c, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0e, 0x41, 0x63, 0x74, 0x75, 0x61, 0x6c, 0x46, 0x69, 0x6c, - 0x65, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x26, 0x0a, 0x0e, 0x41, 0x63, 0x74, 0x75, 0x61, 0x6c, 0x46, - 0x69, 0x6c, 0x65, 0x48, 0x61, 0x73, 0x68, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x41, - 0x63, 0x74, 0x75, 0x61, 0x6c, 0x46, 0x69, 0x6c, 0x65, 0x48, 0x61, 0x73, 0x68, 0x12, 0x1a, 0x0a, - 0x08, 0x4d, 0x69, 0x6d, 0x65, 0x54, 0x79, 0x70, 0x65, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x08, 0x4d, 0x69, 0x6d, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x24, 0x0a, 0x0d, 0x54, 0x68, 0x75, - 0x6d, 0x62, 0x6e, 0x61, 0x69, 0x6c, 0x53, 0x69, 0x7a, 0x65, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x03, - 0x52, 0x0d, 0x54, 0x68, 0x75, 0x6d, 0x62, 0x6e, 0x61, 0x69, 0x6c, 0x53, 0x69, 0x7a, 0x65, 0x12, - 0x24, 0x0a, 0x0d, 0x54, 0x68, 0x75, 0x6d, 0x62, 0x6e, 0x61, 0x69, 0x6c, 0x48, 0x61, 0x73, 0x68, - 0x18, 0x10, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x54, 0x68, 0x75, 0x6d, 0x62, 0x6e, 0x61, 0x69, - 0x6c, 0x48, 0x61, 0x73, 0x68, 0x12, 0x30, 0x0a, 0x13, 0x41, 0x63, 0x74, 0x75, 0x61, 0x6c, 0x54, - 0x68, 0x75, 0x6d, 0x62, 0x6e, 0x61, 0x69, 0x6c, 0x53, 0x69, 0x7a, 0x65, 0x18, 0x11, 0x20, 0x01, - 0x28, 0x03, 0x52, 0x13, 0x41, 0x63, 0x74, 0x75, 0x61, 0x6c, 0x54, 0x68, 0x75, 0x6d, 0x62, 0x6e, - 0x61, 0x69, 0x6c, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x30, 0x0a, 0x13, 0x41, 0x63, 0x74, 0x75, 0x61, - 0x6c, 0x54, 0x68, 0x75, 0x6d, 0x62, 0x6e, 0x61, 0x69, 0x6c, 0x48, 0x61, 0x73, 0x68, 0x18, 0x12, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x13, 0x41, 0x63, 0x74, 0x75, 0x61, 0x6c, 0x54, 0x68, 0x75, 0x6d, - 0x62, 0x6e, 0x61, 0x69, 0x6c, 0x48, 0x61, 0x73, 0x68, 0x12, 0x22, 0x0a, 0x0c, 0x45, 0x6e, 0x63, - 0x72, 0x79, 0x70, 0x74, 0x65, 0x64, 0x4b, 0x65, 0x79, 0x18, 0x13, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x0c, 0x45, 0x6e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x65, 0x64, 0x4b, 0x65, 0x79, 0x12, 0x1e, 0x0a, - 0x0a, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x18, 0x14, 0x20, 0x01, 0x28, - 0x0c, 0x52, 0x0a, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x12, 0x18, 0x0a, - 0x07, 0x4f, 0x6e, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x18, 0x15, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, - 0x4f, 0x6e, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x12, 0x49, 0x0a, 0x0e, 0x43, 0x6f, 0x6d, 0x6d, 0x69, - 0x74, 0x4d, 0x65, 0x74, 0x61, 0x54, 0x78, 0x6e, 0x73, 0x18, 0x16, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x21, 0x2e, 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, - 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x54, - 0x78, 0x6e, 0x52, 0x0e, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x54, 0x78, - 0x6e, 0x73, 0x12, 0x1c, 0x0a, 0x09, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x18, - 0x17, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, - 0x12, 0x1c, 0x0a, 0x09, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x18, 0x18, 0x20, - 0x01, 0x28, 0x03, 0x52, 0x09, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x22, 0xc0, - 0x02, 0x0a, 0x0b, 0x44, 0x69, 0x72, 0x4d, 0x65, 0x74, 0x61, 0x44, 0x61, 0x74, 0x61, 0x12, 0x12, - 0x0a, 0x04, 0x54, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x54, 0x79, - 0x70, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x4c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x48, 0x61, 0x73, 0x68, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x4c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x48, 0x61, - 0x73, 0x68, 0x12, 0x12, 0x0a, 0x04, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x04, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x50, 0x61, 0x74, 0x68, 0x18, 0x04, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x50, 0x61, 0x74, 0x68, 0x12, 0x12, 0x0a, 0x04, 0x48, 0x61, - 0x73, 0x68, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x48, 0x61, 0x73, 0x68, 0x12, 0x1c, - 0x0a, 0x09, 0x4e, 0x75, 0x6d, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, - 0x03, 0x52, 0x09, 0x4e, 0x75, 0x6d, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x12, 0x1a, 0x0a, 0x08, - 0x50, 0x61, 0x74, 0x68, 0x48, 0x61, 0x73, 0x68, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, - 0x50, 0x61, 0x74, 0x68, 0x48, 0x61, 0x73, 0x68, 0x12, 0x12, 0x0a, 0x04, 0x53, 0x69, 0x7a, 0x65, - 0x18, 0x08, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x1c, 0x0a, 0x09, - 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x18, 0x09, 0x20, 0x01, 0x28, 0x03, 0x52, - 0x09, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x55, 0x70, - 0x64, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x55, - 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x12, 0x37, 0x0a, 0x08, 0x43, 0x68, 0x69, 0x6c, - 0x64, 0x72, 0x65, 0x6e, 0x18, 0x0b, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x62, 0x6c, 0x6f, - 0x62, 0x62, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, - 0x46, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x66, 0x52, 0x08, 0x43, 0x68, 0x69, 0x6c, 0x64, 0x72, 0x65, - 0x6e, 0x32, 0xe8, 0x07, 0x0a, 0x07, 0x42, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x12, 0x7c, 0x0a, - 0x0d, 0x47, 0x65, 0x74, 0x41, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x28, - 0x2e, 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, - 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x41, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x29, 0x2e, 0x62, 0x6c, 0x6f, 0x62, 0x62, - 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, - 0x74, 0x41, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x22, 0x16, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x10, 0x12, 0x0e, 0x2f, 0x76, 0x32, - 0x2f, 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x8e, 0x01, 0x0a, 0x0f, - 0x47, 0x65, 0x74, 0x46, 0x69, 0x6c, 0x65, 0x4d, 0x65, 0x74, 0x61, 0x44, 0x61, 0x74, 0x61, 0x12, - 0x2a, 0x2e, 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, - 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x46, 0x69, 0x6c, 0x65, 0x4d, 0x65, 0x74, 0x61, - 0x44, 0x61, 0x74, 0x61, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2b, 0x2e, 0x62, 0x6c, + 0x73, 0x68, 0x12, 0x15, 0x0a, 0x06, 0x72, 0x78, 0x5f, 0x70, 0x61, 0x79, 0x18, 0x04, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x05, 0x72, 0x78, 0x50, 0x61, 0x79, 0x12, 0x1b, 0x0a, 0x09, 0x62, 0x6c, 0x6f, + 0x63, 0x6b, 0x5f, 0x6e, 0x75, 0x6d, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x62, 0x6c, + 0x6f, 0x63, 0x6b, 0x4e, 0x75, 0x6d, 0x12, 0x1d, 0x0a, 0x0a, 0x6e, 0x75, 0x6d, 0x5f, 0x62, 0x6c, + 0x6f, 0x63, 0x6b, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6e, 0x75, 0x6d, 0x42, + 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x12, 0x1f, 0x0a, 0x0b, 0x72, 0x65, 0x61, 0x64, 0x5f, 0x6d, 0x61, + 0x72, 0x6b, 0x65, 0x72, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x72, 0x65, 0x61, 0x64, + 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x72, 0x12, 0x1d, 0x0a, 0x0a, 0x61, 0x75, 0x74, 0x68, 0x5f, 0x74, + 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x61, 0x75, 0x74, 0x68, + 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, + 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x22, + 0xb9, 0x01, 0x0a, 0x14, 0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x46, 0x69, 0x6c, 0x65, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 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, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, + 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x12, 0x23, 0x0a, 0x0d, 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x61, + 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x70, + 0x61, 0x74, 0x68, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x70, 0x61, 0x74, 0x68, 0x12, + 0x3a, 0x0a, 0x09, 0x6c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x72, 0x6d, 0x18, 0x05, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x65, 0x61, 0x64, 0x4d, 0x61, 0x6b, 0x65, + 0x72, 0x52, 0x08, 0x6c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x52, 0x6d, 0x22, 0xdf, 0x02, 0x0a, 0x09, + 0x52, 0x65, 0x61, 0x64, 0x4d, 0x61, 0x6b, 0x65, 0x72, 0x12, 0x1b, 0x0a, 0x09, 0x63, 0x6c, 0x69, + 0x65, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x63, 0x6c, + 0x69, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x12, 0x2a, 0x0a, 0x11, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, + 0x5f, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x0f, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, + 0x65, 0x79, 0x12, 0x1d, 0x0a, 0x0a, 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x5f, 0x69, 0x64, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x49, + 0x64, 0x12, 0x23, 0x0a, 0x0d, 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, + 0x69, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x19, 0x0a, 0x08, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x5f, + 0x69, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x49, + 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x06, + 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, + 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x18, 0x07, 0x20, 0x01, 0x28, 0x03, + 0x52, 0x07, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x69, 0x67, + 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x69, + 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x75, 0x73, 0x70, 0x65, + 0x6e, 0x64, 0x18, 0x09, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x73, 0x75, 0x73, 0x70, 0x65, 0x6e, + 0x64, 0x12, 0x19, 0x0a, 0x08, 0x70, 0x61, 0x79, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x0a, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x07, 0x70, 0x61, 0x79, 0x65, 0x72, 0x49, 0x64, 0x12, 0x1f, 0x0a, 0x0b, + 0x61, 0x75, 0x74, 0x68, 0x5f, 0x74, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x18, 0x0b, 0x20, 0x01, 0x28, + 0x0c, 0x52, 0x0a, 0x61, 0x75, 0x74, 0x68, 0x54, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x22, 0xb5, 0x01, + 0x0a, 0x1d, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x41, 0x74, + 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, + 0x1e, 0x0a, 0x0a, 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0a, 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, + 0x12, 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x70, + 0x61, 0x74, 0x68, 0x12, 0x1b, 0x0a, 0x09, 0x70, 0x61, 0x74, 0x68, 0x5f, 0x68, 0x61, 0x73, 0x68, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x61, 0x74, 0x68, 0x48, 0x61, 0x73, 0x68, + 0x12, 0x23, 0x0a, 0x0d, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, + 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, + 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, + 0x74, 0x65, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, + 0x62, 0x75, 0x74, 0x65, 0x73, 0x22, 0x4d, 0x0a, 0x1e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4f, + 0x62, 0x6a, 0x65, 0x63, 0x74, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2b, 0x0a, 0x12, 0x77, 0x68, 0x6f, 0x5f, 0x70, + 0x61, 0x79, 0x73, 0x5f, 0x66, 0x6f, 0x72, 0x5f, 0x72, 0x65, 0x61, 0x64, 0x73, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x03, 0x52, 0x0f, 0x77, 0x68, 0x6f, 0x50, 0x61, 0x79, 0x73, 0x46, 0x6f, 0x72, 0x52, + 0x65, 0x61, 0x64, 0x73, 0x22, 0x9d, 0x01, 0x0a, 0x11, 0x43, 0x6f, 0x70, 0x79, 0x4f, 0x62, 0x6a, + 0x65, 0x63, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1e, 0x0a, 0x0a, 0x61, 0x6c, + 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, + 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, + 0x74, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x70, 0x61, 0x74, 0x68, 0x12, 0x1b, + 0x0a, 0x09, 0x70, 0x61, 0x74, 0x68, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x08, 0x70, 0x61, 0x74, 0x68, 0x48, 0x61, 0x73, 0x68, 0x12, 0x23, 0x0a, 0x0d, 0x63, + 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x04, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x0c, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, + 0x12, 0x12, 0x0a, 0x04, 0x64, 0x65, 0x73, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, + 0x64, 0x65, 0x73, 0x74, 0x22, 0xd2, 0x01, 0x0a, 0x12, 0x43, 0x6f, 0x70, 0x79, 0x4f, 0x62, 0x6a, + 0x65, 0x63, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x66, + 0x69, 0x6c, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x66, + 0x69, 0x6c, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x69, 0x7a, 0x65, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x73, 0x69, 0x7a, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x63, + 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x0b, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x48, 0x61, 0x73, 0x68, 0x12, 0x1f, + 0x0a, 0x0b, 0x6d, 0x65, 0x72, 0x6b, 0x6c, 0x65, 0x5f, 0x72, 0x6f, 0x6f, 0x74, 0x18, 0x04, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0a, 0x6d, 0x65, 0x72, 0x6b, 0x6c, 0x65, 0x52, 0x6f, 0x6f, 0x74, 0x12, + 0x23, 0x0a, 0x0d, 0x75, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, + 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0c, 0x75, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x4c, 0x65, + 0x6e, 0x67, 0x74, 0x68, 0x12, 0x23, 0x0a, 0x0d, 0x75, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x5f, 0x6f, + 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0c, 0x75, 0x70, 0x6c, + 0x6f, 0x61, 0x64, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x22, 0xa6, 0x01, 0x0a, 0x13, 0x52, 0x65, + 0x6e, 0x61, 0x6d, 0x65, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x12, 0x1e, 0x0a, 0x0a, 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x04, 0x70, 0x61, 0x74, 0x68, 0x12, 0x1b, 0x0a, 0x09, 0x70, 0x61, 0x74, 0x68, 0x5f, 0x68, 0x61, + 0x73, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x61, 0x74, 0x68, 0x48, 0x61, + 0x73, 0x68, 0x12, 0x23, 0x0a, 0x0d, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, + 0x5f, 0x69, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x63, 0x6f, 0x6e, 0x6e, 0x65, + 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x19, 0x0a, 0x08, 0x6e, 0x65, 0x77, 0x5f, 0x6e, + 0x61, 0x6d, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6e, 0x65, 0x77, 0x4e, 0x61, + 0x6d, 0x65, 0x22, 0xd4, 0x01, 0x0a, 0x14, 0x52, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x4f, 0x62, 0x6a, + 0x65, 0x63, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x66, + 0x69, 0x6c, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x66, + 0x69, 0x6c, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x69, 0x7a, 0x65, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x73, 0x69, 0x7a, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x63, + 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x0b, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x48, 0x61, 0x73, 0x68, 0x12, 0x1f, + 0x0a, 0x0b, 0x6d, 0x65, 0x72, 0x6b, 0x6c, 0x65, 0x5f, 0x72, 0x6f, 0x6f, 0x74, 0x18, 0x04, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0a, 0x6d, 0x65, 0x72, 0x6b, 0x6c, 0x65, 0x52, 0x6f, 0x6f, 0x74, 0x12, + 0x23, 0x0a, 0x0d, 0x75, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, + 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0c, 0x75, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x4c, 0x65, + 0x6e, 0x67, 0x74, 0x68, 0x12, 0x23, 0x0a, 0x0d, 0x75, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x5f, 0x6f, + 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0c, 0x75, 0x70, 0x6c, + 0x6f, 0x61, 0x64, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x22, 0x9b, 0x02, 0x0a, 0x11, 0x55, 0x70, + 0x6c, 0x6f, 0x61, 0x64, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, + 0x1e, 0x0a, 0x0a, 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0a, 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, + 0x12, 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x70, + 0x61, 0x74, 0x68, 0x12, 0x23, 0x0a, 0x0d, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, + 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x63, 0x6f, 0x6e, 0x6e, + 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x6d, 0x65, 0x74, 0x68, + 0x6f, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, + 0x12, 0x1f, 0x0a, 0x0b, 0x75, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x5f, 0x6d, 0x65, 0x74, 0x61, 0x18, + 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x75, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x4d, 0x65, 0x74, + 0x61, 0x12, 0x1f, 0x0a, 0x0b, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x6d, 0x65, 0x74, 0x61, + 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x65, + 0x74, 0x61, 0x12, 0x1f, 0x0a, 0x0b, 0x75, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x5f, 0x66, 0x69, 0x6c, + 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0a, 0x75, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x46, + 0x69, 0x6c, 0x65, 0x12, 0x32, 0x0a, 0x15, 0x75, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x5f, 0x74, 0x68, + 0x75, 0x6d, 0x62, 0x6e, 0x61, 0x69, 0x6c, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x18, 0x08, 0x20, 0x01, + 0x28, 0x0c, 0x52, 0x13, 0x75, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x54, 0x68, 0x75, 0x6d, 0x62, 0x6e, + 0x61, 0x69, 0x6c, 0x46, 0x69, 0x6c, 0x65, 0x22, 0xd2, 0x01, 0x0a, 0x12, 0x55, 0x70, 0x6c, 0x6f, + 0x61, 0x64, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1a, + 0x0a, 0x08, 0x66, 0x69, 0x6c, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x08, 0x66, 0x69, 0x6c, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x69, + 0x7a, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x73, 0x69, 0x7a, 0x65, 0x12, 0x21, + 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x48, 0x61, 0x73, + 0x68, 0x12, 0x1f, 0x0a, 0x0b, 0x6d, 0x65, 0x72, 0x6b, 0x6c, 0x65, 0x5f, 0x72, 0x6f, 0x6f, 0x74, + 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x6d, 0x65, 0x72, 0x6b, 0x6c, 0x65, 0x52, 0x6f, + 0x6f, 0x74, 0x12, 0x23, 0x0a, 0x0d, 0x75, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x5f, 0x6c, 0x65, 0x6e, + 0x67, 0x74, 0x68, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0c, 0x75, 0x70, 0x6c, 0x6f, 0x61, + 0x64, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12, 0x23, 0x0a, 0x0d, 0x75, 0x70, 0x6c, 0x6f, 0x61, + 0x64, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0c, + 0x75, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x22, 0xe7, 0x04, 0x0a, + 0x0a, 0x41, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x0e, 0x0a, 0x02, 0x69, + 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x0e, 0x0a, 0x02, 0x74, + 0x78, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x74, 0x78, 0x12, 0x1d, 0x0a, 0x0a, 0x74, + 0x6f, 0x74, 0x61, 0x6c, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, + 0x09, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x75, 0x73, + 0x65, 0x64, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x75, + 0x73, 0x65, 0x64, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x19, 0x0a, 0x08, 0x6f, 0x77, 0x6e, 0x65, 0x72, + 0x5f, 0x69, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6f, 0x77, 0x6e, 0x65, 0x72, + 0x49, 0x64, 0x12, 0x28, 0x0a, 0x10, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x5f, 0x70, 0x75, 0x62, 0x6c, + 0x69, 0x63, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x6f, 0x77, + 0x6e, 0x65, 0x72, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x12, 0x1f, 0x0a, 0x0b, + 0x72, 0x65, 0x70, 0x61, 0x69, 0x72, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x07, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x0a, 0x72, 0x65, 0x70, 0x61, 0x69, 0x72, 0x65, 0x72, 0x49, 0x64, 0x12, 0x19, 0x0a, + 0x08, 0x70, 0x61, 0x79, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x07, 0x70, 0x61, 0x79, 0x65, 0x72, 0x49, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x65, 0x78, 0x70, 0x69, + 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x09, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x65, 0x78, + 0x70, 0x69, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x27, 0x0a, 0x0f, 0x61, 0x6c, 0x6c, 0x6f, + 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x72, 0x6f, 0x6f, 0x74, 0x18, 0x0a, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x0e, 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x6f, 0x6f, + 0x74, 0x12, 0x21, 0x0a, 0x0c, 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x5f, 0x73, 0x69, 0x7a, + 0x65, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, + 0x53, 0x69, 0x7a, 0x65, 0x12, 0x2a, 0x0a, 0x11, 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x5f, + 0x73, 0x69, 0x7a, 0x65, 0x5f, 0x75, 0x73, 0x65, 0x64, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x03, 0x52, + 0x0f, 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x53, 0x69, 0x7a, 0x65, 0x55, 0x73, 0x65, 0x64, + 0x12, 0x2c, 0x0a, 0x12, 0x6c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x72, 0x65, 0x64, 0x65, 0x65, + 0x6d, 0x65, 0x64, 0x5f, 0x77, 0x6d, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x6c, 0x61, + 0x74, 0x65, 0x73, 0x74, 0x52, 0x65, 0x64, 0x65, 0x65, 0x6d, 0x65, 0x64, 0x57, 0x6d, 0x12, 0x2c, + 0x0a, 0x12, 0x69, 0x73, 0x5f, 0x72, 0x65, 0x64, 0x65, 0x65, 0x6d, 0x5f, 0x72, 0x65, 0x71, 0x75, + 0x69, 0x72, 0x65, 0x64, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x08, 0x52, 0x10, 0x69, 0x73, 0x52, 0x65, + 0x64, 0x65, 0x65, 0x6d, 0x52, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x12, 0x1b, 0x0a, 0x09, + 0x74, 0x69, 0x6d, 0x65, 0x5f, 0x75, 0x6e, 0x69, 0x74, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x03, 0x52, + 0x08, 0x74, 0x69, 0x6d, 0x65, 0x55, 0x6e, 0x69, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x63, 0x6c, 0x65, + 0x61, 0x6e, 0x65, 0x64, 0x5f, 0x75, 0x70, 0x18, 0x10, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x63, + 0x6c, 0x65, 0x61, 0x6e, 0x65, 0x64, 0x55, 0x70, 0x12, 0x1c, 0x0a, 0x09, 0x66, 0x69, 0x6e, 0x61, + 0x6c, 0x69, 0x7a, 0x65, 0x64, 0x18, 0x11, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x66, 0x69, 0x6e, + 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x64, 0x12, 0x2e, 0x0a, 0x05, 0x74, 0x65, 0x72, 0x6d, 0x73, 0x18, + 0x12, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x2e, + 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x65, 0x72, 0x6d, 0x52, + 0x05, 0x74, 0x65, 0x72, 0x6d, 0x73, 0x22, 0x9a, 0x01, 0x0a, 0x04, 0x54, 0x65, 0x72, 0x6d, 0x12, + 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69, 0x64, 0x12, + 0x1d, 0x0a, 0x0a, 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x09, 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x49, 0x64, 0x12, 0x23, + 0x0a, 0x0d, 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x72, 0x65, 0x61, 0x64, 0x5f, 0x70, 0x72, 0x69, 0x63, + 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x72, 0x65, 0x61, 0x64, 0x50, 0x72, 0x69, + 0x63, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x77, 0x72, 0x69, 0x74, 0x65, 0x5f, 0x70, 0x72, 0x69, 0x63, + 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x77, 0x72, 0x69, 0x74, 0x65, 0x50, 0x72, + 0x69, 0x63, 0x65, 0x22, 0xaa, 0x01, 0x0a, 0x07, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x66, 0x12, + 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, + 0x79, 0x70, 0x65, 0x12, 0x46, 0x0a, 0x0e, 0x66, 0x69, 0x6c, 0x65, 0x5f, 0x6d, 0x65, 0x74, 0x61, + 0x5f, 0x64, 0x61, 0x74, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x76, 0x31, - 0x2e, 0x47, 0x65, 0x74, 0x46, 0x69, 0x6c, 0x65, 0x4d, 0x65, 0x74, 0x61, 0x44, 0x61, 0x74, 0x61, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x22, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1c, - 0x12, 0x1a, 0x2f, 0x76, 0x32, 0x2f, 0x66, 0x69, 0x6c, 0x65, 0x2f, 0x6d, 0x65, 0x74, 0x61, 0x2f, - 0x7b, 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x7d, 0x12, 0x86, 0x01, 0x0a, - 0x0c, 0x47, 0x65, 0x74, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x61, 0x74, 0x73, 0x12, 0x27, 0x2e, - 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, - 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x61, 0x74, 0x73, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x28, 0x2e, 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, + 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x4d, 0x65, 0x74, 0x61, 0x44, 0x61, 0x74, 0x61, 0x52, 0x0c, 0x66, + 0x69, 0x6c, 0x65, 0x4d, 0x65, 0x74, 0x61, 0x44, 0x61, 0x74, 0x61, 0x12, 0x43, 0x0a, 0x0d, 0x64, + 0x69, 0x72, 0x5f, 0x6d, 0x65, 0x74, 0x61, 0x5f, 0x64, 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x69, 0x72, 0x4d, 0x65, 0x74, 0x61, 0x44, + 0x61, 0x74, 0x61, 0x52, 0x0b, 0x64, 0x69, 0x72, 0x4d, 0x65, 0x74, 0x61, 0x44, 0x61, 0x74, 0x61, + 0x22, 0xc6, 0x06, 0x0a, 0x0c, 0x46, 0x69, 0x6c, 0x65, 0x4d, 0x65, 0x74, 0x61, 0x44, 0x61, 0x74, + 0x61, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x6c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x5f, + 0x68, 0x61, 0x73, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x6c, 0x6f, 0x6f, 0x6b, + 0x75, 0x70, 0x48, 0x61, 0x73, 0x68, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, + 0x74, 0x68, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x70, 0x61, 0x74, 0x68, 0x12, 0x12, + 0x0a, 0x04, 0x68, 0x61, 0x73, 0x68, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x68, 0x61, + 0x73, 0x68, 0x12, 0x1d, 0x0a, 0x0a, 0x6e, 0x75, 0x6d, 0x5f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x73, + 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x6e, 0x75, 0x6d, 0x42, 0x6c, 0x6f, 0x63, 0x6b, + 0x73, 0x12, 0x1b, 0x0a, 0x09, 0x70, 0x61, 0x74, 0x68, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0x07, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x61, 0x74, 0x68, 0x48, 0x61, 0x73, 0x68, 0x12, 0x1f, + 0x0a, 0x0b, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x5f, 0x6d, 0x65, 0x74, 0x61, 0x18, 0x08, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0a, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x4d, 0x65, 0x74, 0x61, 0x12, + 0x21, 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, + 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x48, 0x61, + 0x73, 0x68, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x03, + 0x52, 0x04, 0x73, 0x69, 0x7a, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x6d, 0x65, 0x72, 0x6b, 0x6c, 0x65, + 0x5f, 0x72, 0x6f, 0x6f, 0x74, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x6d, 0x65, 0x72, + 0x6b, 0x6c, 0x65, 0x52, 0x6f, 0x6f, 0x74, 0x12, 0x28, 0x0a, 0x10, 0x61, 0x63, 0x74, 0x75, 0x61, + 0x6c, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x0c, 0x20, 0x01, 0x28, + 0x03, 0x52, 0x0e, 0x61, 0x63, 0x74, 0x75, 0x61, 0x6c, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x69, 0x7a, + 0x65, 0x12, 0x28, 0x0a, 0x10, 0x61, 0x63, 0x74, 0x75, 0x61, 0x6c, 0x5f, 0x66, 0x69, 0x6c, 0x65, + 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x61, 0x63, 0x74, + 0x75, 0x61, 0x6c, 0x46, 0x69, 0x6c, 0x65, 0x48, 0x61, 0x73, 0x68, 0x12, 0x1b, 0x0a, 0x09, 0x6d, + 0x69, 0x6d, 0x65, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, + 0x6d, 0x69, 0x6d, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x25, 0x0a, 0x0e, 0x74, 0x68, 0x75, 0x6d, + 0x62, 0x6e, 0x61, 0x69, 0x6c, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x03, + 0x52, 0x0d, 0x74, 0x68, 0x75, 0x6d, 0x62, 0x6e, 0x61, 0x69, 0x6c, 0x53, 0x69, 0x7a, 0x65, 0x12, + 0x25, 0x0a, 0x0e, 0x74, 0x68, 0x75, 0x6d, 0x62, 0x6e, 0x61, 0x69, 0x6c, 0x5f, 0x68, 0x61, 0x73, + 0x68, 0x18, 0x10, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x74, 0x68, 0x75, 0x6d, 0x62, 0x6e, 0x61, + 0x69, 0x6c, 0x48, 0x61, 0x73, 0x68, 0x12, 0x32, 0x0a, 0x15, 0x61, 0x63, 0x74, 0x75, 0x61, 0x6c, + 0x5f, 0x74, 0x68, 0x75, 0x6d, 0x62, 0x6e, 0x61, 0x69, 0x6c, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, + 0x11, 0x20, 0x01, 0x28, 0x03, 0x52, 0x13, 0x61, 0x63, 0x74, 0x75, 0x61, 0x6c, 0x54, 0x68, 0x75, + 0x6d, 0x62, 0x6e, 0x61, 0x69, 0x6c, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x32, 0x0a, 0x15, 0x61, 0x63, + 0x74, 0x75, 0x61, 0x6c, 0x5f, 0x74, 0x68, 0x75, 0x6d, 0x62, 0x6e, 0x61, 0x69, 0x6c, 0x5f, 0x68, + 0x61, 0x73, 0x68, 0x18, 0x12, 0x20, 0x01, 0x28, 0x09, 0x52, 0x13, 0x61, 0x63, 0x74, 0x75, 0x61, + 0x6c, 0x54, 0x68, 0x75, 0x6d, 0x62, 0x6e, 0x61, 0x69, 0x6c, 0x48, 0x61, 0x73, 0x68, 0x12, 0x23, + 0x0a, 0x0d, 0x65, 0x6e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x65, 0x64, 0x5f, 0x6b, 0x65, 0x79, 0x18, + 0x13, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x65, 0x6e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x65, 0x64, + 0x4b, 0x65, 0x79, 0x12, 0x1e, 0x0a, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, + 0x73, 0x18, 0x14, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, + 0x74, 0x65, 0x73, 0x12, 0x19, 0x0a, 0x08, 0x6f, 0x6e, 0x5f, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x18, + 0x15, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x6f, 0x6e, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x12, 0x4b, + 0x0a, 0x10, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x5f, 0x6d, 0x65, 0x74, 0x61, 0x5f, 0x74, 0x78, + 0x6e, 0x73, 0x18, 0x16, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x62, 0x6c, 0x6f, 0x62, 0x62, + 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x6f, + 0x6d, 0x6d, 0x69, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x54, 0x78, 0x6e, 0x52, 0x0e, 0x63, 0x6f, 0x6d, + 0x6d, 0x69, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x54, 0x78, 0x6e, 0x73, 0x12, 0x1d, 0x0a, 0x0a, 0x63, + 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x17, 0x20, 0x01, 0x28, 0x03, 0x52, + 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x75, 0x70, + 0x64, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x18, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, + 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x22, 0x8c, 0x02, 0x0a, 0x0b, 0x44, 0x69, + 0x72, 0x4d, 0x65, 0x74, 0x61, 0x44, 0x61, 0x74, 0x61, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, + 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x1f, 0x0a, + 0x0b, 0x6c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x0a, 0x6c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x48, 0x61, 0x73, 0x68, 0x12, 0x12, + 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, + 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x04, 0x70, 0x61, 0x74, 0x68, 0x12, 0x12, 0x0a, 0x04, 0x68, 0x61, 0x73, 0x68, 0x18, 0x05, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x68, 0x61, 0x73, 0x68, 0x12, 0x1d, 0x0a, 0x0a, 0x6e, 0x75, + 0x6d, 0x5f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, + 0x6e, 0x75, 0x6d, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x12, 0x1b, 0x0a, 0x09, 0x70, 0x61, 0x74, + 0x68, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x61, + 0x74, 0x68, 0x48, 0x61, 0x73, 0x68, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x08, + 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x73, 0x69, 0x7a, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x63, 0x72, + 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x09, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, + 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x75, 0x70, 0x64, + 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x75, + 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x32, 0xcc, 0x12, 0x0a, 0x07, 0x42, 0x6c, 0x6f, + 0x62, 0x62, 0x65, 0x72, 0x12, 0x7c, 0x0a, 0x0d, 0x47, 0x65, 0x74, 0x41, 0x6c, 0x6c, 0x6f, 0x63, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x28, 0x2e, 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x2e, + 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x41, 0x6c, + 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x29, 0x2e, 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, + 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x41, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x16, 0x82, 0xd3, 0xe4, 0x93, + 0x02, 0x10, 0x12, 0x0e, 0x2f, 0x76, 0x32, 0x2f, 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x12, 0x91, 0x01, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x46, 0x69, 0x6c, 0x65, 0x4d, 0x65, + 0x74, 0x61, 0x44, 0x61, 0x74, 0x61, 0x12, 0x2a, 0x2e, 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x46, - 0x69, 0x6c, 0x65, 0x53, 0x74, 0x61, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x22, 0x23, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1d, 0x12, 0x1b, 0x2f, 0x76, 0x32, 0x2f, 0x66, 0x69, - 0x6c, 0x65, 0x2f, 0x73, 0x74, 0x61, 0x74, 0x73, 0x2f, 0x7b, 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x7d, 0x12, 0x85, 0x01, 0x0a, 0x0c, 0x4c, 0x69, 0x73, 0x74, 0x45, 0x6e, - 0x74, 0x69, 0x74, 0x69, 0x65, 0x73, 0x12, 0x27, 0x2e, 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, - 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, - 0x45, 0x6e, 0x74, 0x69, 0x74, 0x69, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, - 0x28, 0x2e, 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, - 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x45, 0x6e, 0x74, 0x69, 0x74, 0x69, 0x65, - 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x22, 0x82, 0xd3, 0xe4, 0x93, 0x02, - 0x1c, 0x12, 0x1a, 0x2f, 0x76, 0x32, 0x2f, 0x66, 0x69, 0x6c, 0x65, 0x2f, 0x6c, 0x69, 0x73, 0x74, - 0x2f, 0x7b, 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x7d, 0x12, 0x8e, 0x01, - 0x0a, 0x0d, 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x50, 0x61, 0x74, 0x68, 0x12, - 0x28, 0x2e, 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, - 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x50, 0x61, - 0x74, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x29, 0x2e, 0x62, 0x6c, 0x6f, 0x62, - 0x62, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x47, - 0x65, 0x74, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x50, 0x61, 0x74, 0x68, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x28, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x22, 0x12, 0x20, 0x2f, 0x76, - 0x32, 0x2f, 0x66, 0x69, 0x6c, 0x65, 0x2f, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x70, 0x61, 0x74, - 0x68, 0x2f, 0x7b, 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x7d, 0x12, 0x9a, - 0x01, 0x0a, 0x10, 0x47, 0x65, 0x74, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x50, - 0x61, 0x74, 0x68, 0x12, 0x2b, 0x2e, 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x2e, 0x73, 0x65, - 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x66, 0x65, - 0x72, 0x65, 0x6e, 0x63, 0x65, 0x50, 0x61, 0x74, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x1a, 0x2c, 0x2e, 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, + 0x69, 0x6c, 0x65, 0x4d, 0x65, 0x74, 0x61, 0x44, 0x61, 0x74, 0x61, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x2b, 0x2e, 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x46, 0x69, 0x6c, 0x65, 0x4d, + 0x65, 0x74, 0x61, 0x44, 0x61, 0x74, 0x61, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, + 0x25, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1f, 0x22, 0x1a, 0x2f, 0x76, 0x32, 0x2f, 0x66, 0x69, 0x6c, + 0x65, 0x2f, 0x6d, 0x65, 0x74, 0x61, 0x2f, 0x7b, 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x7d, 0x3a, 0x01, 0x2a, 0x12, 0x89, 0x01, 0x0a, 0x0c, 0x47, 0x65, 0x74, 0x46, 0x69, + 0x6c, 0x65, 0x53, 0x74, 0x61, 0x74, 0x73, 0x12, 0x27, 0x2e, 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, + 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, + 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x61, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x28, 0x2e, 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x61, + 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x26, 0x82, 0xd3, 0xe4, 0x93, + 0x02, 0x20, 0x22, 0x1b, 0x2f, 0x76, 0x32, 0x2f, 0x66, 0x69, 0x6c, 0x65, 0x2f, 0x73, 0x74, 0x61, + 0x74, 0x73, 0x2f, 0x7b, 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x7d, 0x3a, + 0x01, 0x2a, 0x12, 0x85, 0x01, 0x0a, 0x0c, 0x4c, 0x69, 0x73, 0x74, 0x45, 0x6e, 0x74, 0x69, 0x74, + 0x69, 0x65, 0x73, 0x12, 0x27, 0x2e, 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x2e, 0x73, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x45, 0x6e, 0x74, + 0x69, 0x74, 0x69, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x28, 0x2e, 0x62, + 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x76, + 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x45, 0x6e, 0x74, 0x69, 0x74, 0x69, 0x65, 0x73, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x22, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1c, 0x12, 0x1a, + 0x2f, 0x76, 0x32, 0x2f, 0x66, 0x69, 0x6c, 0x65, 0x2f, 0x6c, 0x69, 0x73, 0x74, 0x2f, 0x7b, 0x61, + 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x7d, 0x12, 0x8e, 0x01, 0x0a, 0x0d, 0x47, + 0x65, 0x74, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x50, 0x61, 0x74, 0x68, 0x12, 0x28, 0x2e, 0x62, + 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x76, + 0x31, 0x2e, 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x50, 0x61, 0x74, 0x68, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x29, 0x2e, 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, + 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x4f, + 0x62, 0x6a, 0x65, 0x63, 0x74, 0x50, 0x61, 0x74, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x22, 0x28, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x22, 0x12, 0x20, 0x2f, 0x76, 0x32, 0x2f, 0x66, + 0x69, 0x6c, 0x65, 0x2f, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x70, 0x61, 0x74, 0x68, 0x2f, 0x7b, + 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x7d, 0x12, 0x9a, 0x01, 0x0a, 0x10, + 0x47, 0x65, 0x74, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x50, 0x61, 0x74, 0x68, + 0x12, 0x2b, 0x2e, 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, - 0x63, 0x65, 0x50, 0x61, 0x74, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2b, - 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x25, 0x12, 0x23, 0x2f, 0x76, 0x32, 0x2f, 0x66, 0x69, 0x6c, 0x65, - 0x2f, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x70, 0x61, 0x74, 0x68, 0x2f, 0x7b, - 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x7d, 0x12, 0x8e, 0x01, 0x0a, 0x0d, - 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x54, 0x72, 0x65, 0x65, 0x12, 0x28, 0x2e, + 0x63, 0x65, 0x50, 0x61, 0x74, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2c, 0x2e, 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, - 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x54, 0x72, 0x65, 0x65, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x29, 0x2e, 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, - 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, - 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x54, 0x72, 0x65, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x22, 0x28, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x22, 0x12, 0x20, 0x2f, 0x76, 0x32, 0x2f, - 0x66, 0x69, 0x6c, 0x65, 0x2f, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x74, 0x72, 0x65, 0x65, 0x2f, - 0x7b, 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x7d, 0x42, 0x0f, 0x5a, 0x0d, - 0x2e, 0x2f, 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x67, 0x72, 0x70, 0x63, 0x62, 0x06, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x50, + 0x61, 0x74, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2b, 0x82, 0xd3, 0xe4, + 0x93, 0x02, 0x25, 0x12, 0x23, 0x2f, 0x76, 0x32, 0x2f, 0x66, 0x69, 0x6c, 0x65, 0x2f, 0x72, 0x65, + 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x70, 0x61, 0x74, 0x68, 0x2f, 0x7b, 0x61, 0x6c, 0x6c, + 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x7d, 0x12, 0x8e, 0x01, 0x0a, 0x0d, 0x47, 0x65, 0x74, + 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x54, 0x72, 0x65, 0x65, 0x12, 0x28, 0x2e, 0x62, 0x6c, 0x6f, + 0x62, 0x62, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, + 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x54, 0x72, 0x65, 0x65, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x29, 0x2e, 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x2e, 0x73, + 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x4f, 0x62, 0x6a, + 0x65, 0x63, 0x74, 0x54, 0x72, 0x65, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, + 0x28, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x22, 0x12, 0x20, 0x2f, 0x76, 0x32, 0x2f, 0x66, 0x69, 0x6c, + 0x65, 0x2f, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x74, 0x72, 0x65, 0x65, 0x2f, 0x7b, 0x61, 0x6c, + 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x7d, 0x12, 0x8c, 0x01, 0x0a, 0x0c, 0x44, 0x6f, + 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x46, 0x69, 0x6c, 0x65, 0x12, 0x27, 0x2e, 0x62, 0x6c, 0x6f, + 0x62, 0x62, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, + 0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x28, 0x2e, 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x2e, 0x73, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, + 0x64, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x29, 0x82, + 0xd3, 0xe4, 0x93, 0x02, 0x23, 0x22, 0x1e, 0x2f, 0x76, 0x32, 0x2f, 0x66, 0x69, 0x6c, 0x65, 0x2f, + 0x64, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x2f, 0x7b, 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x7d, 0x3a, 0x01, 0x2a, 0x12, 0x8a, 0x01, 0x0a, 0x0c, 0x52, 0x65, 0x6e, + 0x61, 0x6d, 0x65, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x27, 0x2e, 0x62, 0x6c, 0x6f, 0x62, + 0x62, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x52, + 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x28, 0x2e, 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x4f, 0x62, + 0x6a, 0x65, 0x63, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x27, 0x82, 0xd3, + 0xe4, 0x93, 0x02, 0x21, 0x22, 0x1c, 0x2f, 0x76, 0x32, 0x2f, 0x66, 0x69, 0x6c, 0x65, 0x2f, 0x72, + 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x2f, 0x7b, 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x7d, 0x3a, 0x01, 0x2a, 0x12, 0xca, 0x01, 0x0a, 0x0a, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, + 0x46, 0x69, 0x6c, 0x65, 0x12, 0x25, 0x2e, 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x2e, 0x73, + 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, + 0x46, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x26, 0x2e, 0x62, 0x6c, + 0x6f, 0x62, 0x62, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x76, 0x31, + 0x2e, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x22, 0x6d, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x67, 0x22, 0x1c, 0x2f, 0x76, 0x32, + 0x2f, 0x66, 0x69, 0x6c, 0x65, 0x2f, 0x75, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x2f, 0x7b, 0x61, 0x6c, + 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x7d, 0x3a, 0x01, 0x2a, 0x5a, 0x21, 0x1a, 0x1c, + 0x2f, 0x76, 0x32, 0x2f, 0x66, 0x69, 0x6c, 0x65, 0x2f, 0x75, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x2f, + 0x7b, 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x7d, 0x3a, 0x01, 0x2a, 0x5a, + 0x21, 0x2a, 0x1c, 0x2f, 0x76, 0x32, 0x2f, 0x66, 0x69, 0x6c, 0x65, 0x2f, 0x75, 0x70, 0x6c, 0x6f, + 0x61, 0x64, 0x2f, 0x7b, 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x7d, 0x3a, + 0x01, 0x2a, 0x12, 0x7e, 0x0a, 0x06, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x12, 0x21, 0x2e, 0x62, + 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x76, + 0x31, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x22, 0x2e, 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, + 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x22, 0x2d, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x27, 0x22, 0x22, 0x2f, 0x76, 0x32, + 0x2f, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, + 0x69, 0x74, 0x2f, 0x7b, 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x7d, 0x3a, + 0x01, 0x2a, 0x12, 0x94, 0x01, 0x0a, 0x0d, 0x43, 0x61, 0x6c, 0x63, 0x75, 0x6c, 0x61, 0x74, 0x65, + 0x48, 0x61, 0x73, 0x68, 0x12, 0x28, 0x2e, 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x2e, 0x73, + 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x61, 0x6c, 0x63, 0x75, 0x6c, + 0x61, 0x74, 0x65, 0x48, 0x61, 0x73, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x29, + 0x2e, 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, + 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x61, 0x6c, 0x63, 0x75, 0x6c, 0x61, 0x74, 0x65, 0x48, 0x61, 0x73, + 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2e, 0x82, 0xd3, 0xe4, 0x93, 0x02, + 0x28, 0x22, 0x23, 0x2f, 0x76, 0x32, 0x2f, 0x66, 0x69, 0x6c, 0x65, 0x2f, 0x63, 0x61, 0x6c, 0x63, + 0x75, 0x6c, 0x61, 0x74, 0x65, 0x68, 0x61, 0x73, 0x68, 0x2f, 0x7b, 0x61, 0x6c, 0x6c, 0x6f, 0x63, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x7d, 0x3a, 0x01, 0x2a, 0x12, 0x94, 0x01, 0x0a, 0x0d, 0x43, 0x6f, + 0x6d, 0x6d, 0x69, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x54, 0x78, 0x6e, 0x12, 0x28, 0x2e, 0x62, 0x6c, + 0x6f, 0x62, 0x62, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x76, 0x31, + 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x54, 0x78, 0x6e, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x29, 0x2e, 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x2e, + 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x69, + 0x74, 0x4d, 0x65, 0x74, 0x61, 0x54, 0x78, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x22, 0x2e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x28, 0x22, 0x23, 0x2f, 0x76, 0x32, 0x2f, 0x66, 0x69, + 0x6c, 0x65, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x6d, 0x65, 0x74, 0x61, 0x74, 0x78, 0x6e, + 0x2f, 0x7b, 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x7d, 0x3a, 0x01, 0x2a, + 0x12, 0xac, 0x01, 0x0a, 0x16, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4f, 0x62, 0x6a, 0x65, 0x63, + 0x74, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x12, 0x31, 0x2e, 0x62, 0x6c, + 0x6f, 0x62, 0x62, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x76, 0x31, + 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x41, 0x74, 0x74, + 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x32, + 0x2e, 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, + 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, + 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x22, 0x2b, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x25, 0x22, 0x20, 0x2f, 0x76, 0x32, 0x2f, + 0x66, 0x69, 0x6c, 0x65, 0x2f, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x2f, + 0x7b, 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x7d, 0x3a, 0x01, 0x2a, 0x12, + 0x82, 0x01, 0x0a, 0x0a, 0x43, 0x6f, 0x70, 0x79, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x25, + 0x2e, 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, + 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x6f, 0x70, 0x79, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x26, 0x2e, 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x2e, + 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x6f, 0x70, 0x79, 0x4f, + 0x62, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x25, 0x82, + 0xd3, 0xe4, 0x93, 0x02, 0x1f, 0x22, 0x1a, 0x2f, 0x76, 0x32, 0x2f, 0x66, 0x69, 0x6c, 0x65, 0x2f, + 0x63, 0x6f, 0x70, 0x79, 0x2f, 0x7b, 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x7d, 0x3a, 0x01, 0x2a, 0x12, 0x90, 0x01, 0x0a, 0x0c, 0x43, 0x6f, 0x6c, 0x6c, 0x61, 0x62, 0x6f, + 0x72, 0x61, 0x74, 0x6f, 0x72, 0x12, 0x27, 0x2e, 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x2e, + 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x6f, 0x6c, 0x6c, 0x61, + 0x62, 0x6f, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x28, + 0x2e, 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, 0x72, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, + 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x6f, 0x6c, 0x6c, 0x61, 0x62, 0x6f, 0x72, 0x61, 0x74, 0x6f, 0x72, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2d, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x27, + 0x22, 0x22, 0x2f, 0x76, 0x32, 0x2f, 0x66, 0x69, 0x6c, 0x65, 0x2f, 0x63, 0x6f, 0x6c, 0x6c, 0x61, + 0x62, 0x6f, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x2f, 0x7b, 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x7d, 0x3a, 0x01, 0x2a, 0x42, 0x2c, 0x5a, 0x2a, 0x63, 0x6f, 0x64, 0x65, 0x2f, + 0x67, 0x6f, 0x2f, 0x30, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x2e, 0x6e, 0x65, 0x74, 0x2f, 0x62, 0x6c, + 0x6f, 0x62, 0x62, 0x65, 0x72, 0x63, 0x6f, 0x72, 0x65, 0x2f, 0x62, 0x6c, 0x6f, 0x62, 0x62, 0x65, + 0x72, 0x67, 0x72, 0x70, 0x63, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -2535,83 +4168,116 @@ func file_blobber_proto_rawDescGZIP() []byte { return file_blobber_proto_rawDescData } -var file_blobber_proto_msgTypes = make([]protoimpl.MessageInfo, 26) +var file_blobber_proto_msgTypes = make([]protoimpl.MessageInfo, 44) var file_blobber_proto_goTypes = []interface{}{ - (*GetObjectTreeRequest)(nil), // 0: blobber.service.v1.GetObjectTreeRequest - (*GetObjectTreeResponse)(nil), // 1: blobber.service.v1.GetObjectTreeResponse - (*GetReferencePathRequest)(nil), // 2: blobber.service.v1.GetReferencePathRequest - (*GetReferencePathResponse)(nil), // 3: blobber.service.v1.GetReferencePathResponse - (*ReferencePath)(nil), // 4: blobber.service.v1.ReferencePath - (*GetObjectPathRequest)(nil), // 5: blobber.service.v1.GetObjectPathRequest - (*GetObjectPathResponse)(nil), // 6: blobber.service.v1.GetObjectPathResponse - (*ObjectPath)(nil), // 7: blobber.service.v1.ObjectPath - (*WriteMarker)(nil), // 8: blobber.service.v1.WriteMarker - (*ListEntitiesRequest)(nil), // 9: blobber.service.v1.ListEntitiesRequest - (*ListEntitiesResponse)(nil), // 10: blobber.service.v1.ListEntitiesResponse - (*GetFileStatsRequest)(nil), // 11: blobber.service.v1.GetFileStatsRequest - (*GetFileStatsResponse)(nil), // 12: blobber.service.v1.GetFileStatsResponse - (*FileStats)(nil), // 13: blobber.service.v1.FileStats - (*GetFileMetaDataRequest)(nil), // 14: blobber.service.v1.GetFileMetaDataRequest - (*GetFileMetaDataResponse)(nil), // 15: blobber.service.v1.GetFileMetaDataResponse - (*CommitMetaTxn)(nil), // 16: blobber.service.v1.CommitMetaTxn - (*Collaborator)(nil), // 17: blobber.service.v1.Collaborator - (*RequestContext)(nil), // 18: blobber.service.v1.RequestContext - (*GetAllocationRequest)(nil), // 19: blobber.service.v1.GetAllocationRequest - (*GetAllocationResponse)(nil), // 20: blobber.service.v1.GetAllocationResponse - (*Allocation)(nil), // 21: blobber.service.v1.Allocation - (*Term)(nil), // 22: blobber.service.v1.Term - (*FileRef)(nil), // 23: blobber.service.v1.FileRef - (*FileMetaData)(nil), // 24: blobber.service.v1.FileMetaData - (*DirMetaData)(nil), // 25: blobber.service.v1.DirMetaData + (*CollaboratorRequest)(nil), // 0: blobber.service.v1.CollaboratorRequest + (*CollaboratorResponse)(nil), // 1: blobber.service.v1.CollaboratorResponse + (*CalculateHashRequest)(nil), // 2: blobber.service.v1.CalculateHashRequest + (*CalculateHashResponse)(nil), // 3: blobber.service.v1.CalculateHashResponse + (*CommitRequest)(nil), // 4: blobber.service.v1.CommitRequest + (*CommitResponse)(nil), // 5: blobber.service.v1.CommitResponse + (*CommitMetaTxnRequest)(nil), // 6: blobber.service.v1.CommitMetaTxnRequest + (*CommitMetaTxnResponse)(nil), // 7: blobber.service.v1.CommitMetaTxnResponse + (*GetObjectTreeRequest)(nil), // 8: blobber.service.v1.GetObjectTreeRequest + (*GetObjectTreeResponse)(nil), // 9: blobber.service.v1.GetObjectTreeResponse + (*GetReferencePathRequest)(nil), // 10: blobber.service.v1.GetReferencePathRequest + (*GetReferencePathResponse)(nil), // 11: blobber.service.v1.GetReferencePathResponse + (*ReferencePath)(nil), // 12: blobber.service.v1.ReferencePath + (*GetObjectPathRequest)(nil), // 13: blobber.service.v1.GetObjectPathRequest + (*GetObjectPathResponse)(nil), // 14: blobber.service.v1.GetObjectPathResponse + (*ObjectPath)(nil), // 15: blobber.service.v1.ObjectPath + (*WriteMarker)(nil), // 16: blobber.service.v1.WriteMarker + (*ListEntitiesRequest)(nil), // 17: blobber.service.v1.ListEntitiesRequest + (*ListEntitiesResponse)(nil), // 18: blobber.service.v1.ListEntitiesResponse + (*GetFileStatsRequest)(nil), // 19: blobber.service.v1.GetFileStatsRequest + (*GetFileStatsResponse)(nil), // 20: blobber.service.v1.GetFileStatsResponse + (*FileStats)(nil), // 21: blobber.service.v1.FileStats + (*GetFileMetaDataRequest)(nil), // 22: blobber.service.v1.GetFileMetaDataRequest + (*GetFileMetaDataResponse)(nil), // 23: blobber.service.v1.GetFileMetaDataResponse + (*CommitMetaTxn)(nil), // 24: blobber.service.v1.CommitMetaTxn + (*Collaborator)(nil), // 25: blobber.service.v1.Collaborator + (*GetAllocationRequest)(nil), // 26: blobber.service.v1.GetAllocationRequest + (*GetAllocationResponse)(nil), // 27: blobber.service.v1.GetAllocationResponse + (*DownloadFileRequest)(nil), // 28: blobber.service.v1.DownloadFileRequest + (*DownloadFileResponse)(nil), // 29: blobber.service.v1.DownloadFileResponse + (*ReadMaker)(nil), // 30: blobber.service.v1.ReadMaker + (*UpdateObjectAttributesRequest)(nil), // 31: blobber.service.v1.UpdateObjectAttributesRequest + (*UpdateObjectAttributesResponse)(nil), // 32: blobber.service.v1.UpdateObjectAttributesResponse + (*CopyObjectRequest)(nil), // 33: blobber.service.v1.CopyObjectRequest + (*CopyObjectResponse)(nil), // 34: blobber.service.v1.CopyObjectResponse + (*RenameObjectRequest)(nil), // 35: blobber.service.v1.RenameObjectRequest + (*RenameObjectResponse)(nil), // 36: blobber.service.v1.RenameObjectResponse + (*UploadFileRequest)(nil), // 37: blobber.service.v1.UploadFileRequest + (*UploadFileResponse)(nil), // 38: blobber.service.v1.UploadFileResponse + (*Allocation)(nil), // 39: blobber.service.v1.Allocation + (*Term)(nil), // 40: blobber.service.v1.Term + (*FileRef)(nil), // 41: blobber.service.v1.FileRef + (*FileMetaData)(nil), // 42: blobber.service.v1.FileMetaData + (*DirMetaData)(nil), // 43: blobber.service.v1.DirMetaData } var file_blobber_proto_depIdxs = []int32{ - 18, // 0: blobber.service.v1.GetObjectTreeRequest.context:type_name -> blobber.service.v1.RequestContext - 4, // 1: blobber.service.v1.GetObjectTreeResponse.ReferencePath:type_name -> blobber.service.v1.ReferencePath - 8, // 2: blobber.service.v1.GetObjectTreeResponse.LatestWM:type_name -> blobber.service.v1.WriteMarker - 18, // 3: blobber.service.v1.GetReferencePathRequest.Context:type_name -> blobber.service.v1.RequestContext - 4, // 4: blobber.service.v1.GetReferencePathResponse.ReferencePath:type_name -> blobber.service.v1.ReferencePath - 8, // 5: blobber.service.v1.GetReferencePathResponse.LatestWM:type_name -> blobber.service.v1.WriteMarker - 23, // 6: blobber.service.v1.ReferencePath.MetaData:type_name -> blobber.service.v1.FileRef - 4, // 7: blobber.service.v1.ReferencePath.List:type_name -> blobber.service.v1.ReferencePath - 18, // 8: blobber.service.v1.GetObjectPathRequest.context:type_name -> blobber.service.v1.RequestContext - 7, // 9: blobber.service.v1.GetObjectPathResponse.ObjectPath:type_name -> blobber.service.v1.ObjectPath - 8, // 10: blobber.service.v1.GetObjectPathResponse.LatestWriteMarker:type_name -> blobber.service.v1.WriteMarker - 23, // 11: blobber.service.v1.ObjectPath.Meta:type_name -> blobber.service.v1.FileRef - 23, // 12: blobber.service.v1.ObjectPath.Path:type_name -> blobber.service.v1.FileRef - 18, // 13: blobber.service.v1.ListEntitiesRequest.context:type_name -> blobber.service.v1.RequestContext - 23, // 14: blobber.service.v1.ListEntitiesResponse.MetaData:type_name -> blobber.service.v1.FileRef - 18, // 15: blobber.service.v1.GetFileStatsRequest.context:type_name -> blobber.service.v1.RequestContext - 23, // 16: blobber.service.v1.GetFileStatsResponse.MetaData:type_name -> blobber.service.v1.FileRef - 13, // 17: blobber.service.v1.GetFileStatsResponse.Stats:type_name -> blobber.service.v1.FileStats - 18, // 18: blobber.service.v1.GetFileMetaDataRequest.context:type_name -> blobber.service.v1.RequestContext - 23, // 19: blobber.service.v1.GetFileMetaDataResponse.MetaData:type_name -> blobber.service.v1.FileRef - 17, // 20: blobber.service.v1.GetFileMetaDataResponse.Collaborators:type_name -> blobber.service.v1.Collaborator - 18, // 21: blobber.service.v1.GetAllocationRequest.context:type_name -> blobber.service.v1.RequestContext - 21, // 22: blobber.service.v1.GetAllocationResponse.allocation:type_name -> blobber.service.v1.Allocation - 22, // 23: blobber.service.v1.Allocation.Terms:type_name -> blobber.service.v1.Term - 24, // 24: blobber.service.v1.FileRef.FileMetaData:type_name -> blobber.service.v1.FileMetaData - 25, // 25: blobber.service.v1.FileRef.DirMetaData:type_name -> blobber.service.v1.DirMetaData - 16, // 26: blobber.service.v1.FileMetaData.CommitMetaTxns:type_name -> blobber.service.v1.CommitMetaTxn - 23, // 27: blobber.service.v1.DirMetaData.Children:type_name -> blobber.service.v1.FileRef - 19, // 28: blobber.service.v1.Blobber.GetAllocation:input_type -> blobber.service.v1.GetAllocationRequest - 14, // 29: blobber.service.v1.Blobber.GetFileMetaData:input_type -> blobber.service.v1.GetFileMetaDataRequest - 11, // 30: blobber.service.v1.Blobber.GetFileStats:input_type -> blobber.service.v1.GetFileStatsRequest - 9, // 31: blobber.service.v1.Blobber.ListEntities:input_type -> blobber.service.v1.ListEntitiesRequest - 5, // 32: blobber.service.v1.Blobber.GetObjectPath:input_type -> blobber.service.v1.GetObjectPathRequest - 2, // 33: blobber.service.v1.Blobber.GetReferencePath:input_type -> blobber.service.v1.GetReferencePathRequest - 0, // 34: blobber.service.v1.Blobber.GetObjectTree:input_type -> blobber.service.v1.GetObjectTreeRequest - 20, // 35: blobber.service.v1.Blobber.GetAllocation:output_type -> blobber.service.v1.GetAllocationResponse - 15, // 36: blobber.service.v1.Blobber.GetFileMetaData:output_type -> blobber.service.v1.GetFileMetaDataResponse - 12, // 37: blobber.service.v1.Blobber.GetFileStats:output_type -> blobber.service.v1.GetFileStatsResponse - 10, // 38: blobber.service.v1.Blobber.ListEntities:output_type -> blobber.service.v1.ListEntitiesResponse - 6, // 39: blobber.service.v1.Blobber.GetObjectPath:output_type -> blobber.service.v1.GetObjectPathResponse - 3, // 40: blobber.service.v1.Blobber.GetReferencePath:output_type -> blobber.service.v1.GetReferencePathResponse - 1, // 41: blobber.service.v1.Blobber.GetObjectTree:output_type -> blobber.service.v1.GetObjectTreeResponse - 35, // [35:42] is the sub-list for method output_type - 28, // [28:35] is the sub-list for method input_type - 28, // [28:28] is the sub-list for extension type_name - 28, // [28:28] is the sub-list for extension extendee - 0, // [0:28] is the sub-list for field type_name + 25, // 0: blobber.service.v1.CollaboratorResponse.collaborators:type_name -> blobber.service.v1.Collaborator + 16, // 1: blobber.service.v1.CommitResponse.write_marker:type_name -> blobber.service.v1.WriteMarker + 12, // 2: blobber.service.v1.GetObjectTreeResponse.reference_path:type_name -> blobber.service.v1.ReferencePath + 16, // 3: blobber.service.v1.GetObjectTreeResponse.latest_wm:type_name -> blobber.service.v1.WriteMarker + 12, // 4: blobber.service.v1.GetReferencePathResponse.reference_path:type_name -> blobber.service.v1.ReferencePath + 16, // 5: blobber.service.v1.GetReferencePathResponse.latest_wm:type_name -> blobber.service.v1.WriteMarker + 41, // 6: blobber.service.v1.ReferencePath.meta_data:type_name -> blobber.service.v1.FileRef + 12, // 7: blobber.service.v1.ReferencePath.list:type_name -> blobber.service.v1.ReferencePath + 15, // 8: blobber.service.v1.GetObjectPathResponse.object_path:type_name -> blobber.service.v1.ObjectPath + 16, // 9: blobber.service.v1.GetObjectPathResponse.latest_write_marker:type_name -> blobber.service.v1.WriteMarker + 41, // 10: blobber.service.v1.ObjectPath.meta:type_name -> blobber.service.v1.FileRef + 41, // 11: blobber.service.v1.ObjectPath.path:type_name -> blobber.service.v1.FileRef + 41, // 12: blobber.service.v1.ObjectPath.path_list:type_name -> blobber.service.v1.FileRef + 41, // 13: blobber.service.v1.ListEntitiesResponse.meta_data:type_name -> blobber.service.v1.FileRef + 41, // 14: blobber.service.v1.ListEntitiesResponse.entities:type_name -> blobber.service.v1.FileRef + 41, // 15: blobber.service.v1.GetFileStatsResponse.meta_data:type_name -> blobber.service.v1.FileRef + 21, // 16: blobber.service.v1.GetFileStatsResponse.stats:type_name -> blobber.service.v1.FileStats + 41, // 17: blobber.service.v1.GetFileMetaDataResponse.meta_data:type_name -> blobber.service.v1.FileRef + 25, // 18: blobber.service.v1.GetFileMetaDataResponse.collaborators:type_name -> blobber.service.v1.Collaborator + 39, // 19: blobber.service.v1.GetAllocationResponse.allocation:type_name -> blobber.service.v1.Allocation + 30, // 20: blobber.service.v1.DownloadFileResponse.latest_rm:type_name -> blobber.service.v1.ReadMaker + 40, // 21: blobber.service.v1.Allocation.terms:type_name -> blobber.service.v1.Term + 42, // 22: blobber.service.v1.FileRef.file_meta_data:type_name -> blobber.service.v1.FileMetaData + 43, // 23: blobber.service.v1.FileRef.dir_meta_data:type_name -> blobber.service.v1.DirMetaData + 24, // 24: blobber.service.v1.FileMetaData.commit_meta_txns:type_name -> blobber.service.v1.CommitMetaTxn + 26, // 25: blobber.service.v1.Blobber.GetAllocation:input_type -> blobber.service.v1.GetAllocationRequest + 22, // 26: blobber.service.v1.Blobber.GetFileMetaData:input_type -> blobber.service.v1.GetFileMetaDataRequest + 19, // 27: blobber.service.v1.Blobber.GetFileStats:input_type -> blobber.service.v1.GetFileStatsRequest + 17, // 28: blobber.service.v1.Blobber.ListEntities:input_type -> blobber.service.v1.ListEntitiesRequest + 13, // 29: blobber.service.v1.Blobber.GetObjectPath:input_type -> blobber.service.v1.GetObjectPathRequest + 10, // 30: blobber.service.v1.Blobber.GetReferencePath:input_type -> blobber.service.v1.GetReferencePathRequest + 8, // 31: blobber.service.v1.Blobber.GetObjectTree:input_type -> blobber.service.v1.GetObjectTreeRequest + 28, // 32: blobber.service.v1.Blobber.DownloadFile:input_type -> blobber.service.v1.DownloadFileRequest + 35, // 33: blobber.service.v1.Blobber.RenameObject:input_type -> blobber.service.v1.RenameObjectRequest + 37, // 34: blobber.service.v1.Blobber.UploadFile:input_type -> blobber.service.v1.UploadFileRequest + 4, // 35: blobber.service.v1.Blobber.Commit:input_type -> blobber.service.v1.CommitRequest + 2, // 36: blobber.service.v1.Blobber.CalculateHash:input_type -> blobber.service.v1.CalculateHashRequest + 6, // 37: blobber.service.v1.Blobber.CommitMetaTxn:input_type -> blobber.service.v1.CommitMetaTxnRequest + 31, // 38: blobber.service.v1.Blobber.UpdateObjectAttributes:input_type -> blobber.service.v1.UpdateObjectAttributesRequest + 33, // 39: blobber.service.v1.Blobber.CopyObject:input_type -> blobber.service.v1.CopyObjectRequest + 0, // 40: blobber.service.v1.Blobber.Collaborator:input_type -> blobber.service.v1.CollaboratorRequest + 27, // 41: blobber.service.v1.Blobber.GetAllocation:output_type -> blobber.service.v1.GetAllocationResponse + 23, // 42: blobber.service.v1.Blobber.GetFileMetaData:output_type -> blobber.service.v1.GetFileMetaDataResponse + 20, // 43: blobber.service.v1.Blobber.GetFileStats:output_type -> blobber.service.v1.GetFileStatsResponse + 18, // 44: blobber.service.v1.Blobber.ListEntities:output_type -> blobber.service.v1.ListEntitiesResponse + 14, // 45: blobber.service.v1.Blobber.GetObjectPath:output_type -> blobber.service.v1.GetObjectPathResponse + 11, // 46: blobber.service.v1.Blobber.GetReferencePath:output_type -> blobber.service.v1.GetReferencePathResponse + 9, // 47: blobber.service.v1.Blobber.GetObjectTree:output_type -> blobber.service.v1.GetObjectTreeResponse + 29, // 48: blobber.service.v1.Blobber.DownloadFile:output_type -> blobber.service.v1.DownloadFileResponse + 36, // 49: blobber.service.v1.Blobber.RenameObject:output_type -> blobber.service.v1.RenameObjectResponse + 38, // 50: blobber.service.v1.Blobber.UploadFile:output_type -> blobber.service.v1.UploadFileResponse + 5, // 51: blobber.service.v1.Blobber.Commit:output_type -> blobber.service.v1.CommitResponse + 3, // 52: blobber.service.v1.Blobber.CalculateHash:output_type -> blobber.service.v1.CalculateHashResponse + 7, // 53: blobber.service.v1.Blobber.CommitMetaTxn:output_type -> blobber.service.v1.CommitMetaTxnResponse + 32, // 54: blobber.service.v1.Blobber.UpdateObjectAttributes:output_type -> blobber.service.v1.UpdateObjectAttributesResponse + 34, // 55: blobber.service.v1.Blobber.CopyObject:output_type -> blobber.service.v1.CopyObjectResponse + 1, // 56: blobber.service.v1.Blobber.Collaborator:output_type -> blobber.service.v1.CollaboratorResponse + 41, // [41:57] is the sub-list for method output_type + 25, // [25:41] is the sub-list for method input_type + 25, // [25:25] is the sub-list for extension type_name + 25, // [25:25] is the sub-list for extension extendee + 0, // [0:25] is the sub-list for field type_name } func init() { file_blobber_proto_init() } @@ -2621,7 +4287,7 @@ func file_blobber_proto_init() { } if !protoimpl.UnsafeEnabled { file_blobber_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetObjectTreeRequest); i { + switch v := v.(*CollaboratorRequest); i { case 0: return &v.state case 1: @@ -2633,7 +4299,7 @@ func file_blobber_proto_init() { } } file_blobber_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetObjectTreeResponse); i { + switch v := v.(*CollaboratorResponse); i { case 0: return &v.state case 1: @@ -2645,7 +4311,7 @@ func file_blobber_proto_init() { } } file_blobber_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetReferencePathRequest); i { + switch v := v.(*CalculateHashRequest); i { case 0: return &v.state case 1: @@ -2657,7 +4323,7 @@ func file_blobber_proto_init() { } } file_blobber_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetReferencePathResponse); i { + switch v := v.(*CalculateHashResponse); i { case 0: return &v.state case 1: @@ -2669,7 +4335,7 @@ func file_blobber_proto_init() { } } file_blobber_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ReferencePath); i { + switch v := v.(*CommitRequest); i { case 0: return &v.state case 1: @@ -2681,7 +4347,7 @@ func file_blobber_proto_init() { } } file_blobber_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetObjectPathRequest); i { + switch v := v.(*CommitResponse); i { case 0: return &v.state case 1: @@ -2693,7 +4359,7 @@ func file_blobber_proto_init() { } } file_blobber_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetObjectPathResponse); i { + switch v := v.(*CommitMetaTxnRequest); i { case 0: return &v.state case 1: @@ -2705,7 +4371,7 @@ func file_blobber_proto_init() { } } file_blobber_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ObjectPath); i { + switch v := v.(*CommitMetaTxnResponse); i { case 0: return &v.state case 1: @@ -2717,7 +4383,7 @@ func file_blobber_proto_init() { } } file_blobber_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*WriteMarker); i { + switch v := v.(*GetObjectTreeRequest); i { case 0: return &v.state case 1: @@ -2729,7 +4395,7 @@ func file_blobber_proto_init() { } } file_blobber_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ListEntitiesRequest); i { + switch v := v.(*GetObjectTreeResponse); i { case 0: return &v.state case 1: @@ -2741,7 +4407,7 @@ func file_blobber_proto_init() { } } file_blobber_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ListEntitiesResponse); i { + switch v := v.(*GetReferencePathRequest); i { case 0: return &v.state case 1: @@ -2753,7 +4419,7 @@ func file_blobber_proto_init() { } } file_blobber_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetFileStatsRequest); i { + switch v := v.(*GetReferencePathResponse); i { case 0: return &v.state case 1: @@ -2765,7 +4431,7 @@ func file_blobber_proto_init() { } } file_blobber_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetFileStatsResponse); i { + switch v := v.(*ReferencePath); i { case 0: return &v.state case 1: @@ -2777,7 +4443,7 @@ func file_blobber_proto_init() { } } file_blobber_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*FileStats); i { + switch v := v.(*GetObjectPathRequest); i { case 0: return &v.state case 1: @@ -2789,7 +4455,7 @@ func file_blobber_proto_init() { } } file_blobber_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetFileMetaDataRequest); i { + switch v := v.(*GetObjectPathResponse); i { case 0: return &v.state case 1: @@ -2801,7 +4467,7 @@ func file_blobber_proto_init() { } } file_blobber_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetFileMetaDataResponse); i { + switch v := v.(*ObjectPath); i { case 0: return &v.state case 1: @@ -2813,7 +4479,7 @@ func file_blobber_proto_init() { } } file_blobber_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CommitMetaTxn); i { + switch v := v.(*WriteMarker); i { case 0: return &v.state case 1: @@ -2825,7 +4491,7 @@ func file_blobber_proto_init() { } } file_blobber_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Collaborator); i { + switch v := v.(*ListEntitiesRequest); i { case 0: return &v.state case 1: @@ -2837,7 +4503,7 @@ func file_blobber_proto_init() { } } file_blobber_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RequestContext); i { + switch v := v.(*ListEntitiesResponse); i { case 0: return &v.state case 1: @@ -2849,7 +4515,7 @@ func file_blobber_proto_init() { } } file_blobber_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetAllocationRequest); i { + switch v := v.(*GetFileStatsRequest); i { case 0: return &v.state case 1: @@ -2861,7 +4527,7 @@ func file_blobber_proto_init() { } } file_blobber_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetAllocationResponse); i { + switch v := v.(*GetFileStatsResponse); i { case 0: return &v.state case 1: @@ -2873,7 +4539,7 @@ func file_blobber_proto_init() { } } file_blobber_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Allocation); i { + switch v := v.(*FileStats); i { case 0: return &v.state case 1: @@ -2885,7 +4551,7 @@ func file_blobber_proto_init() { } } file_blobber_proto_msgTypes[22].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Term); i { + switch v := v.(*GetFileMetaDataRequest); i { case 0: return &v.state case 1: @@ -2897,7 +4563,7 @@ func file_blobber_proto_init() { } } file_blobber_proto_msgTypes[23].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*FileRef); i { + switch v := v.(*GetFileMetaDataResponse); i { case 0: return &v.state case 1: @@ -2909,7 +4575,7 @@ func file_blobber_proto_init() { } } file_blobber_proto_msgTypes[24].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*FileMetaData); i { + switch v := v.(*CommitMetaTxn); i { case 0: return &v.state case 1: @@ -2921,6 +4587,222 @@ func file_blobber_proto_init() { } } file_blobber_proto_msgTypes[25].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Collaborator); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_blobber_proto_msgTypes[26].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetAllocationRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_blobber_proto_msgTypes[27].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetAllocationResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_blobber_proto_msgTypes[28].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DownloadFileRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_blobber_proto_msgTypes[29].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DownloadFileResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_blobber_proto_msgTypes[30].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ReadMaker); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_blobber_proto_msgTypes[31].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UpdateObjectAttributesRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_blobber_proto_msgTypes[32].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UpdateObjectAttributesResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_blobber_proto_msgTypes[33].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CopyObjectRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_blobber_proto_msgTypes[34].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CopyObjectResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_blobber_proto_msgTypes[35].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RenameObjectRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_blobber_proto_msgTypes[36].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RenameObjectResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_blobber_proto_msgTypes[37].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UploadFileRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_blobber_proto_msgTypes[38].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UploadFileResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_blobber_proto_msgTypes[39].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Allocation); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_blobber_proto_msgTypes[40].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Term); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_blobber_proto_msgTypes[41].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*FileRef); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_blobber_proto_msgTypes[42].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*FileMetaData); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_blobber_proto_msgTypes[43].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*DirMetaData); i { case 0: return &v.state @@ -2939,7 +4821,7 @@ func file_blobber_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_blobber_proto_rawDesc, NumEnums: 0, - NumMessages: 26, + NumMessages: 44, NumExtensions: 0, NumServices: 1, }, diff --git a/code/go/0chain.net/blobbercore/blobbergrpc/blobber.pb.gw.go b/code/go/0chain.net/blobbercore/blobbergrpc/blobber.pb.gw.go index 50dc6d47f..95062556c 100644 --- a/code/go/0chain.net/blobbercore/blobbergrpc/blobber.pb.gw.go +++ b/code/go/0chain.net/blobbercore/blobbergrpc/blobber.pb.gw.go @@ -67,14 +67,18 @@ func local_request_Blobber_GetAllocation_0(ctx context.Context, marshaler runtim } -var ( - filter_Blobber_GetFileMetaData_0 = &utilities.DoubleArray{Encoding: map[string]int{"allocation": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} -) - func request_Blobber_GetFileMetaData_0(ctx context.Context, marshaler runtime.Marshaler, client BlobberClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq GetFileMetaDataRequest var metadata runtime.ServerMetadata + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + var ( val string ok bool @@ -92,13 +96,6 @@ func request_Blobber_GetFileMetaData_0(ctx context.Context, marshaler runtime.Ma return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "allocation", err) } - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Blobber_GetFileMetaData_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - msg, err := client.GetFileMetaData(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err @@ -108,6 +105,14 @@ func local_request_Blobber_GetFileMetaData_0(ctx context.Context, marshaler runt var protoReq GetFileMetaDataRequest var metadata runtime.ServerMetadata + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + var ( val string ok bool @@ -125,26 +130,23 @@ func local_request_Blobber_GetFileMetaData_0(ctx context.Context, marshaler runt return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "allocation", err) } - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Blobber_GetFileMetaData_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - msg, err := server.GetFileMetaData(ctx, &protoReq) return msg, metadata, err } -var ( - filter_Blobber_GetFileStats_0 = &utilities.DoubleArray{Encoding: map[string]int{"allocation": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} -) - func request_Blobber_GetFileStats_0(ctx context.Context, marshaler runtime.Marshaler, client BlobberClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq GetFileStatsRequest var metadata runtime.ServerMetadata + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + var ( val string ok bool @@ -162,13 +164,6 @@ func request_Blobber_GetFileStats_0(ctx context.Context, marshaler runtime.Marsh return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "allocation", err) } - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Blobber_GetFileStats_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - msg, err := client.GetFileStats(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err @@ -178,6 +173,14 @@ func local_request_Blobber_GetFileStats_0(ctx context.Context, marshaler runtime var protoReq GetFileStatsRequest var metadata runtime.ServerMetadata + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + var ( val string ok bool @@ -195,13 +198,6 @@ func local_request_Blobber_GetFileStats_0(ctx context.Context, marshaler runtime return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "allocation", err) } - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Blobber_GetFileStats_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - msg, err := server.GetFileStats(ctx, &protoReq) return msg, metadata, err @@ -487,177 +483,1178 @@ func local_request_Blobber_GetObjectTree_0(ctx context.Context, marshaler runtim } -// RegisterBlobberHandlerServer registers the http handlers for service Blobber to "mux". -// UnaryRPC :call BlobberServer directly. -// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. -// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterBlobberHandlerFromEndpoint instead. -func RegisterBlobberHandlerServer(ctx context.Context, mux *runtime.ServeMux, server BlobberServer) error { +func request_Blobber_DownloadFile_0(ctx context.Context, marshaler runtime.Marshaler, client BlobberClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq DownloadFileRequest + var metadata runtime.ServerMetadata - mux.Handle("GET", pattern_Blobber_GetAllocation_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/blobber.service.v1.Blobber/GetAllocation") - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_Blobber_GetAllocation_0(rctx, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } - forward_Blobber_GetAllocation_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + var ( + val string + ok bool + err error + _ = err + ) - }) + val, ok = pathParams["allocation"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "allocation") + } - mux.Handle("GET", pattern_Blobber_GetFileMetaData_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/blobber.service.v1.Blobber/GetFileMetaData") - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_Blobber_GetFileMetaData_0(rctx, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } + protoReq.Allocation, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "allocation", err) + } - forward_Blobber_GetFileMetaData_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + msg, err := client.DownloadFile(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err - }) +} - mux.Handle("GET", pattern_Blobber_GetFileStats_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/blobber.service.v1.Blobber/GetFileStats") - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_Blobber_GetFileStats_0(rctx, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } +func local_request_Blobber_DownloadFile_0(ctx context.Context, marshaler runtime.Marshaler, server BlobberServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq DownloadFileRequest + var metadata runtime.ServerMetadata - forward_Blobber_GetFileStats_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } - }) + var ( + val string + ok bool + err error + _ = err + ) - mux.Handle("GET", pattern_Blobber_ListEntities_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/blobber.service.v1.Blobber/ListEntities") - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_Blobber_ListEntities_0(rctx, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } + val, ok = pathParams["allocation"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "allocation") + } - forward_Blobber_ListEntities_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + protoReq.Allocation, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "allocation", err) + } - }) + msg, err := server.DownloadFile(ctx, &protoReq) + return msg, metadata, err - mux.Handle("GET", pattern_Blobber_GetObjectPath_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/blobber.service.v1.Blobber/GetObjectPath") - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_Blobber_GetObjectPath_0(rctx, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } +} - forward_Blobber_GetObjectPath_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) +func request_Blobber_RenameObject_0(ctx context.Context, marshaler runtime.Marshaler, client BlobberClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq RenameObjectRequest + var metadata runtime.ServerMetadata - }) + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } - mux.Handle("GET", pattern_Blobber_GetReferencePath_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/blobber.service.v1.Blobber/GetReferencePath") - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_Blobber_GetReferencePath_0(rctx, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } + var ( + val string + ok bool + err error + _ = err + ) - forward_Blobber_GetReferencePath_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + val, ok = pathParams["allocation"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "allocation") + } - }) + protoReq.Allocation, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "allocation", err) + } - mux.Handle("GET", pattern_Blobber_GetObjectTree_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/blobber.service.v1.Blobber/GetObjectTree") - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_Blobber_GetObjectTree_0(rctx, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } + msg, err := client.RenameObject(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err - forward_Blobber_GetObjectTree_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) +} - }) +func local_request_Blobber_RenameObject_0(ctx context.Context, marshaler runtime.Marshaler, server BlobberServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq RenameObjectRequest + var metadata runtime.ServerMetadata - return nil -} + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } -// RegisterBlobberHandlerFromEndpoint is same as RegisterBlobberHandler but + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["allocation"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "allocation") + } + + protoReq.Allocation, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "allocation", err) + } + + msg, err := server.RenameObject(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Blobber_UploadFile_0(ctx context.Context, marshaler runtime.Marshaler, client BlobberClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq UploadFileRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["allocation"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "allocation") + } + + protoReq.Allocation, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "allocation", err) + } + + msg, err := client.UploadFile(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Blobber_UploadFile_0(ctx context.Context, marshaler runtime.Marshaler, server BlobberServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq UploadFileRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["allocation"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "allocation") + } + + protoReq.Allocation, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "allocation", err) + } + + msg, err := server.UploadFile(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Blobber_UploadFile_1(ctx context.Context, marshaler runtime.Marshaler, client BlobberClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq UploadFileRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["allocation"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "allocation") + } + + protoReq.Allocation, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "allocation", err) + } + + msg, err := client.UploadFile(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Blobber_UploadFile_1(ctx context.Context, marshaler runtime.Marshaler, server BlobberServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq UploadFileRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["allocation"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "allocation") + } + + protoReq.Allocation, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "allocation", err) + } + + msg, err := server.UploadFile(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Blobber_UploadFile_2(ctx context.Context, marshaler runtime.Marshaler, client BlobberClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq UploadFileRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["allocation"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "allocation") + } + + protoReq.Allocation, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "allocation", err) + } + + msg, err := client.UploadFile(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Blobber_UploadFile_2(ctx context.Context, marshaler runtime.Marshaler, server BlobberServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq UploadFileRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["allocation"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "allocation") + } + + protoReq.Allocation, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "allocation", err) + } + + msg, err := server.UploadFile(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Blobber_Commit_0(ctx context.Context, marshaler runtime.Marshaler, client BlobberClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq CommitRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["allocation"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "allocation") + } + + protoReq.Allocation, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "allocation", err) + } + + msg, err := client.Commit(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Blobber_Commit_0(ctx context.Context, marshaler runtime.Marshaler, server BlobberServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq CommitRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["allocation"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "allocation") + } + + protoReq.Allocation, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "allocation", err) + } + + msg, err := server.Commit(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Blobber_CalculateHash_0(ctx context.Context, marshaler runtime.Marshaler, client BlobberClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq CalculateHashRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["allocation"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "allocation") + } + + protoReq.Allocation, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "allocation", err) + } + + msg, err := client.CalculateHash(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Blobber_CalculateHash_0(ctx context.Context, marshaler runtime.Marshaler, server BlobberServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq CalculateHashRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["allocation"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "allocation") + } + + protoReq.Allocation, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "allocation", err) + } + + msg, err := server.CalculateHash(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Blobber_CommitMetaTxn_0(ctx context.Context, marshaler runtime.Marshaler, client BlobberClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq CommitMetaTxnRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["allocation"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "allocation") + } + + protoReq.Allocation, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "allocation", err) + } + + msg, err := client.CommitMetaTxn(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Blobber_CommitMetaTxn_0(ctx context.Context, marshaler runtime.Marshaler, server BlobberServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq CommitMetaTxnRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["allocation"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "allocation") + } + + protoReq.Allocation, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "allocation", err) + } + + msg, err := server.CommitMetaTxn(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Blobber_UpdateObjectAttributes_0(ctx context.Context, marshaler runtime.Marshaler, client BlobberClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq UpdateObjectAttributesRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["allocation"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "allocation") + } + + protoReq.Allocation, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "allocation", err) + } + + msg, err := client.UpdateObjectAttributes(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Blobber_UpdateObjectAttributes_0(ctx context.Context, marshaler runtime.Marshaler, server BlobberServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq UpdateObjectAttributesRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["allocation"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "allocation") + } + + protoReq.Allocation, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "allocation", err) + } + + msg, err := server.UpdateObjectAttributes(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Blobber_CopyObject_0(ctx context.Context, marshaler runtime.Marshaler, client BlobberClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq CopyObjectRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["allocation"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "allocation") + } + + protoReq.Allocation, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "allocation", err) + } + + msg, err := client.CopyObject(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Blobber_CopyObject_0(ctx context.Context, marshaler runtime.Marshaler, server BlobberServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq CopyObjectRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["allocation"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "allocation") + } + + protoReq.Allocation, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "allocation", err) + } + + msg, err := server.CopyObject(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Blobber_Collaborator_0(ctx context.Context, marshaler runtime.Marshaler, client BlobberClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq CollaboratorRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["allocation"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "allocation") + } + + protoReq.Allocation, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "allocation", err) + } + + msg, err := client.Collaborator(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Blobber_Collaborator_0(ctx context.Context, marshaler runtime.Marshaler, server BlobberServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq CollaboratorRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["allocation"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "allocation") + } + + protoReq.Allocation, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "allocation", err) + } + + msg, err := server.Collaborator(ctx, &protoReq) + return msg, metadata, err + +} + +// RegisterBlobberHandlerServer registers the http handlers for service Blobber to "mux". +// UnaryRPC :call BlobberServer directly. +// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. +// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterBlobberHandlerFromEndpoint instead. +func RegisterBlobberHandlerServer(ctx context.Context, mux *runtime.ServeMux, server BlobberServer) error { + + mux.Handle("GET", pattern_Blobber_GetAllocation_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/blobber.service.v1.Blobber/GetAllocation") + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Blobber_GetAllocation_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Blobber_GetAllocation_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_Blobber_GetFileMetaData_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/blobber.service.v1.Blobber/GetFileMetaData") + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Blobber_GetFileMetaData_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Blobber_GetFileMetaData_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_Blobber_GetFileStats_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/blobber.service.v1.Blobber/GetFileStats") + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Blobber_GetFileStats_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Blobber_GetFileStats_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Blobber_ListEntities_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/blobber.service.v1.Blobber/ListEntities") + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Blobber_ListEntities_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Blobber_ListEntities_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Blobber_GetObjectPath_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/blobber.service.v1.Blobber/GetObjectPath") + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Blobber_GetObjectPath_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Blobber_GetObjectPath_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Blobber_GetReferencePath_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/blobber.service.v1.Blobber/GetReferencePath") + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Blobber_GetReferencePath_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Blobber_GetReferencePath_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Blobber_GetObjectTree_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/blobber.service.v1.Blobber/GetObjectTree") + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Blobber_GetObjectTree_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Blobber_GetObjectTree_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_Blobber_DownloadFile_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/blobber.service.v1.Blobber/DownloadFile") + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Blobber_DownloadFile_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Blobber_DownloadFile_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_Blobber_RenameObject_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/blobber.service.v1.Blobber/RenameObject") + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Blobber_RenameObject_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Blobber_RenameObject_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_Blobber_UploadFile_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/blobber.service.v1.Blobber/UploadFile") + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Blobber_UploadFile_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Blobber_UploadFile_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("PUT", pattern_Blobber_UploadFile_1, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/blobber.service.v1.Blobber/UploadFile") + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Blobber_UploadFile_1(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Blobber_UploadFile_1(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("DELETE", pattern_Blobber_UploadFile_2, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/blobber.service.v1.Blobber/UploadFile") + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Blobber_UploadFile_2(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Blobber_UploadFile_2(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_Blobber_Commit_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/blobber.service.v1.Blobber/Commit") + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Blobber_Commit_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Blobber_Commit_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_Blobber_CalculateHash_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/blobber.service.v1.Blobber/CalculateHash") + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Blobber_CalculateHash_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Blobber_CalculateHash_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_Blobber_CommitMetaTxn_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/blobber.service.v1.Blobber/CommitMetaTxn") + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Blobber_CommitMetaTxn_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Blobber_CommitMetaTxn_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_Blobber_UpdateObjectAttributes_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/blobber.service.v1.Blobber/UpdateObjectAttributes") + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Blobber_UpdateObjectAttributes_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Blobber_UpdateObjectAttributes_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_Blobber_CopyObject_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/blobber.service.v1.Blobber/CopyObject") + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Blobber_CopyObject_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Blobber_CopyObject_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_Blobber_Collaborator_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/blobber.service.v1.Blobber/Collaborator") + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Blobber_Collaborator_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Blobber_Collaborator_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +// RegisterBlobberHandlerFromEndpoint is same as RegisterBlobberHandler but // automatically dials to "endpoint" and closes the connection when "ctx" gets done. func RegisterBlobberHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { conn, err := grpc.Dial(endpoint, opts...) @@ -715,7 +1712,7 @@ func RegisterBlobberHandlerClient(ctx context.Context, mux *runtime.ServeMux, cl }) - mux.Handle("GET", pattern_Blobber_GetFileMetaData_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("POST", pattern_Blobber_GetFileMetaData_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) @@ -735,7 +1732,7 @@ func RegisterBlobberHandlerClient(ctx context.Context, mux *runtime.ServeMux, cl }) - mux.Handle("GET", pattern_Blobber_GetFileStats_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("POST", pattern_Blobber_GetFileStats_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) @@ -835,6 +1832,226 @@ func RegisterBlobberHandlerClient(ctx context.Context, mux *runtime.ServeMux, cl }) + mux.Handle("POST", pattern_Blobber_DownloadFile_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req, "/blobber.service.v1.Blobber/DownloadFile") + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Blobber_DownloadFile_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Blobber_DownloadFile_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_Blobber_RenameObject_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req, "/blobber.service.v1.Blobber/RenameObject") + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Blobber_RenameObject_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Blobber_RenameObject_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_Blobber_UploadFile_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req, "/blobber.service.v1.Blobber/UploadFile") + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Blobber_UploadFile_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Blobber_UploadFile_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("PUT", pattern_Blobber_UploadFile_1, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req, "/blobber.service.v1.Blobber/UploadFile") + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Blobber_UploadFile_1(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Blobber_UploadFile_1(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("DELETE", pattern_Blobber_UploadFile_2, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req, "/blobber.service.v1.Blobber/UploadFile") + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Blobber_UploadFile_2(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Blobber_UploadFile_2(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_Blobber_Commit_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req, "/blobber.service.v1.Blobber/Commit") + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Blobber_Commit_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Blobber_Commit_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_Blobber_CalculateHash_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req, "/blobber.service.v1.Blobber/CalculateHash") + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Blobber_CalculateHash_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Blobber_CalculateHash_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_Blobber_CommitMetaTxn_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req, "/blobber.service.v1.Blobber/CommitMetaTxn") + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Blobber_CommitMetaTxn_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Blobber_CommitMetaTxn_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_Blobber_UpdateObjectAttributes_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req, "/blobber.service.v1.Blobber/UpdateObjectAttributes") + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Blobber_UpdateObjectAttributes_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Blobber_UpdateObjectAttributes_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_Blobber_CopyObject_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req, "/blobber.service.v1.Blobber/CopyObject") + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Blobber_CopyObject_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Blobber_CopyObject_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_Blobber_Collaborator_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req, "/blobber.service.v1.Blobber/Collaborator") + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Blobber_Collaborator_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Blobber_Collaborator_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -852,6 +2069,28 @@ var ( pattern_Blobber_GetReferencePath_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"v2", "file", "referencepath", "allocation"}, "")) pattern_Blobber_GetObjectTree_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"v2", "file", "objecttree", "allocation"}, "")) + + pattern_Blobber_DownloadFile_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"v2", "file", "download", "allocation"}, "")) + + pattern_Blobber_RenameObject_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"v2", "file", "rename", "allocation"}, "")) + + pattern_Blobber_UploadFile_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"v2", "file", "upload", "allocation"}, "")) + + pattern_Blobber_UploadFile_1 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"v2", "file", "upload", "allocation"}, "")) + + pattern_Blobber_UploadFile_2 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"v2", "file", "upload", "allocation"}, "")) + + pattern_Blobber_Commit_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"v2", "connection", "commit", "allocation"}, "")) + + pattern_Blobber_CalculateHash_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"v2", "file", "calculatehash", "allocation"}, "")) + + pattern_Blobber_CommitMetaTxn_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"v2", "file", "commitmetatxn", "allocation"}, "")) + + pattern_Blobber_UpdateObjectAttributes_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"v2", "file", "attributes", "allocation"}, "")) + + pattern_Blobber_CopyObject_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"v2", "file", "copy", "allocation"}, "")) + + pattern_Blobber_Collaborator_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"v2", "file", "collaborator", "allocation"}, "")) ) var ( @@ -868,4 +2107,26 @@ var ( forward_Blobber_GetReferencePath_0 = runtime.ForwardResponseMessage forward_Blobber_GetObjectTree_0 = runtime.ForwardResponseMessage + + forward_Blobber_DownloadFile_0 = runtime.ForwardResponseMessage + + forward_Blobber_RenameObject_0 = runtime.ForwardResponseMessage + + forward_Blobber_UploadFile_0 = runtime.ForwardResponseMessage + + forward_Blobber_UploadFile_1 = runtime.ForwardResponseMessage + + forward_Blobber_UploadFile_2 = runtime.ForwardResponseMessage + + forward_Blobber_Commit_0 = runtime.ForwardResponseMessage + + forward_Blobber_CalculateHash_0 = runtime.ForwardResponseMessage + + forward_Blobber_CommitMetaTxn_0 = runtime.ForwardResponseMessage + + forward_Blobber_UpdateObjectAttributes_0 = runtime.ForwardResponseMessage + + forward_Blobber_CopyObject_0 = runtime.ForwardResponseMessage + + forward_Blobber_Collaborator_0 = runtime.ForwardResponseMessage ) diff --git a/code/go/0chain.net/blobbercore/blobbergrpc/blobber_grpc.pb.go b/code/go/0chain.net/blobbercore/blobbergrpc/blobber_grpc.pb.go index e73fdcaf5..692be278d 100644 --- a/code/go/0chain.net/blobbercore/blobbergrpc/blobber_grpc.pb.go +++ b/code/go/0chain.net/blobbercore/blobbergrpc/blobber_grpc.pb.go @@ -24,6 +24,15 @@ type BlobberClient interface { GetObjectPath(ctx context.Context, in *GetObjectPathRequest, opts ...grpc.CallOption) (*GetObjectPathResponse, error) GetReferencePath(ctx context.Context, in *GetReferencePathRequest, opts ...grpc.CallOption) (*GetReferencePathResponse, error) GetObjectTree(ctx context.Context, in *GetObjectTreeRequest, opts ...grpc.CallOption) (*GetObjectTreeResponse, error) + DownloadFile(ctx context.Context, in *DownloadFileRequest, opts ...grpc.CallOption) (*DownloadFileResponse, error) + RenameObject(ctx context.Context, in *RenameObjectRequest, opts ...grpc.CallOption) (*RenameObjectResponse, error) + UploadFile(ctx context.Context, in *UploadFileRequest, opts ...grpc.CallOption) (*UploadFileResponse, error) + Commit(ctx context.Context, in *CommitRequest, opts ...grpc.CallOption) (*CommitResponse, error) + CalculateHash(ctx context.Context, in *CalculateHashRequest, opts ...grpc.CallOption) (*CalculateHashResponse, error) + CommitMetaTxn(ctx context.Context, in *CommitMetaTxnRequest, opts ...grpc.CallOption) (*CommitMetaTxnResponse, error) + UpdateObjectAttributes(ctx context.Context, in *UpdateObjectAttributesRequest, opts ...grpc.CallOption) (*UpdateObjectAttributesResponse, error) + CopyObject(ctx context.Context, in *CopyObjectRequest, opts ...grpc.CallOption) (*CopyObjectResponse, error) + Collaborator(ctx context.Context, in *CollaboratorRequest, opts ...grpc.CallOption) (*CollaboratorResponse, error) } type blobberClient struct { @@ -97,6 +106,87 @@ func (c *blobberClient) GetObjectTree(ctx context.Context, in *GetObjectTreeRequ return out, nil } +func (c *blobberClient) DownloadFile(ctx context.Context, in *DownloadFileRequest, opts ...grpc.CallOption) (*DownloadFileResponse, error) { + out := new(DownloadFileResponse) + err := c.cc.Invoke(ctx, "/blobber.service.v1.Blobber/DownloadFile", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *blobberClient) RenameObject(ctx context.Context, in *RenameObjectRequest, opts ...grpc.CallOption) (*RenameObjectResponse, error) { + out := new(RenameObjectResponse) + err := c.cc.Invoke(ctx, "/blobber.service.v1.Blobber/RenameObject", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *blobberClient) UploadFile(ctx context.Context, in *UploadFileRequest, opts ...grpc.CallOption) (*UploadFileResponse, error) { + out := new(UploadFileResponse) + err := c.cc.Invoke(ctx, "/blobber.service.v1.Blobber/UploadFile", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *blobberClient) Commit(ctx context.Context, in *CommitRequest, opts ...grpc.CallOption) (*CommitResponse, error) { + out := new(CommitResponse) + err := c.cc.Invoke(ctx, "/blobber.service.v1.Blobber/Commit", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *blobberClient) CalculateHash(ctx context.Context, in *CalculateHashRequest, opts ...grpc.CallOption) (*CalculateHashResponse, error) { + out := new(CalculateHashResponse) + err := c.cc.Invoke(ctx, "/blobber.service.v1.Blobber/CalculateHash", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *blobberClient) CommitMetaTxn(ctx context.Context, in *CommitMetaTxnRequest, opts ...grpc.CallOption) (*CommitMetaTxnResponse, error) { + out := new(CommitMetaTxnResponse) + err := c.cc.Invoke(ctx, "/blobber.service.v1.Blobber/CommitMetaTxn", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *blobberClient) UpdateObjectAttributes(ctx context.Context, in *UpdateObjectAttributesRequest, opts ...grpc.CallOption) (*UpdateObjectAttributesResponse, error) { + out := new(UpdateObjectAttributesResponse) + err := c.cc.Invoke(ctx, "/blobber.service.v1.Blobber/UpdateObjectAttributes", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *blobberClient) CopyObject(ctx context.Context, in *CopyObjectRequest, opts ...grpc.CallOption) (*CopyObjectResponse, error) { + out := new(CopyObjectResponse) + err := c.cc.Invoke(ctx, "/blobber.service.v1.Blobber/CopyObject", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *blobberClient) Collaborator(ctx context.Context, in *CollaboratorRequest, opts ...grpc.CallOption) (*CollaboratorResponse, error) { + out := new(CollaboratorResponse) + err := c.cc.Invoke(ctx, "/blobber.service.v1.Blobber/Collaborator", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // BlobberServer is the server API for Blobber service. // All implementations must embed UnimplementedBlobberServer // for forward compatibility @@ -108,6 +198,15 @@ type BlobberServer interface { GetObjectPath(context.Context, *GetObjectPathRequest) (*GetObjectPathResponse, error) GetReferencePath(context.Context, *GetReferencePathRequest) (*GetReferencePathResponse, error) GetObjectTree(context.Context, *GetObjectTreeRequest) (*GetObjectTreeResponse, error) + DownloadFile(context.Context, *DownloadFileRequest) (*DownloadFileResponse, error) + RenameObject(context.Context, *RenameObjectRequest) (*RenameObjectResponse, error) + UploadFile(context.Context, *UploadFileRequest) (*UploadFileResponse, error) + Commit(context.Context, *CommitRequest) (*CommitResponse, error) + CalculateHash(context.Context, *CalculateHashRequest) (*CalculateHashResponse, error) + CommitMetaTxn(context.Context, *CommitMetaTxnRequest) (*CommitMetaTxnResponse, error) + UpdateObjectAttributes(context.Context, *UpdateObjectAttributesRequest) (*UpdateObjectAttributesResponse, error) + CopyObject(context.Context, *CopyObjectRequest) (*CopyObjectResponse, error) + Collaborator(context.Context, *CollaboratorRequest) (*CollaboratorResponse, error) mustEmbedUnimplementedBlobberServer() } @@ -136,6 +235,33 @@ func (UnimplementedBlobberServer) GetReferencePath(context.Context, *GetReferenc func (UnimplementedBlobberServer) GetObjectTree(context.Context, *GetObjectTreeRequest) (*GetObjectTreeResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method GetObjectTree not implemented") } +func (UnimplementedBlobberServer) DownloadFile(context.Context, *DownloadFileRequest) (*DownloadFileResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method DownloadFile not implemented") +} +func (UnimplementedBlobberServer) RenameObject(context.Context, *RenameObjectRequest) (*RenameObjectResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method RenameObject not implemented") +} +func (UnimplementedBlobberServer) UploadFile(context.Context, *UploadFileRequest) (*UploadFileResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UploadFile not implemented") +} +func (UnimplementedBlobberServer) Commit(context.Context, *CommitRequest) (*CommitResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Commit not implemented") +} +func (UnimplementedBlobberServer) CalculateHash(context.Context, *CalculateHashRequest) (*CalculateHashResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CalculateHash not implemented") +} +func (UnimplementedBlobberServer) CommitMetaTxn(context.Context, *CommitMetaTxnRequest) (*CommitMetaTxnResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CommitMetaTxn not implemented") +} +func (UnimplementedBlobberServer) UpdateObjectAttributes(context.Context, *UpdateObjectAttributesRequest) (*UpdateObjectAttributesResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateObjectAttributes not implemented") +} +func (UnimplementedBlobberServer) CopyObject(context.Context, *CopyObjectRequest) (*CopyObjectResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CopyObject not implemented") +} +func (UnimplementedBlobberServer) Collaborator(context.Context, *CollaboratorRequest) (*CollaboratorResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Collaborator not implemented") +} func (UnimplementedBlobberServer) mustEmbedUnimplementedBlobberServer() {} // UnsafeBlobberServer may be embedded to opt out of forward compatibility for this service. @@ -275,6 +401,168 @@ func _Blobber_GetObjectTree_Handler(srv interface{}, ctx context.Context, dec fu return interceptor(ctx, in, info, handler) } +func _Blobber_DownloadFile_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DownloadFileRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(BlobberServer).DownloadFile(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/blobber.service.v1.Blobber/DownloadFile", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(BlobberServer).DownloadFile(ctx, req.(*DownloadFileRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Blobber_RenameObject_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(RenameObjectRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(BlobberServer).RenameObject(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/blobber.service.v1.Blobber/RenameObject", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(BlobberServer).RenameObject(ctx, req.(*RenameObjectRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Blobber_UploadFile_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UploadFileRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(BlobberServer).UploadFile(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/blobber.service.v1.Blobber/UploadFile", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(BlobberServer).UploadFile(ctx, req.(*UploadFileRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Blobber_Commit_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CommitRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(BlobberServer).Commit(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/blobber.service.v1.Blobber/Commit", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(BlobberServer).Commit(ctx, req.(*CommitRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Blobber_CalculateHash_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CalculateHashRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(BlobberServer).CalculateHash(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/blobber.service.v1.Blobber/CalculateHash", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(BlobberServer).CalculateHash(ctx, req.(*CalculateHashRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Blobber_CommitMetaTxn_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CommitMetaTxnRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(BlobberServer).CommitMetaTxn(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/blobber.service.v1.Blobber/CommitMetaTxn", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(BlobberServer).CommitMetaTxn(ctx, req.(*CommitMetaTxnRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Blobber_UpdateObjectAttributes_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UpdateObjectAttributesRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(BlobberServer).UpdateObjectAttributes(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/blobber.service.v1.Blobber/UpdateObjectAttributes", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(BlobberServer).UpdateObjectAttributes(ctx, req.(*UpdateObjectAttributesRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Blobber_CopyObject_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CopyObjectRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(BlobberServer).CopyObject(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/blobber.service.v1.Blobber/CopyObject", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(BlobberServer).CopyObject(ctx, req.(*CopyObjectRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Blobber_Collaborator_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CollaboratorRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(BlobberServer).Collaborator(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/blobber.service.v1.Blobber/Collaborator", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(BlobberServer).Collaborator(ctx, req.(*CollaboratorRequest)) + } + return interceptor(ctx, in, info, handler) +} + var _Blobber_serviceDesc = grpc.ServiceDesc{ ServiceName: "blobber.service.v1.Blobber", HandlerType: (*BlobberServer)(nil), @@ -307,6 +595,42 @@ var _Blobber_serviceDesc = grpc.ServiceDesc{ MethodName: "GetObjectTree", Handler: _Blobber_GetObjectTree_Handler, }, + { + MethodName: "DownloadFile", + Handler: _Blobber_DownloadFile_Handler, + }, + { + MethodName: "RenameObject", + Handler: _Blobber_RenameObject_Handler, + }, + { + MethodName: "UploadFile", + Handler: _Blobber_UploadFile_Handler, + }, + { + MethodName: "Commit", + Handler: _Blobber_Commit_Handler, + }, + { + MethodName: "CalculateHash", + Handler: _Blobber_CalculateHash_Handler, + }, + { + MethodName: "CommitMetaTxn", + Handler: _Blobber_CommitMetaTxn_Handler, + }, + { + MethodName: "UpdateObjectAttributes", + Handler: _Blobber_UpdateObjectAttributes_Handler, + }, + { + MethodName: "CopyObject", + Handler: _Blobber_CopyObject_Handler, + }, + { + MethodName: "Collaborator", + Handler: _Blobber_Collaborator_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "blobber.proto", diff --git a/code/go/0chain.net/blobbercore/blobbergrpc/proto/blobber.proto b/code/go/0chain.net/blobbercore/blobbergrpc/proto/blobber.proto index 0fb9e7e3a..96cfa07c1 100644 --- a/code/go/0chain.net/blobbercore/blobbergrpc/proto/blobber.proto +++ b/code/go/0chain.net/blobbercore/blobbergrpc/proto/blobber.proto @@ -1,7 +1,7 @@ syntax = "proto3"; package blobber.service.v1; -option go_package = "./blobbergrpc"; +option go_package = "code/go/0chain.net/blobbercore/blobbergrpc"; import "google/api/annotations.proto"; @@ -14,12 +14,14 @@ service Blobber { } rpc GetFileMetaData(GetFileMetaDataRequest) returns (GetFileMetaDataResponse) { option (google.api.http) = { - get: "/v2/file/meta/{allocation}" + post: "/v2/file/meta/{allocation}" + body: "*" }; } rpc GetFileStats(GetFileStatsRequest) returns (GetFileStatsResponse) { option (google.api.http) = { - get: "/v2/file/stats/{allocation}" + post: "/v2/file/stats/{allocation}" + body: "*" }; } rpc ListEntities(ListEntitiesRequest) returns (ListEntitiesResponse) { @@ -42,213 +44,419 @@ service Blobber { get: "/v2/file/objecttree/{allocation}" }; } + rpc DownloadFile(DownloadFileRequest) returns (DownloadFileResponse) { + option (google.api.http) = { + post: "/v2/file/download/{allocation}" + body: "*" + }; + } + rpc RenameObject(RenameObjectRequest) returns (RenameObjectResponse) { + option (google.api.http) = { + post: "/v2/file/rename/{allocation}" + body: "*" + }; + } + rpc UploadFile(UploadFileRequest) returns (UploadFileResponse) { + option (google.api.http) = { + post: "/v2/file/upload/{allocation}" + body: "*" + additional_bindings: { + put: "/v2/file/upload/{allocation}" + body: "*" + } + additional_bindings: { + delete: "/v2/file/upload/{allocation}" + body: "*" + } + }; + } + + rpc Commit(CommitRequest) returns (CommitResponse) { + option (google.api.http) = { + post: "/v2/connection/commit/{allocation}" + body: "*" + }; + } + + rpc CalculateHash(CalculateHashRequest) returns (CalculateHashResponse) { + option (google.api.http) = { + post: "/v2/file/calculatehash/{allocation}" + body: "*" + }; + } + + rpc CommitMetaTxn(CommitMetaTxnRequest) returns (CommitMetaTxnResponse) { + option (google.api.http) = { + post: "/v2/file/commitmetatxn/{allocation}" + body: "*" + }; + } + + rpc UpdateObjectAttributes(UpdateObjectAttributesRequest) returns (UpdateObjectAttributesResponse) { + option (google.api.http) = { + post: "/v2/file/attributes/{allocation}" + body: "*" + }; + } + + rpc CopyObject(CopyObjectRequest) returns (CopyObjectResponse) { + option (google.api.http) = { + post: "/v2/file/copy/{allocation}" + body: "*" + }; + } + + rpc Collaborator(CollaboratorRequest) returns (CollaboratorResponse) { + option (google.api.http) = { + post: "/v2/file/collaborator/{allocation}" + body: "*" + }; + } } -message GetObjectTreeRequest { - RequestContext context = 1; +message CollaboratorRequest { + string allocation = 1; + string collab_id = 2; + string method = 3; + string path = 4; + string path_hash = 5; +} + +message CollaboratorResponse { + string message = 1; + repeated Collaborator collaborators = 2; +} + +message CalculateHashRequest { + string allocation = 1; string path = 2; - string allocation = 3; + string paths = 3; +} + +message CalculateHashResponse { + string message = 1; +} + +message CommitRequest { + string allocation = 1; + string connection_id = 2; + string write_marker = 3; +} + + +message CommitResponse { + string allocation_root = 1; + WriteMarker write_marker = 2; + string error_message = 3; + bool success = 4; +} + +message CommitMetaTxnRequest { + string path = 1; + string path_hash = 2; + string auth_token = 3; + string allocation = 4; + string txn_id = 5; +} + +message CommitMetaTxnResponse { + string message = 1; +} + +message GetObjectTreeRequest { + string path = 1; + string allocation = 2; } message GetObjectTreeResponse { - ReferencePath ReferencePath = 1; - WriteMarker LatestWM = 2; + ReferencePath reference_path = 1; + WriteMarker latest_wm = 2; } message GetReferencePathRequest { - RequestContext Context = 1; - string Paths = 2; - string Path = 3; - string allocation = 4; + string paths = 1; + string path = 2; + string allocation = 3; } message GetReferencePathResponse { - ReferencePath ReferencePath = 1; - WriteMarker LatestWM = 2; + ReferencePath reference_path = 1; + WriteMarker latest_wm = 2; } message ReferencePath { - FileRef MetaData = 1; - repeated ReferencePath List = 2; + FileRef meta_data = 1; + repeated ReferencePath list = 2; } message GetObjectPathRequest { - RequestContext context = 1; - string allocation = 2; - string Path = 3; - string BlockNum = 4; + string allocation = 1; + string path = 2; + string block_num = 3; } message GetObjectPathResponse { - ObjectPath ObjectPath = 1; - WriteMarker LatestWriteMarker = 2; + ObjectPath object_path = 1; + WriteMarker latest_write_marker = 2; } message ObjectPath { - string RootHash = 1; - FileRef Meta = 2; - FileRef Path = 3; - int64 FileBlockNum = 4; + string root_hash = 1; + FileRef meta = 2; + FileRef path = 3; + repeated FileRef path_list = 4; + int64 file_block_num = 5; } message WriteMarker { - string AllocationRoot = 1; - string PreviousAllocationRoot = 2; - string AllocationID = 3; - int64 Size = 4; - string BlobberID = 5; - int64 Timestamp = 6; - string ClientID = 7; - string Signature = 8; + string allocation_root = 1; + string previous_allocation_root = 2; + string allocation_id = 3; + int64 size = 4; + string blobber_id = 5; + int64 timestamp = 6; + string client_id = 7; + string signature = 8; } message ListEntitiesRequest { - RequestContext context = 1; - string path = 2; - string path_hash = 3; - string auth_token = 4; - string allocation = 5; + string path = 1; + string path_hash = 2; + string auth_token = 3; + string allocation = 4; } message ListEntitiesResponse { - string AllocationRoot = 1; - FileRef MetaData = 2; + string allocation_root = 1; + FileRef meta_data = 2; + repeated FileRef entities = 3; } message GetFileStatsRequest { - RequestContext context = 1; - string path = 2; - string path_hash = 3; - string allocation = 4; + string path = 1; + string path_hash = 2; + string allocation = 3; } message GetFileStatsResponse { - FileRef MetaData = 1; - FileStats Stats = 2; + FileRef meta_data = 1; + FileStats stats = 2; } message FileStats { - int64 ID = 1; - int64 RefID = 2; - int64 NumUpdates = 3; - int64 NumBlockDownloads = 4; - int64 SuccessChallenges = 5; - int64 FailedChallenges = 6; - string LastChallengeResponseTxn = 7; - string WriteMarkerRedeemTxn = 8; - int64 CreatedAt = 9; - int64 UpdatedAt = 10; + int64 id = 1; + int64 ref_id = 2; + int64 num_updates = 3; + int64 num_block_downloads = 4; + int64 success_challenges = 5; + int64 failed_challenges = 6; + string last_challenge_response_txn = 7; + string write_marker_redeem_txn = 8; + int64 created_at = 9; + int64 updated_at = 10; } message GetFileMetaDataRequest { - RequestContext context = 1; - string path = 2; - string path_hash = 3; - string auth_token = 4; - string allocation = 5; + string path = 1; + string path_hash = 2; + string auth_token = 3; + string allocation = 4; } message GetFileMetaDataResponse { - FileRef MetaData = 1; - repeated Collaborator Collaborators = 2; + FileRef meta_data = 1; + repeated Collaborator collaborators = 2; } message CommitMetaTxn { - int64 RefId = 1; - string TxnId = 2; - int64 CreatedAt = 3; + int64 ref_id = 1; + string txn_id = 2; + int64 created_at = 3; } message Collaborator { - int64 RefId = 1; - string ClientId = 2; - int64 CreatedAt = 3; -} - -message RequestContext { - string client = 1; - string client_key = 2; - string allocation = 3; + int64 ref_id = 1; + string client_id = 2; + int64 created_at = 3; } message GetAllocationRequest { - RequestContext context = 1; - string id = 2; + string id = 1; } message GetAllocationResponse { Allocation allocation = 1; } +message DownloadFileRequest { + string allocation = 1; + string path = 2; + string path_hash = 3; + string rx_pay = 4; + string block_num = 5; + string num_blocks = 6; + string read_marker = 7; + string auth_token = 8; + string content = 9; +} +message DownloadFileResponse { + bool success = 1; + bytes data = 2; + string allocation_id = 3; + string path = 4; + ReadMaker latest_rm = 5; +} + +message ReadMaker { + string client_id = 1; + string client_public_key = 2; + string blobber_id = 3; + string allocation_id = 4; + string owner_id = 5; + int64 timestamp = 6; + int64 counter = 7; + string signature = 8; + int64 suspend = 9; + string payer_id = 10; + bytes auth_ticket = 11; +} + +message UpdateObjectAttributesRequest { + string allocation = 1; + string path = 2; + string path_hash = 3; + string connection_id = 4; + string attributes = 5; +} +message UpdateObjectAttributesResponse { + int64 who_pays_for_reads = 1; +} + +message CopyObjectRequest { + string allocation = 1; + string path = 2; + string path_hash = 3; + string connection_id = 4; + string dest = 5; +} +message CopyObjectResponse { + string filename = 1; + int64 size = 2; + string content_hash = 3; + string merkle_root = 4; + //UploadLength indicates the size of the entire upload in bytes. The value MUST be a non-negative integer. + int64 upload_length = 5; + //Upload-Offset indicates a byte offset within a resource. The value MUST be a non-negative integer. + int64 upload_offset = 6; +} + +message RenameObjectRequest { + string allocation = 1; + string path = 2; + string path_hash = 3; + string connection_id = 4; + string new_name = 5; +} +message RenameObjectResponse { + string filename = 1; + int64 size = 2; + string content_hash = 3; + string merkle_root = 4; + //UploadLength indicates the size of the entire upload in bytes. The value MUST be a non-negative integer. + int64 upload_length = 5; + //Upload-Offset indicates a byte offset within a resource. The value MUST be a non-negative integer. + int64 upload_offset = 6; +} + +message UploadFileRequest { + string allocation = 1; + string path = 2; + string connection_id = 3; + string method = 4; + string upload_meta = 5; + string update_meta = 6; + bytes upload_file = 7; + bytes upload_thumbnail_file = 8; +} +message UploadFileResponse { + string filename = 1; + int64 size = 2; + string content_hash = 3; + string merkle_root = 4; + //UploadLength indicates the size of the entire upload in bytes. The value MUST be a non-negative integer. + int64 upload_length = 5; + //Upload-Offset indicates a byte offset within a resource. The value MUST be a non-negative integer. + int64 upload_offset = 6; +} + message Allocation { - string ID = 1; - string Tx = 2; - int64 TotalSize = 3; - int64 UsedSize = 4; - string OwnerID = 5; - string OwnerPublicKey = 6; - string RepairerID = 7; - string PayerID = 8; - int64 Expiration = 9; - string AllocationRoot = 10; - int64 BlobberSize = 11; - int64 BlobberSizeUsed = 12; - string LatestRedeemedWM = 13; - bool IsRedeemRequired = 14; - int64 TimeUnit = 15; - bool CleanedUp = 16; - bool Finalized = 17; - repeated Term Terms = 18; + string id = 1; + string tx = 2; + int64 total_size = 3; + int64 used_size = 4; + string owner_id = 5; + string owner_public_key = 6; + string repairer_id = 7; + string payer_id = 8; + int64 expiration = 9; + string allocation_root = 10; + int64 blobber_size = 11; + int64 blobber_size_used = 12; + string latest_redeemed_wm = 13; + bool is_redeem_required = 14; + int64 time_unit = 15; + bool cleaned_up = 16; + bool finalized = 17; + repeated Term terms = 18; } message Term { - int64 ID = 1; - string BlobberID = 2; - string AllocationID = 3; - int64 ReadPrice = 4; - int64 WritePrice = 5; + int64 id = 1; + string blobber_id = 2; + string allocation_id = 3; + int64 read_price = 4; + int64 write_price = 5; } message FileRef { - string Type = 1; - FileMetaData FileMetaData = 2; - DirMetaData DirMetaData = 3; + string type = 1; + FileMetaData file_meta_data = 2; + DirMetaData dir_meta_data = 3; } message FileMetaData { - string Type = 1; - string LookupHash = 2; - string Name = 3; - string Path = 4; - string Hash = 5; - int64 NumBlocks = 6; - string PathHash = 7; - string CustomMeta = 8; - string ContentHash = 9; - int64 Size = 10; - string MerkleRoot = 11; - int64 ActualFileSize = 12; - string ActualFileHash = 13; - string MimeType = 14; - int64 ThumbnailSize = 15; - string ThumbnailHash = 16; - int64 ActualThumbnailSize = 17; - string ActualThumbnailHash = 18; - string EncryptedKey = 19; - bytes Attributes = 20; - bool OnCloud = 21; - repeated CommitMetaTxn CommitMetaTxns = 22; - int64 CreatedAt = 23; - int64 UpdatedAt = 24; + string type = 1; + string lookup_hash = 2; + string name = 3; + string path = 4; + string hash = 5; + int64 num_blocks = 6; + string path_hash = 7; + string custom_meta = 8; + string content_hash = 9; + int64 size = 10; + string merkle_root = 11; + int64 actual_file_size = 12; + string actual_file_hash = 13; + string mime_type = 14; + int64 thumbnail_size = 15; + string thumbnail_hash = 16; + int64 actual_thumbnail_size = 17; + string actual_thumbnail_hash = 18; + string encrypted_key = 19; + bytes attributes = 20; + bool on_cloud = 21; + repeated CommitMetaTxn commit_meta_txns = 22; + int64 created_at = 23; + int64 updated_at = 24; } message DirMetaData { - string Type = 1; - string LookupHash = 2; - string Name = 3; - string Path = 4; - string Hash = 5; - int64 NumBlocks = 6; - string PathHash = 7; - int64 Size = 8; - int64 CreatedAt = 9; - int64 UpdatedAt = 10; - repeated FileRef Children = 11; + string type = 1; + string lookup_hash = 2; + string name = 3; + string path = 4; + string hash = 5; + int64 num_blocks = 6; + string path_hash = 7; + int64 size = 8; + int64 created_at = 9; + int64 updated_at = 10; } \ No newline at end of file diff --git a/code/go/0chain.net/blobbercore/handler/dto.go b/code/go/0chain.net/blobbercore/blobberhttp/response.go similarity index 76% rename from code/go/0chain.net/blobbercore/handler/dto.go rename to code/go/0chain.net/blobbercore/blobberhttp/response.go index 98bc27aee..e09b4430a 100644 --- a/code/go/0chain.net/blobbercore/handler/dto.go +++ b/code/go/0chain.net/blobbercore/blobberhttp/response.go @@ -1,10 +1,11 @@ -package handler +package blobberhttp import ( - "0chain.net/blobbercore/allocation" - "0chain.net/blobbercore/readmarker" - "0chain.net/blobbercore/reference" - "0chain.net/blobbercore/writemarker" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/allocation" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/readmarker" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/reference" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/writemarker" + "github.com/0chain/blobber/code/go/0chain.net/core/common" ) type UploadResult struct { @@ -28,14 +29,8 @@ type CommitResult struct { //Result []*UploadResult `json:"result"` } -type ReferencePath struct { - Meta map[string]interface{} `json:"meta_data"` - List []*ReferencePath `json:"list,omitempty"` - ref *reference.Ref -} - type ReferencePathResult struct { - *ReferencePath + *reference.ReferencePath LatestWM *writemarker.WriteMarker `json:"latest_write_marker"` } @@ -57,3 +52,7 @@ type DownloadResponse struct { Path string `json:"-"` LatestRM *readmarker.ReadMarker `json:"latest_rm"` } + +type UpdateObjectAttributesResponse struct { + WhoPaysForReads common.WhoPays `json:"who_pays_for_reads,omitempty"` +} diff --git a/code/go/0chain.net/blobbercore/challenge/entity.go b/code/go/0chain.net/blobbercore/challenge/entity.go index c47fc7fc3..7b6fcd7a4 100644 --- a/code/go/0chain.net/blobbercore/challenge/entity.go +++ b/code/go/0chain.net/blobbercore/challenge/entity.go @@ -5,10 +5,10 @@ import ( "encoding/json" "fmt" - "0chain.net/blobbercore/datastore" - "0chain.net/blobbercore/reference" - "0chain.net/core/common" - "0chain.net/core/encryption" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/datastore" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/reference" + "github.com/0chain/blobber/code/go/0chain.net/core/common" + "github.com/0chain/blobber/code/go/0chain.net/core/encryption" "gorm.io/datatypes" ) diff --git a/code/go/0chain.net/blobbercore/challenge/protocol.go b/code/go/0chain.net/blobbercore/challenge/protocol.go index 74b86909c..0f2cc5dc5 100644 --- a/code/go/0chain.net/blobbercore/challenge/protocol.go +++ b/code/go/0chain.net/blobbercore/challenge/protocol.go @@ -6,15 +6,15 @@ import ( "math/rand" "time" - "0chain.net/blobbercore/allocation" - "0chain.net/blobbercore/filestore" - "0chain.net/blobbercore/reference" - "0chain.net/blobbercore/writemarker" - "0chain.net/core/chain" - "0chain.net/core/common" - . "0chain.net/core/logging" - "0chain.net/core/transaction" - "0chain.net/core/util" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/allocation" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/filestore" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/reference" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/writemarker" + "github.com/0chain/blobber/code/go/0chain.net/core/chain" + "github.com/0chain/blobber/code/go/0chain.net/core/common" + . "github.com/0chain/blobber/code/go/0chain.net/core/logging" + "github.com/0chain/blobber/code/go/0chain.net/core/transaction" + "github.com/0chain/blobber/code/go/0chain.net/core/util" "go.uber.org/zap" ) diff --git a/code/go/0chain.net/blobbercore/challenge/stats.go b/code/go/0chain.net/blobbercore/challenge/stats.go index 4a0e4e701..924a43fe0 100644 --- a/code/go/0chain.net/blobbercore/challenge/stats.go +++ b/code/go/0chain.net/blobbercore/challenge/stats.go @@ -3,8 +3,8 @@ package challenge import ( "context" - "0chain.net/blobbercore/datastore" - "0chain.net/blobbercore/stats" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/datastore" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/stats" "gorm.io/gorm" ) diff --git a/code/go/0chain.net/blobbercore/challenge/worker.go b/code/go/0chain.net/blobbercore/challenge/worker.go index 1c394d97c..339730644 100644 --- a/code/go/0chain.net/blobbercore/challenge/worker.go +++ b/code/go/0chain.net/blobbercore/challenge/worker.go @@ -7,17 +7,17 @@ import ( "errors" "time" - "0chain.net/blobbercore/config" - "0chain.net/blobbercore/datastore" - "0chain.net/core/chain" - "0chain.net/core/lock" - "0chain.net/core/node" - "0chain.net/core/transaction" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/config" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/datastore" + "github.com/0chain/blobber/code/go/0chain.net/core/chain" + "github.com/0chain/blobber/code/go/0chain.net/core/lock" + "github.com/0chain/blobber/code/go/0chain.net/core/node" + "github.com/0chain/blobber/code/go/0chain.net/core/transaction" "github.com/remeh/sizedwaitgroup" "gorm.io/gorm" - . "0chain.net/core/logging" + . "github.com/0chain/blobber/code/go/0chain.net/core/logging" "go.uber.org/zap" ) diff --git a/code/go/0chain.net/blobbercore/config/config.go b/code/go/0chain.net/blobbercore/config/config.go index 2830bda9d..f3aae7093 100644 --- a/code/go/0chain.net/blobbercore/config/config.go +++ b/code/go/0chain.net/blobbercore/config/config.go @@ -5,7 +5,7 @@ import ( "strings" "time" - "0chain.net/core/config" + "github.com/0chain/blobber/code/go/0chain.net/core/config" "github.com/spf13/viper" ) @@ -44,12 +44,12 @@ func SetupDefaultConfig() { } /*SetupConfig - setup the configuration system */ -func SetupConfig() { +func SetupConfig(configPath string) { replacer := strings.NewReplacer(".", "_") viper.SetEnvKeyReplacer(replacer) viper.AutomaticEnv() viper.SetConfigName("0chain_blobber") - viper.AddConfigPath("./config") + viper.AddConfigPath(configPath) err := viper.ReadInConfig() // Find and read the config file if err != nil { // Handle errors reading the config file panic(fmt.Errorf("fatal error config file: %s", err)) diff --git a/code/go/0chain.net/blobbercore/constants/context_key.go b/code/go/0chain.net/blobbercore/constants/context_key.go index 4f194283f..d7be3edc7 100644 --- a/code/go/0chain.net/blobbercore/constants/context_key.go +++ b/code/go/0chain.net/blobbercore/constants/context_key.go @@ -1,6 +1,6 @@ package constants -import "0chain.net/core/common" +import "github.com/0chain/blobber/code/go/0chain.net/core/common" const ( ALLOCATION_CONTEXT_KEY common.ContextKey = "allocation" diff --git a/code/go/0chain.net/blobbercore/convert/convert.go b/code/go/0chain.net/blobbercore/convert/convert.go new file mode 100644 index 000000000..7e5867596 --- /dev/null +++ b/code/go/0chain.net/blobbercore/convert/convert.go @@ -0,0 +1,540 @@ +package convert + +import ( + "bytes" + "context" + "encoding/json" + "mime/multipart" + "net/http" + "strings" + "time" + + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/readmarker" + + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/allocation" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/blobbergrpc" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/datastore" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/reference" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/stats" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/writemarker" + "github.com/0chain/blobber/code/go/0chain.net/core/common" +) + +func AllocationToGRPCAllocation(alloc *allocation.Allocation) *blobbergrpc.Allocation { + if alloc == nil { + return nil + } + + terms := make([]*blobbergrpc.Term, 0, len(alloc.Terms)) + for _, t := range alloc.Terms { + terms = append(terms, &blobbergrpc.Term{ + Id: t.ID, + BlobberId: t.BlobberID, + AllocationId: t.AllocationID, + ReadPrice: t.ReadPrice, + WritePrice: t.WritePrice, + }) + } + return &blobbergrpc.Allocation{ + Id: alloc.ID, + Tx: alloc.Tx, + TotalSize: alloc.TotalSize, + UsedSize: alloc.UsedSize, + OwnerId: alloc.OwnerID, + OwnerPublicKey: alloc.OwnerPublicKey, + Expiration: int64(alloc.Expiration), + AllocationRoot: alloc.AllocationRoot, + BlobberSize: alloc.BlobberSize, + BlobberSizeUsed: alloc.BlobberSizeUsed, + LatestRedeemedWm: alloc.LatestRedeemedWM, + IsRedeemRequired: alloc.IsRedeemRequired, + TimeUnit: int64(alloc.TimeUnit), + CleanedUp: alloc.CleanedUp, + Finalized: alloc.Finalized, + Terms: terms, + PayerId: alloc.PayerID, + } +} + +func GRPCAllocationToAllocation(alloc *blobbergrpc.Allocation) *allocation.Allocation { + if alloc == nil { + return nil + } + + terms := make([]*allocation.Terms, 0, len(alloc.Terms)) + for _, t := range alloc.Terms { + terms = append(terms, &allocation.Terms{ + ID: t.Id, + BlobberID: t.BlobberId, + AllocationID: t.AllocationId, + ReadPrice: t.ReadPrice, + WritePrice: t.WritePrice, + }) + } + return &allocation.Allocation{ + ID: alloc.Id, + Tx: alloc.Tx, + TotalSize: alloc.TotalSize, + UsedSize: alloc.UsedSize, + OwnerID: alloc.OwnerId, + OwnerPublicKey: alloc.OwnerPublicKey, + Expiration: common.Timestamp(alloc.Expiration), + AllocationRoot: alloc.AllocationRoot, + BlobberSize: alloc.BlobberSize, + BlobberSizeUsed: alloc.BlobberSizeUsed, + LatestRedeemedWM: alloc.LatestRedeemedWm, + IsRedeemRequired: alloc.IsRedeemRequired, + TimeUnit: time.Duration(alloc.TimeUnit), + CleanedUp: alloc.CleanedUp, + Finalized: alloc.Finalized, + Terms: terms, + PayerID: alloc.PayerId, + } +} + +func FileStatsToFileStatsGRPC(fileStats *stats.FileStats) *blobbergrpc.FileStats { + if fileStats == nil { + return nil + } + + return &blobbergrpc.FileStats{ + Id: fileStats.ID, + RefId: fileStats.RefID, + NumUpdates: fileStats.NumUpdates, + NumBlockDownloads: fileStats.NumBlockDownloads, + SuccessChallenges: fileStats.SuccessChallenges, + FailedChallenges: fileStats.FailedChallenges, + LastChallengeResponseTxn: fileStats.LastChallengeResponseTxn, + WriteMarkerRedeemTxn: fileStats.WriteMarkerRedeemTxn, + CreatedAt: fileStats.CreatedAt.UnixNano(), + UpdatedAt: fileStats.UpdatedAt.UnixNano(), + } +} + +func WriteMarkerToWriteMarkerGRPC(wm *writemarker.WriteMarker) *blobbergrpc.WriteMarker { + if wm == nil { + return nil + } + + return &blobbergrpc.WriteMarker{ + AllocationRoot: wm.AllocationRoot, + PreviousAllocationRoot: wm.PreviousAllocationRoot, + AllocationId: wm.AllocationID, + Size: wm.Size, + BlobberId: wm.BlobberID, + Timestamp: int64(wm.Timestamp), + ClientId: wm.ClientID, + Signature: wm.Signature, + } +} + +func WriteMarkerGRPCToWriteMarker(wm *blobbergrpc.WriteMarker) *writemarker.WriteMarker { + if wm == nil { + return nil + } + + return &writemarker.WriteMarker{ + AllocationRoot: wm.AllocationRoot, + PreviousAllocationRoot: wm.PreviousAllocationRoot, + AllocationID: wm.AllocationId, + Size: wm.Size, + BlobberID: wm.BlobberId, + Timestamp: common.Timestamp(wm.Timestamp), + ClientID: wm.ClientId, + Signature: wm.Signature, + } +} + +func ReadMarkerToReadMarkerGRPC(rm *readmarker.ReadMarker) *blobbergrpc.ReadMaker { + if rm == nil { + return nil + } + + return &blobbergrpc.ReadMaker{ + ClientId: rm.ClientID, + ClientPublicKey: rm.ClientPublicKey, + BlobberId: rm.BlobberID, + AllocationId: rm.AllocationID, + OwnerId: rm.OwnerID, + Timestamp: int64(rm.Timestamp), + Counter: rm.ReadCounter, + Signature: rm.Signature, + Suspend: rm.Suspend, + PayerId: rm.PayerID, + AuthTicket: rm.AuthTicket, + } +} + +func ReadMakerGRPCToReadMaker(rm *blobbergrpc.ReadMaker) *readmarker.ReadMarker { + if rm == nil { + return nil + } + + return &readmarker.ReadMarker{ + ClientID: rm.ClientId, + ClientPublicKey: rm.ClientPublicKey, + BlobberID: rm.BlobberId, + AllocationID: rm.AllocationId, + OwnerID: rm.OwnerId, + Timestamp: common.Timestamp(rm.Timestamp), + ReadCounter: rm.Counter, + Signature: rm.Signature, + Suspend: rm.Suspend, + PayerID: rm.PayerId, + AuthTicket: rm.AuthTicket, + } +} + +func FileStatsGRPCToFileStats(fileStats *blobbergrpc.FileStats) *stats.FileStats { + if fileStats == nil { + return nil + } + + return &stats.FileStats{ + ID: fileStats.Id, + RefID: fileStats.RefId, + NumUpdates: fileStats.NumUpdates, + NumBlockDownloads: fileStats.NumBlockDownloads, + SuccessChallenges: fileStats.SuccessChallenges, + FailedChallenges: fileStats.FailedChallenges, + LastChallengeResponseTxn: fileStats.LastChallengeResponseTxn, + WriteMarkerRedeemTxn: fileStats.WriteMarkerRedeemTxn, + ModelWithTS: datastore.ModelWithTS{ + CreatedAt: time.Unix(0, fileStats.CreatedAt), + UpdatedAt: time.Unix(0, fileStats.UpdatedAt), + }, + } +} + +func CollaboratorToGRPCCollaborator(c *reference.Collaborator) *blobbergrpc.Collaborator { + if c == nil { + return nil + } + + return &blobbergrpc.Collaborator{ + RefId: c.RefID, + ClientId: c.ClientID, + CreatedAt: c.CreatedAt.UnixNano(), + } +} + +func GRPCCollaboratorToCollaborator(c *blobbergrpc.Collaborator) *reference.Collaborator { + if c == nil { + return nil + } + + return &reference.Collaborator{ + RefID: c.RefId, + ClientID: c.ClientId, + CreatedAt: time.Unix(0, c.CreatedAt), + } +} + +func ReferencePathToReferencePathGRPC(recursionCount *int, refPath *reference.ReferencePath) *blobbergrpc.ReferencePath { + if refPath == nil { + return nil + } + // Accounting for bad reference paths where child path points to parent path and causes this algorithm to never end + *recursionCount += 1 + defer func() { + *recursionCount -= 1 + }() + + if *recursionCount > 150 { + return &blobbergrpc.ReferencePath{ + MetaData: FileRefToFileRefGRPC(reference.ListingDataToRef(refPath.Meta)), + List: nil, + } + } + + var list []*blobbergrpc.ReferencePath + for i := range refPath.List { + list = append(list, ReferencePathToReferencePathGRPC(recursionCount, refPath.List[i])) + } + + return &blobbergrpc.ReferencePath{ + MetaData: FileRefToFileRefGRPC(reference.ListingDataToRef(refPath.Meta)), + List: list, + } +} + +func ReferencePathGRPCToReferencePath(recursionCount *int, refPath *blobbergrpc.ReferencePath) *reference.ReferencePath { + if refPath == nil { + return nil + } + // Accounting for bad reference paths where child path points to parent path and causes this algorithm to never end + *recursionCount += 1 + defer func() { + *recursionCount -= 1 + }() + + if *recursionCount > 150 { + return &reference.ReferencePath{ + Meta: FileRefGRPCToFileRef(refPath.MetaData).GetListingData(context.Background()), + List: nil, + } + } + + var list []*reference.ReferencePath + for i := range refPath.List { + list = append(list, ReferencePathGRPCToReferencePath(recursionCount, refPath.List[i])) + } + + return &reference.ReferencePath{ + Meta: FileRefGRPCToFileRef(refPath.MetaData).GetListingData(context.Background()), + List: list, + } +} + +func FileRefToFileRefGRPC(ref *reference.Ref) *blobbergrpc.FileRef { + if ref == nil { + return nil + } + + var fileMetaData *blobbergrpc.FileMetaData + var dirMetaData *blobbergrpc.DirMetaData + switch ref.Type { + case reference.FILE: + fileMetaData = convertFileRefToFileMetaDataGRPC(ref) + case reference.DIRECTORY: + dirMetaData = convertDirRefToDirMetaDataGRPC(ref) + } + + return &blobbergrpc.FileRef{ + Type: ref.Type, + FileMetaData: fileMetaData, + DirMetaData: dirMetaData, + } +} + +func convertFileRefToFileMetaDataGRPC(fileref *reference.Ref) *blobbergrpc.FileMetaData { + var commitMetaTxnsGRPC []*blobbergrpc.CommitMetaTxn + for _, c := range fileref.CommitMetaTxns { + commitMetaTxnsGRPC = append(commitMetaTxnsGRPC, &blobbergrpc.CommitMetaTxn{ + RefId: c.RefID, + TxnId: c.TxnID, + CreatedAt: c.CreatedAt.UnixNano(), + }) + } + return &blobbergrpc.FileMetaData{ + Type: fileref.Type, + LookupHash: fileref.LookupHash, + Name: fileref.Name, + Path: fileref.Path, + Hash: fileref.Hash, + NumBlocks: fileref.NumBlocks, + PathHash: fileref.PathHash, + CustomMeta: fileref.CustomMeta, + ContentHash: fileref.ContentHash, + Size: fileref.Size, + MerkleRoot: fileref.MerkleRoot, + ActualFileSize: fileref.ActualFileSize, + ActualFileHash: fileref.ActualFileHash, + MimeType: fileref.MimeType, + ThumbnailSize: fileref.ThumbnailSize, + ThumbnailHash: fileref.ThumbnailHash, + ActualThumbnailSize: fileref.ActualThumbnailSize, + ActualThumbnailHash: fileref.ActualThumbnailHash, + EncryptedKey: fileref.EncryptedKey, + Attributes: fileref.Attributes, + OnCloud: fileref.OnCloud, + CommitMetaTxns: commitMetaTxnsGRPC, + CreatedAt: fileref.CreatedAt.UnixNano(), + UpdatedAt: fileref.UpdatedAt.UnixNano(), + } +} + +func convertDirRefToDirMetaDataGRPC(dirref *reference.Ref) *blobbergrpc.DirMetaData { + return &blobbergrpc.DirMetaData{ + Type: dirref.Type, + LookupHash: dirref.LookupHash, + Name: dirref.Name, + Path: dirref.Path, + Hash: dirref.Hash, + NumBlocks: dirref.NumBlocks, + PathHash: dirref.PathHash, + Size: dirref.Size, + CreatedAt: dirref.CreatedAt.UnixNano(), + UpdatedAt: dirref.UpdatedAt.UnixNano(), + } +} + +func FileRefGRPCToFileRef(ref *blobbergrpc.FileRef) *reference.Ref { + if ref == nil { + return nil + } + + switch ref.Type { + case reference.FILE: + return convertFileMetaDataGRPCToFileRef(ref.FileMetaData) + case reference.DIRECTORY: + return convertDirMetaDataGRPCToDirRef(ref.DirMetaData) + } + + return nil +} + +func convertFileMetaDataGRPCToFileRef(metaData *blobbergrpc.FileMetaData) *reference.Ref { + var commitMetaTxnsGRPC []reference.CommitMetaTxn + for _, c := range metaData.CommitMetaTxns { + commitMetaTxnsGRPC = append(commitMetaTxnsGRPC, reference.CommitMetaTxn{ + RefID: c.RefId, + TxnID: c.TxnId, + CreatedAt: time.Unix(0, c.CreatedAt), + }) + } + return &reference.Ref{ + Type: metaData.Type, + LookupHash: metaData.LookupHash, + Name: metaData.Name, + Path: metaData.Path, + Hash: metaData.Hash, + NumBlocks: metaData.NumBlocks, + PathHash: metaData.PathHash, + CustomMeta: metaData.CustomMeta, + ContentHash: metaData.ContentHash, + Size: metaData.Size, + MerkleRoot: metaData.MerkleRoot, + ActualFileSize: metaData.ActualFileSize, + ActualFileHash: metaData.ActualFileHash, + MimeType: metaData.MimeType, + ThumbnailSize: metaData.ThumbnailSize, + ThumbnailHash: metaData.ThumbnailHash, + ActualThumbnailSize: metaData.ActualThumbnailSize, + ActualThumbnailHash: metaData.ActualThumbnailHash, + EncryptedKey: metaData.EncryptedKey, + Attributes: metaData.Attributes, + OnCloud: metaData.OnCloud, + CommitMetaTxns: commitMetaTxnsGRPC, + CreatedAt: time.Unix(0, metaData.CreatedAt), + UpdatedAt: time.Unix(0, metaData.UpdatedAt), + } +} + +func convertDirMetaDataGRPCToDirRef(dirref *blobbergrpc.DirMetaData) *reference.Ref { + return &reference.Ref{ + Type: dirref.Type, + LookupHash: dirref.LookupHash, + Name: dirref.Name, + Path: dirref.Path, + Hash: dirref.Hash, + NumBlocks: dirref.NumBlocks, + PathHash: dirref.PathHash, + Size: dirref.Size, + CreatedAt: time.Unix(0, dirref.CreatedAt), + UpdatedAt: time.Unix(0, dirref.UpdatedAt), + } +} + +func WriteFileGRPCToHTTP(req *blobbergrpc.UploadFileRequest) (*http.Request, error) { + var formData allocation.UpdateFileChange + var uploadMetaString string + switch req.Method { + case `POST`: + uploadMetaString = req.UploadMeta + case `PUT`: + uploadMetaString = req.UpdateMeta + } + err := json.Unmarshal([]byte(uploadMetaString), &formData) + if err != nil { + return nil, common.NewError("invalid_parameters", + "Invalid parameters. Error parsing the meta data for upload."+err.Error()) + } + + r, err := http.NewRequest(req.Method, "", nil) + if err != nil { + return nil, err + } + + if req.Method != `DELETE` { + body := bytes.NewBuffer(nil) + writer := multipart.NewWriter(body) + part, err := writer.CreateFormFile(`uploadFile`, formData.Filename) + if err != nil { + return nil, err + } + _, err = part.Write(req.UploadFile) + if err != nil { + return nil, err + } + + thumbPart, err := writer.CreateFormFile(`uploadThumbnailFile`, formData.ThumbnailFilename) + if err != nil { + return nil, err + } + _, err = thumbPart.Write(req.UploadThumbnailFile) + if err != nil { + return nil, err + } + + err = writer.Close() + if err != nil { + return nil, err + } + + r, err = http.NewRequest(req.Method, "", body) + if err != nil { + return nil, err + } + r.Header.Set("Content-Type", writer.FormDataContentType()) + + } + + return r, nil +} + +func DownloadFileGRPCToHTTP(req *blobbergrpc.DownloadFileRequest) (*http.Request, error) { + body := bytes.NewBuffer([]byte{}) + writer := multipart.NewWriter(body) + + err := writer.WriteField("path", req.Path) + if err != nil { + return nil, err + } + + err = writer.WriteField("path_hash", req.PathHash) + if err != nil { + return nil, err + } + + err = writer.WriteField("rx_pay", req.RxPay) + if err != nil { + return nil, err + } + + err = writer.WriteField("block_num", req.BlockNum) + if err != nil { + return nil, err + } + + err = writer.WriteField("num_blocks", req.NumBlocks) + if err != nil { + return nil, err + } + + err = writer.WriteField("read_marker", req.ReadMarker) + if err != nil { + return nil, err + } + + err = writer.WriteField("auth_token", req.AuthToken) + if err != nil { + return nil, err + } + + err = writer.WriteField("content", req.Content) + if err != nil { + return nil, err + } + + writer.Close() + + r, err := http.NewRequest("POST", "", strings.NewReader(body.String())) + if err != nil { + return nil, err + } + + r.Header.Set("Content-Type", writer.FormDataContentType()) + + return r, nil +} diff --git a/code/go/0chain.net/blobbercore/convert/response_creator.go b/code/go/0chain.net/blobbercore/convert/response_creator.go new file mode 100644 index 000000000..74e98f320 --- /dev/null +++ b/code/go/0chain.net/blobbercore/convert/response_creator.go @@ -0,0 +1,259 @@ +package convert + +import ( + "encoding/json" + + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/allocation" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/blobbergrpc" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/blobberhttp" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/reference" + stats2 "github.com/0chain/blobber/code/go/0chain.net/blobbercore/stats" +) + +func GetAllocationResponseCreator(resp interface{}) *blobbergrpc.GetAllocationResponse { + if resp == nil { + return nil + } + + alloc, _ := resp.(*allocation.Allocation) + return &blobbergrpc.GetAllocationResponse{Allocation: AllocationToGRPCAllocation(alloc)} +} + +func GetFileMetaDataResponseCreator(httpResp interface{}) *blobbergrpc.GetFileMetaDataResponse { + if httpResp == nil { + return nil + } + + r, _ := httpResp.(map[string]interface{}) + + var resp blobbergrpc.GetFileMetaDataResponse + collaborators, _ := r["collaborators"].([]reference.Collaborator) + for _, c := range collaborators { + resp.Collaborators = append(resp.Collaborators, CollaboratorToGRPCCollaborator(&c)) + } + + resp.MetaData = FileRefToFileRefGRPC(reference.ListingDataToRef(r)) + return &resp +} + +func GetFileStatsResponseCreator(r interface{}) *blobbergrpc.GetFileStatsResponse { + if r == nil { + return nil + } + + httpResp, _ := r.(map[string]interface{}) + + var resp blobbergrpc.GetFileStatsResponse + resp.MetaData = FileRefToFileRefGRPC(reference.ListingDataToRef(httpResp)) + + respRaw, _ := json.Marshal(httpResp) + var stats stats2.FileStats + _ = json.Unmarshal(respRaw, &stats) + resp.Stats = FileStatsToFileStatsGRPC(&stats) + + return &resp +} + +func ListEntitesResponseCreator(r interface{}) *blobbergrpc.ListEntitiesResponse { + if r == nil { + return nil + } + + httpResp, _ := r.(*blobberhttp.ListResult) + + var resp blobbergrpc.ListEntitiesResponse + for i := range httpResp.Entities { + resp.Entities = append(resp.Entities, FileRefToFileRefGRPC(reference.ListingDataToRef(httpResp.Entities[i]))) + } + + resp.MetaData = FileRefToFileRefGRPC(reference.ListingDataToRef(httpResp.Meta)) + resp.AllocationRoot = httpResp.AllocationRoot + return &resp +} + +func GetReferencePathResponseCreator(r interface{}) *blobbergrpc.GetReferencePathResponse { + if r == nil { + return nil + } + + httpResp, _ := r.(*blobberhttp.ReferencePathResult) + var resp blobbergrpc.GetReferencePathResponse + + var recursionCount int + resp.LatestWm = WriteMarkerToWriteMarkerGRPC(httpResp.LatestWM) + resp.ReferencePath = ReferencePathToReferencePathGRPC(&recursionCount, httpResp.ReferencePath) + return &resp +} + +func GetObjectTreeResponseCreator(r interface{}) *blobbergrpc.GetObjectTreeResponse { + if r == nil { + return nil + } + + httpResp, _ := r.(*blobberhttp.ReferencePathResult) + var resp blobbergrpc.GetObjectTreeResponse + + var recursionCount int + resp.LatestWm = WriteMarkerToWriteMarkerGRPC(httpResp.LatestWM) + resp.ReferencePath = ReferencePathToReferencePathGRPC(&recursionCount, httpResp.ReferencePath) + return &resp +} + +func GetObjectPathResponseCreator(r interface{}) *blobbergrpc.GetObjectPathResponse { + if r == nil { + return nil + } + + httpResp, _ := r.(*blobberhttp.ObjectPathResult) + var resp blobbergrpc.GetObjectPathResponse + + var pathList []*blobbergrpc.FileRef + pl, _ := httpResp.Path["list"].([]map[string]interface{}) + for _, v := range pl { + pathList = append(pathList, FileRefToFileRefGRPC(reference.ListingDataToRef(v))) + } + + resp.LatestWriteMarker = WriteMarkerToWriteMarkerGRPC(httpResp.LatestWM) + resp.ObjectPath = &blobbergrpc.ObjectPath{ + RootHash: httpResp.RootHash, + Meta: FileRefToFileRefGRPC(reference.ListingDataToRef(httpResp.Meta)), + Path: FileRefToFileRefGRPC(reference.ListingDataToRef(httpResp.Path)), + PathList: pathList, + FileBlockNum: httpResp.FileBlockNum, + } + + return &resp +} + +func CommitWriteResponseCreator(r interface{}) *blobbergrpc.CommitResponse { + if r == nil { + return nil + } + + httpResp, _ := r.(*blobberhttp.CommitResult) + + return &blobbergrpc.CommitResponse{ + AllocationRoot: httpResp.AllocationRoot, + WriteMarker: WriteMarkerToWriteMarkerGRPC(httpResp.WriteMarker), + ErrorMessage: httpResp.ErrorMessage, + Success: httpResp.Success, + } +} + +func GetCalculateHashResponseCreator(r interface{}) *blobbergrpc.CalculateHashResponse { + httpResp, _ := r.(map[string]interface{}) + msg, _ := httpResp["msg"].(string) + + return &blobbergrpc.CalculateHashResponse{Message: msg} +} + +func GetCommitMetaTxnResponseCreator(r interface{}) *blobbergrpc.CommitMetaTxnResponse { + msg, _ := r.(struct { + Msg string `json:"msg"` + }) + + return &blobbergrpc.CommitMetaTxnResponse{Message: msg.Msg} +} + +func CollaboratorResponseCreator(r interface{}) *blobbergrpc.CollaboratorResponse { + if r == nil { + return nil + } + + msg, _ := r.(struct { + Msg string `json:"msg"` + }) + var resp blobbergrpc.CollaboratorResponse + if msg.Msg != "" { + resp.Message = msg.Msg + return &resp + } + + collabs, _ := r.([]reference.Collaborator) + for _, c := range collabs { + resp.Collaborators = append(resp.Collaborators, CollaboratorToGRPCCollaborator(&c)) + } + + return &resp +} + +func UpdateObjectAttributesResponseCreator(r interface{}) *blobbergrpc.UpdateObjectAttributesResponse { + if r == nil { + return nil + } + + httpResp, _ := r.(*reference.Attributes) + + return &blobbergrpc.UpdateObjectAttributesResponse{WhoPaysForReads: int64(httpResp.WhoPaysForReads)} +} + +func CopyObjectResponseCreator(r interface{}) *blobbergrpc.CopyObjectResponse { + if r == nil { + return nil + } + + httpResp, _ := r.(*blobberhttp.UploadResult) + return &blobbergrpc.CopyObjectResponse{ + Filename: httpResp.Filename, + Size: httpResp.Size, + ContentHash: httpResp.Hash, + MerkleRoot: httpResp.MerkleRoot, + UploadLength: httpResp.UploadLength, + UploadOffset: httpResp.UploadOffset, + } +} + +func RenameObjectResponseCreator(r interface{}) *blobbergrpc.RenameObjectResponse { + if r == nil { + return nil + } + + httpResp, _ := r.(*blobberhttp.UploadResult) + return &blobbergrpc.RenameObjectResponse{ + Filename: httpResp.Filename, + Size: httpResp.Size, + ContentHash: httpResp.Hash, + MerkleRoot: httpResp.MerkleRoot, + UploadLength: httpResp.UploadLength, + UploadOffset: httpResp.UploadOffset, + } +} + +func DownloadFileResponseCreator(r interface{}) *blobbergrpc.DownloadFileResponse { + if r == nil { + return nil + } + + switch httpResp := r.(type) { + case []byte: + return &blobbergrpc.DownloadFileResponse{ + Data: httpResp, + } + case *blobberhttp.DownloadResponse: + return &blobbergrpc.DownloadFileResponse{ + Success: httpResp.Success, + Data: httpResp.Data, + AllocationId: httpResp.AllocationID, + Path: httpResp.Path, + LatestRm: ReadMarkerToReadMarkerGRPC(httpResp.LatestRM), + } + } + + return nil +} + +func UploadFileResponseCreator(r interface{}) *blobbergrpc.UploadFileResponse { + if r == nil { + return nil + } + + httpResp, _ := r.(*blobberhttp.UploadResult) + return &blobbergrpc.UploadFileResponse{ + Filename: httpResp.Filename, + Size: httpResp.Size, + ContentHash: httpResp.Hash, + MerkleRoot: httpResp.MerkleRoot, + UploadLength: httpResp.UploadLength, + UploadOffset: httpResp.UploadOffset, + } +} diff --git a/code/go/0chain.net/blobbercore/convert/response_handler.go b/code/go/0chain.net/blobbercore/convert/response_handler.go new file mode 100644 index 000000000..88f5f3b8f --- /dev/null +++ b/code/go/0chain.net/blobbercore/convert/response_handler.go @@ -0,0 +1,162 @@ +package convert + +import ( + "context" + "encoding/json" + + "github.com/0chain/blobber/code/go/0chain.net/core/common" + + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/allocation" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/blobbergrpc" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/blobberhttp" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/reference" +) + +func GetAllocationResponseHandler(resp *blobbergrpc.GetAllocationResponse) *allocation.Allocation { + return GRPCAllocationToAllocation(resp.Allocation) +} + +func GetFileMetaDataResponseHandler(resp *blobbergrpc.GetFileMetaDataResponse) map[string]interface{} { + var collaborators []reference.Collaborator + for _, c := range resp.Collaborators { + collaborators = append(collaborators, *GRPCCollaboratorToCollaborator(c)) + } + + result := FileRefGRPCToFileRef(resp.MetaData).GetListingData(context.Background()) + result["collaborators"] = collaborators + return result +} + +func GetFileStatsResponseHandler(resp *blobbergrpc.GetFileStatsResponse) map[string]interface{} { + ctx := context.Background() + result := FileRefGRPCToFileRef(resp.MetaData).GetListingData(ctx) + + statsMap := make(map[string]interface{}) + statsBytes, _ := json.Marshal(FileStatsGRPCToFileStats(resp.Stats)) + _ = json.Unmarshal(statsBytes, &statsMap) + + for k, v := range statsMap { + result[k] = v + } + + return result +} + +func ListEntitesResponseHandler(resp *blobbergrpc.ListEntitiesResponse) *blobberhttp.ListResult { + ctx := context.Background() + var entities []map[string]interface{} + for i := range resp.Entities { + entities = append(entities, FileRefGRPCToFileRef(resp.Entities[i]).GetListingData(ctx)) + } + + return &blobberhttp.ListResult{ + AllocationRoot: resp.AllocationRoot, + Meta: FileRefGRPCToFileRef(resp.MetaData).GetListingData(ctx), + Entities: entities, + } +} + +func GetReferencePathResponseHandler(getReferencePathResponse *blobbergrpc.GetReferencePathResponse) *blobberhttp.ReferencePathResult { + var recursionCount int + return &blobberhttp.ReferencePathResult{ + ReferencePath: ReferencePathGRPCToReferencePath(&recursionCount, getReferencePathResponse.ReferencePath), + LatestWM: WriteMarkerGRPCToWriteMarker(getReferencePathResponse.LatestWm), + } +} + +func GetObjectPathResponseHandler(getObjectPathResponse *blobbergrpc.GetObjectPathResponse) *blobberhttp.ObjectPathResult { + ctx := context.Background() + path := FileRefGRPCToFileRef(getObjectPathResponse.ObjectPath.Path).GetListingData(ctx) + var pathList []map[string]interface{} + for _, pl := range getObjectPathResponse.ObjectPath.PathList { + pathList = append(pathList, FileRefGRPCToFileRef(pl).GetListingData(ctx)) + } + path["list"] = pathList + + return &blobberhttp.ObjectPathResult{ + ObjectPath: &reference.ObjectPath{ + RootHash: getObjectPathResponse.ObjectPath.RootHash, + Meta: FileRefGRPCToFileRef(getObjectPathResponse.ObjectPath.Meta).GetListingData(ctx), + Path: path, + FileBlockNum: getObjectPathResponse.ObjectPath.FileBlockNum, + }, + LatestWM: WriteMarkerGRPCToWriteMarker(getObjectPathResponse.LatestWriteMarker), + } +} + +func GetObjectTreeResponseHandler(getObjectTreeResponse *blobbergrpc.GetObjectTreeResponse) *blobberhttp.ReferencePathResult { + var recursionCount int + return &blobberhttp.ReferencePathResult{ + ReferencePath: ReferencePathGRPCToReferencePath(&recursionCount, getObjectTreeResponse.ReferencePath), + LatestWM: WriteMarkerGRPCToWriteMarker(getObjectTreeResponse.LatestWm), + } +} + +func CommitWriteResponseHandler(resp *blobbergrpc.CommitResponse) *blobberhttp.CommitResult { + return &blobberhttp.CommitResult{ + AllocationRoot: resp.AllocationRoot, + WriteMarker: WriteMarkerGRPCToWriteMarker(resp.WriteMarker), + Success: resp.Success, + ErrorMessage: resp.ErrorMessage, + } +} + +func GetCalculateHashResponseHandler(response *blobbergrpc.CalculateHashResponse) interface{} { + result := make(map[string]interface{}) + if msg := response.GetMessage(); msg != "" { + result["msg"] = msg + } + + return result +} + +func GetCommitMetaTxnHandlerResponse(response *blobbergrpc.CommitMetaTxnResponse) interface{} { + msg := response.GetMessage() + if msg == "" { + return nil + } + + result := struct { + Msg string `json:"msg"` + }{ + Msg: msg, + } + + return result +} + +func CollaboratorResponse(response *blobbergrpc.CollaboratorResponse) interface{} { + if msg := response.GetMessage(); msg != "" { + return struct { + Msg string `json:"msg"` + }{Msg: msg} + } + + if collaborators := response.GetCollaborators(); collaborators != nil { + collabs := make([]reference.Collaborator, 0, len(collaborators)) + for _, c := range collaborators { + collabs = append(collabs, *GRPCCollaboratorToCollaborator(c)) + } + + return collabs + } + + return nil +} + +func UpdateObjectAttributesResponseHandler(updateAttributesResponse *blobbergrpc.UpdateObjectAttributesResponse) *blobberhttp.UpdateObjectAttributesResponse { + return &blobberhttp.UpdateObjectAttributesResponse{ + WhoPaysForReads: common.WhoPays(updateAttributesResponse.WhoPaysForReads), + } +} + +func CopyObjectResponseHandler(copyObjectResponse *blobbergrpc.CopyObjectResponse) *blobberhttp.UploadResult { + return &blobberhttp.UploadResult{ + Filename: copyObjectResponse.Filename, + Size: copyObjectResponse.Size, + Hash: copyObjectResponse.ContentHash, + MerkleRoot: copyObjectResponse.MerkleRoot, + UploadLength: copyObjectResponse.UploadLength, + UploadOffset: copyObjectResponse.UploadOffset, + } +} diff --git a/code/go/0chain.net/blobbercore/datastore/store.go b/code/go/0chain.net/blobbercore/datastore/store.go index 6f4de4f3f..497ee6b55 100644 --- a/code/go/0chain.net/blobbercore/datastore/store.go +++ b/code/go/0chain.net/blobbercore/datastore/store.go @@ -5,13 +5,13 @@ import ( "fmt" "time" - "0chain.net/blobbercore/config" - "0chain.net/blobbercore/errors" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/config" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/errors" "gorm.io/driver/postgres" "gorm.io/gorm" - . "0chain.net/core/logging" + . "github.com/0chain/blobber/code/go/0chain.net/core/logging" ) type contextKey int diff --git a/code/go/0chain.net/blobbercore/errors/errors.go b/code/go/0chain.net/blobbercore/errors/errors.go index 9c40236d5..acd03356f 100644 --- a/code/go/0chain.net/blobbercore/errors/errors.go +++ b/code/go/0chain.net/blobbercore/errors/errors.go @@ -1,7 +1,7 @@ package errors import ( - "0chain.net/core/common" + "github.com/0chain/blobber/code/go/0chain.net/core/common" ) var ( diff --git a/code/go/0chain.net/blobbercore/filestore/fs_store.go b/code/go/0chain.net/blobbercore/filestore/fs_store.go index 9ce06d8d6..84b30b7d1 100644 --- a/code/go/0chain.net/blobbercore/filestore/fs_store.go +++ b/code/go/0chain.net/blobbercore/filestore/fs_store.go @@ -15,15 +15,15 @@ import ( "path/filepath" "strings" - . "0chain.net/core/logging" + . "github.com/0chain/blobber/code/go/0chain.net/core/logging" "go.uber.org/zap" - "0chain.net/core/common" - "0chain.net/core/encryption" + "github.com/0chain/blobber/code/go/0chain.net/core/common" + "github.com/0chain/blobber/code/go/0chain.net/core/encryption" - "0chain.net/blobbercore/config" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/config" - "0chain.net/core/util" + "github.com/0chain/blobber/code/go/0chain.net/core/util" "github.com/minio/minio-go" "golang.org/x/crypto/sha3" ) diff --git a/code/go/0chain.net/blobbercore/filestore/store.go b/code/go/0chain.net/blobbercore/filestore/store.go index 6980b4346..4d98a5136 100644 --- a/code/go/0chain.net/blobbercore/filestore/store.go +++ b/code/go/0chain.net/blobbercore/filestore/store.go @@ -4,7 +4,7 @@ import ( "encoding/json" "mime/multipart" - "0chain.net/core/util" + "github.com/0chain/blobber/code/go/0chain.net/core/util" ) const CHUNK_SIZE = 64 * 1024 diff --git a/code/go/0chain.net/blobbercore/handler/calculate_hash_integration_test.go b/code/go/0chain.net/blobbercore/handler/calculate_hash_integration_test.go new file mode 100644 index 000000000..a4d273c3e --- /dev/null +++ b/code/go/0chain.net/blobbercore/handler/calculate_hash_integration_test.go @@ -0,0 +1,66 @@ +package handler + +import ( + "context" + "testing" + + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/blobbergrpc" + "github.com/0chain/blobber/code/go/0chain.net/core/common" + "github.com/0chain/blobber/code/go/0chain.net/core/encryption" + "google.golang.org/grpc/metadata" +) + +func TestBlobberGRPCService_CalculateHash(t *testing.T) { + bClient, tdController := setupHandlerIntegrationTests(t) + allocationTx := randString(32) + pubKey, _, signScheme := GeneratePubPrivateKey(t) + clientSignature, _ := signScheme.Sign(encryption.Hash(allocationTx)) + + err := tdController.ClearDatabase() + if err != nil { + t.Fatal(err) + } + err = tdController.AddGetReferencePathTestData(allocationTx, pubKey) + if err != nil { + t.Fatal(err) + } + + testCases := []struct { + name string + context metadata.MD + input *blobbergrpc.CalculateHashRequest + expectingError bool + }{ + { + name: "Success", + context: metadata.New(map[string]string{ + common.ClientHeader: "exampleOwnerId", + common.ClientSignatureHeader: clientSignature, + common.ClientKeyHeader: pubKey, + }), + input: &blobbergrpc.CalculateHashRequest{ + Paths: "", + Path: "/", + Allocation: allocationTx, + }, + expectingError: false, + }, + } + + for _, tc := range testCases { + ctx := context.Background() + ctx = metadata.NewOutgoingContext(ctx, tc.context) + _, err := bClient.CalculateHash(ctx, tc.input) + if err != nil { + if !tc.expectingError { + t.Fatal(err) + } + + continue + } + + if tc.expectingError { + t.Fatal("expected error") + } + } +} diff --git a/code/go/0chain.net/blobbercore/handler/collaborator_integration_test.go b/code/go/0chain.net/blobbercore/handler/collaborator_integration_test.go new file mode 100644 index 000000000..f03c7e36c --- /dev/null +++ b/code/go/0chain.net/blobbercore/handler/collaborator_integration_test.go @@ -0,0 +1,124 @@ +package handler + +import ( + "context" + "encoding/hex" + "net/http" + "strconv" + "testing" + "time" + + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/blobbergrpc" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/reference" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/writemarker" + "github.com/0chain/blobber/code/go/0chain.net/core/common" + "github.com/0chain/blobber/code/go/0chain.net/core/encryption" + "google.golang.org/grpc/metadata" +) + +func TestBlobberGRPCService_Collaborator(t *testing.T) { + bClient, tdController := setupHandlerIntegrationTests(t) + allocationTx := randString(32) + + pubKey, _, signScheme := GeneratePubPrivateKey(t) + clientSignature, _ := signScheme.Sign(encryption.Hash(allocationTx)) + pubKeyBytes, _ := hex.DecodeString(pubKey) + clientId := encryption.Hash(pubKeyBytes) + now := common.Timestamp(time.Now().UnixNano()) + + blobberPubKey := "de52c0a51872d5d2ec04dbc15a6f0696cba22657b80520e1d070e72de64c9b04e19ce3223cae3c743a20184158457582ffe9c369ca9218c04bfe83a26a62d88d" + blobberPubKeyBytes, _ := hex.DecodeString(blobberPubKey) + + fr := reference.Ref{ + AllocationID: "exampleId", + } + + rootRefHash := encryption.Hash(encryption.Hash(fr.GetFileHashData())) + + wm := writemarker.WriteMarker{ + AllocationRoot: encryption.Hash(rootRefHash + ":" + strconv.FormatInt(int64(now), 10)), + PreviousAllocationRoot: "/", + AllocationID: "exampleId", + Size: 1337, + BlobberID: encryption.Hash(blobberPubKeyBytes), + Timestamp: now, + ClientID: clientId, + } + + wmSig, err := signScheme.Sign(encryption.Hash(wm.GetHashData())) + if err != nil { + t.Fatal(err) + } + + wm.Signature = wmSig + + if err := tdController.ClearDatabase(); err != nil { + t.Fatal(err) + } + if err := tdController.AddCommitTestData(allocationTx, pubKey, clientId, wmSig, now); err != nil { + t.Fatal(err) + } + + testCases := []struct { + name string + context metadata.MD + input *blobbergrpc.CollaboratorRequest + expectedMessage string + expectingError bool + }{ + { + name: "Success", + context: metadata.New(map[string]string{ + common.ClientHeader: clientId, + common.ClientSignatureHeader: clientSignature, + common.ClientKeyHeader: pubKey, + }), + input: &blobbergrpc.CollaboratorRequest{ + Path: "/some_file", + PathHash: "exampleId:examplePath", + Allocation: allocationTx, + Method: http.MethodPost, + CollabId: "10", + }, + expectedMessage: "Added collaborator successfully", + expectingError: false, + }, + { + name: "Fail", + context: metadata.New(map[string]string{ + common.ClientHeader: clientId, + common.ClientSignatureHeader: clientSignature, + common.ClientKeyHeader: pubKey, + }), + input: &blobbergrpc.CollaboratorRequest{ + Path: "/some_file", + PathHash: "exampleId:examplePath", + Allocation: allocationTx, + Method: http.MethodPost, + }, + expectedMessage: "", + expectingError: true, + }, + } + + for _, tc := range testCases { + ctx := context.Background() + ctx = metadata.NewOutgoingContext(ctx, tc.context) + response, err := bClient.Collaborator(ctx, tc.input) + if err != nil { + if !tc.expectingError { + t.Fatal(err) + } + + continue + } + + if tc.expectingError { + t.Fatal("expected error") + } + + if response.GetMessage() != tc.expectedMessage { + t.Fatal("failed!") + } + } +} diff --git a/code/go/0chain.net/blobbercore/handler/commit_integration_test.go b/code/go/0chain.net/blobbercore/handler/commit_integration_test.go new file mode 100644 index 000000000..36d840f5b --- /dev/null +++ b/code/go/0chain.net/blobbercore/handler/commit_integration_test.go @@ -0,0 +1,133 @@ +package handler + +import ( + "context" + "encoding/hex" + "encoding/json" + "strconv" + "testing" + "time" + + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/blobbergrpc" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/reference" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/writemarker" + "github.com/0chain/blobber/code/go/0chain.net/core/common" + "github.com/0chain/blobber/code/go/0chain.net/core/encryption" + "google.golang.org/grpc/metadata" +) + +func TestBlobberGRPCService_Commit(t *testing.T) { + bClient, tdController := setupHandlerIntegrationTests(t) + allocationTx := randString(32) + + pubKey, _, signScheme := GeneratePubPrivateKey(t) + clientSignature, _ := signScheme.Sign(encryption.Hash(allocationTx)) + pubKeyBytes, _ := hex.DecodeString(pubKey) + clientId := encryption.Hash(pubKeyBytes) + now := common.Timestamp(time.Now().UnixNano()) + + blobberPubKey := "de52c0a51872d5d2ec04dbc15a6f0696cba22657b80520e1d070e72de64c9b04e19ce3223cae3c743a20184158457582ffe9c369ca9218c04bfe83a26a62d88d" + blobberPubKeyBytes, _ := hex.DecodeString(blobberPubKey) + + fr := reference.Ref{ + AllocationID: "exampleId", + Type: "f", + Name: "new_name", + Path: "/new_name", + ContentHash: "contentHash", + MerkleRoot: "merkleRoot", + ActualFileHash: "actualFileHash", + } + + rootRefHash := encryption.Hash(encryption.Hash(fr.GetFileHashData())) + + wm := writemarker.WriteMarker{ + AllocationRoot: encryption.Hash(rootRefHash + ":" + strconv.FormatInt(int64(now), 10)), + PreviousAllocationRoot: "/", + AllocationID: "exampleId", + Size: 1337, + BlobberID: encryption.Hash(blobberPubKeyBytes), + Timestamp: now, + ClientID: clientId, + } + + wmSig, err := signScheme.Sign(encryption.Hash(wm.GetHashData())) + if err != nil { + t.Fatal(err) + } + + wm.Signature = wmSig + + wmRaw, err := json.Marshal(wm) + if err != nil { + t.Fatal(err) + } + + err = tdController.ClearDatabase() + if err != nil { + t.Fatal(err) + } + err = tdController.AddCommitTestData(allocationTx, pubKey, clientId, wmSig, now) + if err != nil { + t.Fatal(err) + } + + testCases := []struct { + name string + context metadata.MD + input *blobbergrpc.CommitRequest + expectedAllocation string + expectingError bool + }{ + { + name: "Success", + context: metadata.New(map[string]string{ + common.ClientHeader: clientId, + common.ClientSignatureHeader: clientSignature, + common.ClientKeyHeader: pubKey, + }), + input: &blobbergrpc.CommitRequest{ + Allocation: allocationTx, + ConnectionId: "connection_id", + WriteMarker: string(wmRaw), + }, + expectedAllocation: "exampleId", + expectingError: false, + }, + { + name: "invalid write_marker", + context: metadata.New(map[string]string{ + common.ClientHeader: clientId, + common.ClientSignatureHeader: clientSignature, + common.ClientKeyHeader: pubKey, + }), + input: &blobbergrpc.CommitRequest{ + Allocation: allocationTx, + ConnectionId: "invalid", + WriteMarker: "invalid", + }, + expectedAllocation: "", + expectingError: true, + }, + } + + for _, tc := range testCases { + ctx := context.Background() + ctx = metadata.NewOutgoingContext(ctx, tc.context) + getCommiteResp, err := bClient.Commit(ctx, tc.input) + if err != nil { + if !tc.expectingError { + t.Fatal(err) + } + continue + } + + if tc.expectingError { + t.Fatal("expected error") + } + + if getCommiteResp.WriteMarker.AllocationId != tc.expectedAllocation { + t.Fatal("unexpected root name from GetObject") + } + } +} diff --git a/code/go/0chain.net/blobbercore/handler/commit_meta_txn_integration_test.go b/code/go/0chain.net/blobbercore/handler/commit_meta_txn_integration_test.go new file mode 100644 index 000000000..20c238c8a --- /dev/null +++ b/code/go/0chain.net/blobbercore/handler/commit_meta_txn_integration_test.go @@ -0,0 +1,118 @@ +package handler + +import ( + "context" + "encoding/hex" + "strconv" + "testing" + "time" + + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/blobbergrpc" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/reference" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/writemarker" + "github.com/0chain/blobber/code/go/0chain.net/core/common" + "github.com/0chain/blobber/code/go/0chain.net/core/encryption" + "google.golang.org/grpc/metadata" +) + +func TestBlobberGRPCService_CommitMetaTxn(t *testing.T) { + bClient, tdController := setupHandlerIntegrationTests(t) + allocationTx := randString(32) + + pubKey, _, signScheme := GeneratePubPrivateKey(t) + pubKeyBytes, _ := hex.DecodeString(pubKey) + clientId := encryption.Hash(pubKeyBytes) + now := common.Timestamp(time.Now().UnixNano()) + + blobberPubKey := "de52c0a51872d5d2ec04dbc15a6f0696cba22657b80520e1d070e72de64c9b04e19ce3223cae3c743a20184158457582ffe9c369ca9218c04bfe83a26a62d88d" + blobberPubKeyBytes, _ := hex.DecodeString(blobberPubKey) + + fr := reference.Ref{ + AllocationID: "exampleId", + } + + rootRefHash := encryption.Hash(encryption.Hash(fr.GetFileHashData())) + + wm := writemarker.WriteMarker{ + AllocationRoot: encryption.Hash(rootRefHash + ":" + strconv.FormatInt(int64(now), 10)), + PreviousAllocationRoot: "/", + AllocationID: "exampleId", + Size: 1337, + BlobberID: encryption.Hash(blobberPubKeyBytes), + Timestamp: now, + ClientID: clientId, + } + + wmSig, err := signScheme.Sign(encryption.Hash(wm.GetHashData())) + if err != nil { + t.Fatal(err) + } + + wm.Signature = wmSig + + if err := tdController.ClearDatabase(); err != nil { + t.Fatal(err) + } + if err := tdController.AddCommitTestData(allocationTx, pubKey, clientId, wmSig, now); err != nil { + t.Fatal(err) + } + + testCases := []struct { + name string + context metadata.MD + input *blobbergrpc.CommitMetaTxnRequest + expectedMessage string + expectingError bool + }{ + { + name: "Success", + context: metadata.New(map[string]string{ + common.ClientHeader: clientId, + }), + input: &blobbergrpc.CommitMetaTxnRequest{ + Path: "/some_file", + PathHash: "exampleId:examplePath", + AuthToken: "", + Allocation: allocationTx, + TxnId: "8", + }, + expectedMessage: "Added commitMetaTxn successfully", + expectingError: false, + }, + { + name: "Fail", + context: metadata.New(map[string]string{ + common.ClientHeader: clientId, + }), + input: &blobbergrpc.CommitMetaTxnRequest{ + Path: "/some_file", + PathHash: "exampleId:examplePath", + AuthToken: "", + Allocation: allocationTx, + TxnId: "", + }, + expectedMessage: "", + expectingError: true, + }, + } + + for _, tc := range testCases { + ctx := context.Background() + ctx = metadata.NewOutgoingContext(ctx, tc.context) + commitMetaTxnResponse, err := bClient.CommitMetaTxn(ctx, tc.input) + if err != nil { + if !tc.expectingError { + t.Fatal(err) + } + continue + } + + if tc.expectingError { + t.Fatal("expected error") + } + + if commitMetaTxnResponse.GetMessage() != tc.expectedMessage { + t.Fatal("failed!") + } + } +} diff --git a/code/go/0chain.net/blobbercore/handler/convert.go b/code/go/0chain.net/blobbercore/handler/convert.go deleted file mode 100644 index a61b61b31..000000000 --- a/code/go/0chain.net/blobbercore/handler/convert.go +++ /dev/null @@ -1,73 +0,0 @@ -package handler - -import ( - "0chain.net/blobbercore/allocation" - "0chain.net/blobbercore/blobbergrpc" - "0chain.net/blobbercore/stats" - "0chain.net/blobbercore/writemarker" -) - -func AllocationToGRPCAllocation(alloc *allocation.Allocation) *blobbergrpc.Allocation { - terms := make([]*blobbergrpc.Term, 0, len(alloc.Terms)) - for _, t := range alloc.Terms { - terms = append(terms, &blobbergrpc.Term{ - ID: t.ID, - BlobberID: t.BlobberID, - AllocationID: t.AllocationID, - ReadPrice: t.ReadPrice, - WritePrice: t.WritePrice, - }) - } - return &blobbergrpc.Allocation{ - ID: alloc.ID, - Tx: alloc.Tx, - TotalSize: alloc.TotalSize, - UsedSize: alloc.UsedSize, - OwnerID: alloc.OwnerID, - OwnerPublicKey: alloc.OwnerPublicKey, - RepairerID: alloc.RepairerID, - PayerID: alloc.PayerID, - Expiration: int64(alloc.Expiration), - AllocationRoot: alloc.AllocationRoot, - BlobberSize: alloc.BlobberSize, - BlobberSizeUsed: alloc.BlobberSizeUsed, - LatestRedeemedWM: alloc.LatestRedeemedWM, - IsRedeemRequired: alloc.IsRedeemRequired, - TimeUnit: int64(alloc.TimeUnit), - CleanedUp: alloc.CleanedUp, - Finalized: alloc.Finalized, - Terms: terms, - } -} - -func FileStatsToFileStatsGRPC(fileStats *stats.FileStats) *blobbergrpc.FileStats { - if fileStats == nil { - return &blobbergrpc.FileStats{} - } - - return &blobbergrpc.FileStats{ - ID: fileStats.ID, - RefID: fileStats.RefID, - NumUpdates: fileStats.NumUpdates, - NumBlockDownloads: fileStats.NumBlockDownloads, - SuccessChallenges: fileStats.SuccessChallenges, - FailedChallenges: fileStats.FailedChallenges, - LastChallengeResponseTxn: fileStats.LastChallengeResponseTxn, - WriteMarkerRedeemTxn: fileStats.WriteMarkerRedeemTxn, - CreatedAt: fileStats.CreatedAt.UnixNano(), - UpdatedAt: fileStats.UpdatedAt.UnixNano(), - } -} - -func WriteMarkerToWriteMarkerGRPC(wm writemarker.WriteMarker) *blobbergrpc.WriteMarker { - return &blobbergrpc.WriteMarker{ - AllocationRoot: wm.AllocationRoot, - PreviousAllocationRoot: wm.PreviousAllocationRoot, - AllocationID: wm.AllocationID, - Size: wm.Size, - BlobberID: wm.BlobberID, - Timestamp: int64(wm.Timestamp), - ClientID: wm.ClientID, - Signature: wm.Signature, - } -} diff --git a/code/go/0chain.net/blobbercore/handler/copy_object_integration_test.go b/code/go/0chain.net/blobbercore/handler/copy_object_integration_test.go new file mode 100644 index 000000000..8b1a26062 --- /dev/null +++ b/code/go/0chain.net/blobbercore/handler/copy_object_integration_test.go @@ -0,0 +1,93 @@ +package handler + +import ( + "context" + "encoding/hex" + "testing" + + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/blobbergrpc" + "github.com/0chain/blobber/code/go/0chain.net/core/common" + "github.com/0chain/blobber/code/go/0chain.net/core/encryption" + "google.golang.org/grpc/metadata" +) + +func TestBlobberGRPCService_CopyObject(t *testing.T) { + bClient, tdController := setupHandlerIntegrationTests(t) + allocationTx := randString(32) + + pubKey, _, signScheme := GeneratePubPrivateKey(t) + clientSignature, _ := signScheme.Sign(encryption.Hash(allocationTx)) + pubKeyBytes, _ := hex.DecodeString(pubKey) + clientId := encryption.Hash(pubKeyBytes) + + if err := tdController.ClearDatabase(); err != nil { + t.Fatal(err) + } + if err := tdController.AddCopyObjectData(allocationTx, pubKey, clientId); err != nil { + t.Fatal(err) + } + + testCases := []struct { + name string + context metadata.MD + input *blobbergrpc.CopyObjectRequest + expectedMessage string + expectingError bool + }{ + { + name: "Success", + context: metadata.New(map[string]string{ + common.ClientHeader: clientId, + common.ClientSignatureHeader: clientSignature, + common.ClientKeyHeader: pubKey, + }), + input: &blobbergrpc.CopyObjectRequest{ + Allocation: allocationTx, + Path: "/some_file", + PathHash: "exampleId:examplePath", + ConnectionId: "connection_id", + Dest: "/copy", + }, + expectedMessage: "some_file", + expectingError: false, + }, + { + name: "Fail", + context: metadata.New(map[string]string{ + common.ClientHeader: clientId, + common.ClientSignatureHeader: clientSignature, + common.ClientKeyHeader: pubKey, + }), + input: &blobbergrpc.CopyObjectRequest{ + Allocation: "", + Path: "", + PathHash: "", + ConnectionId: "", + Dest: "", + }, + expectedMessage: "", + expectingError: true, + }, + } + + for _, tc := range testCases { + ctx := context.Background() + ctx = metadata.NewOutgoingContext(ctx, tc.context) + response, err := bClient.CopyObject(ctx, tc.input) + if err != nil { + if !tc.expectingError { + t.Fatal(err) + } + + continue + } + + if tc.expectingError { + t.Fatal("expected error") + } + + if response.GetFilename() != tc.expectedMessage { + t.Fatal("failed!") + } + } +} diff --git a/code/go/0chain.net/blobbercore/handler/download_integration_test.go b/code/go/0chain.net/blobbercore/handler/download_integration_test.go new file mode 100644 index 000000000..af32f9b2e --- /dev/null +++ b/code/go/0chain.net/blobbercore/handler/download_integration_test.go @@ -0,0 +1,157 @@ +package handler + +import ( + "context" + "encoding/hex" + "encoding/json" + "io" + "os" + "strings" + "testing" + "time" + + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/blobbergrpc" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/readmarker" + "github.com/0chain/blobber/code/go/0chain.net/core/common" + "github.com/0chain/blobber/code/go/0chain.net/core/encryption" + "google.golang.org/grpc/metadata" +) + +func TestBlobberGRPCService_DownloadFile(t *testing.T) { + bClient, tdController := setupHandlerIntegrationTests(t) + allocationTx := randString(32) + + root, _ := os.Getwd() + path := strings.Split(root, `code`) + + err := os.MkdirAll(path[0]+`docker.local/blobber1/files/files/exa/mpl/eId/objects/tmp/Mon/Wen`, os.ModePerm) + if err != nil { + t.Fatal(err) + } + defer func() { + err := os.RemoveAll(path[0] + `docker.local/blobber1/files/files/exa/mpl/eId/objects/tmp/Mon`) + if err != nil { + t.Fatal(err) + } + }() + + f, err := os.Create(path[0] + `docker.local/blobber1/files/files/exa/mpl/eId/objects/tmp/Mon/Wen/MyFile`) + if err != nil { + t.Fatal(err) + } + defer f.Close() + + file, err := os.Open(root + "/helper_integration_test.go") + if err != nil { + t.Fatal(err) + } + defer file.Close() + + _, err = io.Copy(f, file) + if err != nil { + t.Fatal(err) + } + + pubKey, _, signScheme := GeneratePubPrivateKey(t) + clientSignature, _ := signScheme.Sign(encryption.Hash(allocationTx)) + pubKeyBytes, _ := hex.DecodeString(pubKey) + clientId := encryption.Hash(pubKeyBytes) + now := common.Timestamp(time.Now().Unix()) + allocationId := `exampleId` + + if err := tdController.ClearDatabase(); err != nil { + t.Fatal(err) + } + + blobberPubKey := "de52c0a51872d5d2ec04dbc15a6f0696cba22657b80520e1d070e72de64c9b04e19ce3223cae3c743a20184158457582ffe9c369ca9218c04bfe83a26a62d88d" + blobberPubKeyBytes, _ := hex.DecodeString(blobberPubKey) + + rm := readmarker.ReadMarker{ + BlobberID: encryption.Hash(blobberPubKeyBytes), + AllocationID: allocationId, + ClientPublicKey: pubKey, + ClientID: clientId, + OwnerID: clientId, + Timestamp: now, + //ReadCounter: 1337, + } + + rmSig, err := signScheme.Sign(encryption.Hash(rm.GetHashData())) + if err != nil { + t.Fatal(err) + } + rm.Signature = rmSig + + rmString, err := json.Marshal(rm) + if err != nil { + t.Fatal(err) + } + + if err := tdController.AddDownloadTestData(allocationTx, pubKey, clientId, rmSig, now); err != nil { + t.Fatal(err) + } + + testCases := []struct { + name string + context metadata.MD + input *blobbergrpc.DownloadFileRequest + expectedMessage string + expectingError bool + }{ + { + name: "Success", + context: metadata.New(map[string]string{ + common.ClientHeader: clientId, + common.ClientSignatureHeader: clientSignature, + common.ClientKeyHeader: pubKey, + }), + input: &blobbergrpc.DownloadFileRequest{ + Allocation: allocationTx, + Path: "/some_file", + PathHash: "exampleId:examplePath", + ReadMarker: string(rmString), + BlockNum: "1", + }, + expectedMessage: "some_new_file", + expectingError: false, + }, + { + name: "Fail", + context: metadata.New(map[string]string{ + common.ClientHeader: clientId, + common.ClientSignatureHeader: clientSignature, + common.ClientKeyHeader: pubKey, + }), + input: &blobbergrpc.DownloadFileRequest{ + Allocation: "", + Path: "", + PathHash: "", + RxPay: "", + BlockNum: "", + NumBlocks: "", + ReadMarker: "", + AuthToken: "", + Content: "", + }, + expectedMessage: "", + expectingError: true, + }, + } + + for _, tc := range testCases { + ctx := context.Background() + ctx = metadata.NewOutgoingContext(ctx, tc.context) + _, err := bClient.DownloadFile(ctx, tc.input) + if err != nil { + if !tc.expectingError { + t.Fatal(err) + } + + continue + } + + if tc.expectingError { + t.Fatal("expected error") + } + } +} diff --git a/code/go/0chain.net/blobbercore/handler/getallocation_integration_test.go b/code/go/0chain.net/blobbercore/handler/getallocation_integration_test.go new file mode 100644 index 000000000..8fe1fb7fa --- /dev/null +++ b/code/go/0chain.net/blobbercore/handler/getallocation_integration_test.go @@ -0,0 +1,64 @@ +package handler + +import ( + "context" + "testing" + + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/blobbergrpc" +) + +func TestGetAllocation_IntegrationTest(t *testing.T) { + + bClient, tdController := setupHandlerIntegrationTests(t) + + err := tdController.ClearDatabase() + if err != nil { + t.Fatal(err) + } + err = tdController.AddGetAllocationTestData() + if err != nil { + t.Fatal(err) + } + + testCases := []struct { + name string + input *blobbergrpc.GetAllocationRequest + expectedTx string + expectingError bool + }{ + { + name: "Success", + input: &blobbergrpc.GetAllocationRequest{ + Id: "exampleTransaction", + }, + expectedTx: "exampleTransaction", + expectingError: false, + }, + { + name: "UnknownAllocation", + input: &blobbergrpc.GetAllocationRequest{ + Id: "exampleTransaction1", + }, + expectedTx: "", + expectingError: true, + }, + } + + for _, tc := range testCases { + getAllocationResp, err := bClient.GetAllocation(context.Background(), tc.input) + if err != nil { + if !tc.expectingError { + t.Fatal(err) + } + continue + } + + if tc.expectingError { + t.Fatal("expected error") + } + + if getAllocationResp.Allocation.Tx != tc.expectedTx { + t.Fatal("response with wrong allocation transaction") + } + } +} diff --git a/code/go/0chain.net/blobbercore/handler/getfilemetadata_integration_test.go b/code/go/0chain.net/blobbercore/handler/getfilemetadata_integration_test.go new file mode 100644 index 000000000..436da99c5 --- /dev/null +++ b/code/go/0chain.net/blobbercore/handler/getfilemetadata_integration_test.go @@ -0,0 +1,78 @@ +package handler + +import ( + "context" + "testing" + + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/blobbergrpc" + "github.com/0chain/blobber/code/go/0chain.net/core/common" + "google.golang.org/grpc/metadata" +) + +func TestGetFileMetaData_IntegrationTest(t *testing.T) { + bClient, tdController := setupHandlerIntegrationTests(t) + + err := tdController.ClearDatabase() + if err != nil { + t.Fatal(err) + } + err = tdController.AddGetFileMetaDataTestData() + if err != nil { + t.Fatal(err) + } + + testCases := []struct { + name string + context metadata.MD + input *blobbergrpc.GetFileMetaDataRequest + expectedFileName string + expectingError bool + }{ + { + name: "Success", + context: metadata.New(map[string]string{ + common.ClientHeader: "exampleOwnerId", + }), + input: &blobbergrpc.GetFileMetaDataRequest{ + Path: "examplePath", + PathHash: "exampleId:examplePath", + Allocation: "exampleTransaction", + }, + expectedFileName: "filename", + expectingError: false, + }, + { + name: "Unknown file path", + context: metadata.New(map[string]string{ + common.ClientHeader: "exampleOwnerId", + }), + input: &blobbergrpc.GetFileMetaDataRequest{ + Path: "examplePath", + PathHash: "exampleId:examplePath123", + Allocation: "exampleTransaction", + }, + expectedFileName: "", + expectingError: true, + }, + } + + for _, tc := range testCases { + ctx := context.Background() + ctx = metadata.NewOutgoingContext(ctx, tc.context) + getFileMetaDataResp, err := bClient.GetFileMetaData(ctx, tc.input) + if err != nil { + if !tc.expectingError { + t.Fatal(err) + } + continue + } + + if tc.expectingError { + t.Fatal("expected error") + } + + if getFileMetaDataResp.MetaData.FileMetaData.Name != tc.expectedFileName { + t.Fatal("unexpected file name from GetFileMetaData rpc") + } + } +} diff --git a/code/go/0chain.net/blobbercore/handler/getfilestats_integration_test.go b/code/go/0chain.net/blobbercore/handler/getfilestats_integration_test.go new file mode 100644 index 000000000..a018e735c --- /dev/null +++ b/code/go/0chain.net/blobbercore/handler/getfilestats_integration_test.go @@ -0,0 +1,86 @@ +package handler + +import ( + "context" + "testing" + + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/blobbergrpc" + "github.com/0chain/blobber/code/go/0chain.net/core/common" + "github.com/0chain/blobber/code/go/0chain.net/core/encryption" + "google.golang.org/grpc/metadata" +) + +func TestGetFilestats_IntegrationTest(t *testing.T) { + bClient, tdController := setupHandlerIntegrationTests(t) + allocationTx := randString(32) + + pubKey, _, signScheme := GeneratePubPrivateKey(t) + clientSignature, _ := signScheme.Sign(encryption.Hash(allocationTx)) + + err := tdController.ClearDatabase() + if err != nil { + t.Fatal(err) + } + err = tdController.AddGetFileStatsTestData(allocationTx, pubKey) + if err != nil { + t.Fatal(err) + } + + testCases := []struct { + name string + context metadata.MD + input *blobbergrpc.GetFileStatsRequest + expectedFileName string + expectingError bool + }{ + { + name: "Success", + context: metadata.New(map[string]string{ + common.ClientHeader: "exampleOwnerId", + common.ClientSignatureHeader: clientSignature, + }), + input: &blobbergrpc.GetFileStatsRequest{ + Path: "examplePath", + PathHash: "exampleId:examplePath", + Allocation: allocationTx, + }, + expectedFileName: "filename", + expectingError: false, + }, + { + name: "Unknown Path", + context: metadata.New(map[string]string{ + common.ClientHeader: "exampleOwnerId", + common.ClientSignatureHeader: clientSignature, + }), + input: &blobbergrpc.GetFileStatsRequest{ + Path: "examplePath", + PathHash: "exampleId:examplePath123", + Allocation: allocationTx, + }, + expectedFileName: "", + expectingError: true, + }, + } + + for _, tc := range testCases { + ctx := context.Background() + ctx = metadata.NewOutgoingContext(ctx, tc.context) + getFileStatsResp, err := bClient.GetFileStats(ctx, tc.input) + if err != nil { + if !tc.expectingError { + t.Fatal(err) + } + continue + } + + if tc.expectingError { + t.Fatal("expected error") + } + + if getFileStatsResp.MetaData.FileMetaData.Name != tc.expectedFileName { + t.Fatal("unexpected file name from GetFileStats rpc") + } + } + +} diff --git a/code/go/0chain.net/blobbercore/handler/getobjectpath_integration_test.go b/code/go/0chain.net/blobbercore/handler/getobjectpath_integration_test.go new file mode 100644 index 000000000..e16bf27cd --- /dev/null +++ b/code/go/0chain.net/blobbercore/handler/getobjectpath_integration_test.go @@ -0,0 +1,71 @@ +package handler + +import ( + "context" + "testing" + + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/blobbergrpc" + "github.com/0chain/blobber/code/go/0chain.net/core/common" + "github.com/0chain/blobber/code/go/0chain.net/core/encryption" + "google.golang.org/grpc/metadata" +) + +func TestBlobberGRPCService_GetObjectPath(t *testing.T) { + bClient, tdController := setupHandlerIntegrationTests(t) + allocationTx := randString(32) + + pubKey, _, signScheme := GeneratePubPrivateKey(t) + clientSignature, _ := signScheme.Sign(encryption.Hash(allocationTx)) + + err := tdController.ClearDatabase() + if err != nil { + t.Fatal(err) + } + err = tdController.AddGetObjectPathTestData(allocationTx, pubKey) + if err != nil { + t.Fatal(err) + } + + testCases := []struct { + name string + context metadata.MD + input *blobbergrpc.GetObjectPathRequest + expectedPath string + expectingError bool + }{ + { + name: "Success", + context: metadata.New(map[string]string{ + common.ClientHeader: "exampleOwnerId", + common.ClientSignatureHeader: clientSignature, + }), + input: &blobbergrpc.GetObjectPathRequest{ + Allocation: allocationTx, + Path: "examplePath", + BlockNum: "0", + }, + expectedPath: "/", + expectingError: false, + }, + } + + for _, tc := range testCases { + ctx := context.Background() + ctx = metadata.NewOutgoingContext(ctx, tc.context) + getObjectPathResp, err := bClient.GetObjectPath(ctx, tc.input) + if err != nil { + if !tc.expectingError { + t.Fatal(err) + } + continue + } + + if tc.expectingError { + t.Fatal("expected error") + } + + if getObjectPathResp.ObjectPath.Path.DirMetaData.Path != tc.expectedPath { + t.Fatal("unexpected root hash from GetObjectPath rpc") + } + } +} diff --git a/code/go/0chain.net/blobbercore/handler/getobjecttree_integration_test.go b/code/go/0chain.net/blobbercore/handler/getobjecttree_integration_test.go new file mode 100644 index 000000000..223697c8b --- /dev/null +++ b/code/go/0chain.net/blobbercore/handler/getobjecttree_integration_test.go @@ -0,0 +1,84 @@ +package handler + +import ( + "context" + "testing" + + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/blobbergrpc" + "github.com/0chain/blobber/code/go/0chain.net/core/common" + "github.com/0chain/blobber/code/go/0chain.net/core/encryption" + "google.golang.org/grpc/metadata" +) + +func TestBlobberGRPCService_GetObjectTree(t *testing.T) { + bClient, tdController := setupHandlerIntegrationTests(t) + allocationTx := randString(32) + + pubKey, _, signScheme := GeneratePubPrivateKey(t) + clientSignature, _ := signScheme.Sign(encryption.Hash(allocationTx)) + + err := tdController.ClearDatabase() + if err != nil { + t.Fatal(err) + } + err = tdController.AddGetObjectTreeTestData(allocationTx, pubKey) + if err != nil { + t.Fatal(err) + } + + testCases := []struct { + name string + context metadata.MD + input *blobbergrpc.GetObjectTreeRequest + expectedFileName string + expectingError bool + }{ + { + name: "Success", + context: metadata.New(map[string]string{ + common.ClientHeader: "exampleOwnerId", + common.ClientSignatureHeader: clientSignature, + }), + input: &blobbergrpc.GetObjectTreeRequest{ + Path: "/", + Allocation: allocationTx, + }, + expectedFileName: "root", + expectingError: false, + }, + { + name: "bad path", + context: metadata.New(map[string]string{ + common.ClientHeader: "exampleOwnerId", + common.ClientSignatureHeader: clientSignature, + }), + input: &blobbergrpc.GetObjectTreeRequest{ + Path: "/2", + Allocation: "", + }, + expectedFileName: "root", + expectingError: true, + }, + } + + for _, tc := range testCases { + ctx := context.Background() + ctx = metadata.NewOutgoingContext(ctx, tc.context) + getObjectTreeResp, err := bClient.GetObjectTree(ctx, tc.input) + if err != nil { + if !tc.expectingError { + t.Fatal(err) + } + continue + } + + if tc.expectingError { + t.Fatal("expected error") + } + + if getObjectTreeResp.ReferencePath.MetaData.DirMetaData.Name != tc.expectedFileName { + t.Fatal("unexpected root name from GetObject") + } + } + +} diff --git a/code/go/0chain.net/blobbercore/handler/getreferencepath_integration_test.go b/code/go/0chain.net/blobbercore/handler/getreferencepath_integration_test.go new file mode 100644 index 000000000..f12ffaaef --- /dev/null +++ b/code/go/0chain.net/blobbercore/handler/getreferencepath_integration_test.go @@ -0,0 +1,72 @@ +package handler + +import ( + "context" + "testing" + + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/blobbergrpc" + "github.com/0chain/blobber/code/go/0chain.net/core/common" + "github.com/0chain/blobber/code/go/0chain.net/core/encryption" + "google.golang.org/grpc/metadata" +) + +func TestBlobberGRPCService_GetReferencePath(t *testing.T) { + + bClient, tdController := setupHandlerIntegrationTests(t) + allocationTx := randString(32) + + pubKey, _, signScheme := GeneratePubPrivateKey(t) + clientSignature, _ := signScheme.Sign(encryption.Hash(allocationTx)) + + err := tdController.ClearDatabase() + if err != nil { + t.Fatal(err) + } + err = tdController.AddGetReferencePathTestData(allocationTx, pubKey) + if err != nil { + t.Fatal(err) + } + + testCases := []struct { + name string + context metadata.MD + input *blobbergrpc.GetReferencePathRequest + expectedPath string + expectingError bool + }{ + { + name: "Success", + context: metadata.New(map[string]string{ + common.ClientHeader: "exampleOwnerId", + common.ClientSignatureHeader: clientSignature, + }), + input: &blobbergrpc.GetReferencePathRequest{ + Paths: "", + Path: "/", + Allocation: allocationTx, + }, + expectedPath: "/", + expectingError: false, + }, + } + + for _, tc := range testCases { + ctx := context.Background() + ctx = metadata.NewOutgoingContext(ctx, tc.context) + getReferencePathResp, err := bClient.GetReferencePath(ctx, tc.input) + if err != nil { + if !tc.expectingError { + t.Fatal(err) + } + continue + } + + if tc.expectingError { + t.Fatal("expected error") + } + + if getReferencePathResp.ReferencePath.MetaData.DirMetaData.Path != tc.expectedPath { + t.Fatal("unexpected path from GetReferencePath rpc") + } + } +} diff --git a/code/go/0chain.net/blobbercore/handler/grpc_commit_handler.go b/code/go/0chain.net/blobbercore/handler/grpc_commit_handler.go new file mode 100644 index 000000000..3631f9cf3 --- /dev/null +++ b/code/go/0chain.net/blobbercore/handler/grpc_commit_handler.go @@ -0,0 +1,40 @@ +package handler + +import ( + "bytes" + "context" + "mime/multipart" + "net/http" + "strings" + + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/blobbergrpc" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/convert" +) + +func (b *blobberGRPCService) Commit(ctx context.Context, req *blobbergrpc.CommitRequest) (*blobbergrpc.CommitResponse, error) { + body := bytes.NewBuffer([]byte{}) + writer := multipart.NewWriter(body) + err := writer.WriteField("write_marker", req.WriteMarker) + if err != nil { + return nil, err + } + err = writer.WriteField("connection_id", req.ConnectionId) + if err != nil { + return nil, err + } + writer.Close() + + r, err := http.NewRequest("POST", "", strings.NewReader(body.String())) + if err != nil { + return nil, err + } + httpRequestWithMetaData(r, GetGRPCMetaDataFromCtx(ctx), req.Allocation) + r.Header.Set("Content-Type", writer.FormDataContentType()) + + resp, err := CommitHandler(ctx, r) + if err != nil { + return nil, err + } + + return convert.CommitWriteResponseCreator(resp), nil +} diff --git a/code/go/0chain.net/blobbercore/handler/grpc_handler.go b/code/go/0chain.net/blobbercore/handler/grpc_handler.go index 8a1f23ff4..a02263504 100644 --- a/code/go/0chain.net/blobbercore/handler/grpc_handler.go +++ b/code/go/0chain.net/blobbercore/handler/grpc_handler.go @@ -2,401 +2,208 @@ package handler import ( "context" - "encoding/json" - "strconv" + "net/http" + "strings" - "0chain.net/blobbercore/writemarker" - - "0chain.net/blobbercore/reference" - - "github.com/grpc-ecosystem/go-grpc-middleware/logging/zap/ctxzap" - - "0chain.net/core/common" - - "go.uber.org/zap" - - "0chain.net/blobbercore/blobbergrpc" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/blobbergrpc" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/convert" ) type blobberGRPCService struct { - storageHandler StorageHandlerI - packageHandler PackageHandler blobbergrpc.UnimplementedBlobberServer } -func newGRPCBlobberService(sh StorageHandlerI, r PackageHandler) *blobberGRPCService { - return &blobberGRPCService{ - storageHandler: sh, - packageHandler: r, - } +func newGRPCBlobberService() *blobberGRPCService { + return &blobberGRPCService{} } func (b *blobberGRPCService) GetAllocation(ctx context.Context, request *blobbergrpc.GetAllocationRequest) (*blobbergrpc.GetAllocationResponse, error) { - ctx = setupGRPCHandlerContext(ctx, request.Context) + r, err := http.NewRequest("GET", "", nil) + if err != nil { + return nil, err + } + httpRequestWithMetaData(r, GetGRPCMetaDataFromCtx(ctx), "") + r.Form = map[string][]string{"id": {request.Id}} - allocation, err := b.storageHandler.verifyAllocation(ctx, request.Id, false) + resp, err := AllocationHandler(ctx, r) if err != nil { return nil, err } - return &blobbergrpc.GetAllocationResponse{Allocation: AllocationToGRPCAllocation(allocation)}, nil + return convert.GetAllocationResponseCreator(resp), nil } func (b *blobberGRPCService) GetFileMetaData(ctx context.Context, req *blobbergrpc.GetFileMetaDataRequest) (*blobbergrpc.GetFileMetaDataResponse, error) { - logger := ctxzap.Extract(ctx) - alloc, err := b.storageHandler.verifyAllocation(ctx, req.Allocation, true) + r, err := http.NewRequest("POST", "", nil) if err != nil { - return nil, common.NewError("invalid_parameters", "Invalid allocation id passed."+err.Error()) - } - - clientID := req.Context.Client - if len(clientID) == 0 { - return nil, common.NewError("invalid_operation", "Operation needs to be performed by the owner of the allocation") + return nil, err } - - path_hash := req.PathHash - path := req.Path - if len(path_hash) == 0 { - if len(path) == 0 { - return nil, common.NewError("invalid_parameters", "Invalid path") - } - path_hash = reference.GetReferenceLookup(alloc.ID, path) + httpRequestWithMetaData(r, GetGRPCMetaDataFromCtx(ctx), req.Allocation) + r.Form = map[string][]string{ + "path_hash": {req.PathHash}, + "path": {req.Path}, + "auth_token": {req.AuthToken}, } - fileref, err := b.packageHandler.GetReferenceFromLookupHash(ctx, alloc.ID, path_hash) + resp, err := FileMetaHandler(ctx, r) if err != nil { - return nil, common.NewError("invalid_parameters", "Invalid file path. "+err.Error()) - } - - if fileref.Type != reference.FILE { - return nil, common.NewError("invalid_parameters", "Path is not a file.") + return nil, err } - commitMetaTxns, err := b.packageHandler.GetCommitMetaTxns(ctx, fileref.ID) - if err != nil { - logger.Error("Failed to get commitMetaTxns from refID", zap.Error(err), zap.Any("ref_id", fileref.ID)) - } - fileref.CommitMetaTxns = commitMetaTxns + return convert.GetFileMetaDataResponseCreator(resp), nil +} - collaborators, err := b.packageHandler.GetCollaborators(ctx, fileref.ID) +func (b *blobberGRPCService) GetFileStats(ctx context.Context, req *blobbergrpc.GetFileStatsRequest) (*blobbergrpc.GetFileStatsResponse, error) { + r, err := http.NewRequest("POST", "", nil) if err != nil { - logger.Error("Failed to get collaborators from refID", zap.Error(err), zap.Any("ref_id", fileref.ID)) + return nil, err } - - // authorize file access - var ( - isOwner = clientID == alloc.OwnerID - isRepairer = clientID == alloc.RepairerID - isCollaborator = b.packageHandler.IsACollaborator(ctx, fileref.ID, clientID) - ) - - if !isOwner && !isRepairer && !isCollaborator { - // check auth token - if isAuthorized, err := b.storageHandler.verifyAuthTicket(ctx, - req.AuthToken, alloc, fileref, clientID, - ); !isAuthorized { - return nil, common.NewErrorf("download_file", - "cannot verify auth ticket: %v", err) - } - - fileref.Path = "" + httpRequestWithMetaData(r, GetGRPCMetaDataFromCtx(ctx), req.Allocation) + r.Form = map[string][]string{ + "path": {req.Path}, + "path_hash": {req.PathHash}, } - var collaboratorsGRPC []*blobbergrpc.Collaborator - for _, c := range collaborators { - collaboratorsGRPC = append(collaboratorsGRPC, &blobbergrpc.Collaborator{ - RefId: c.RefID, - ClientId: c.ClientID, - CreatedAt: c.CreatedAt.UnixNano(), - }) + resp, err := FileStatsHandler(ctx, r) + if err != nil { + return nil, err } - return &blobbergrpc.GetFileMetaDataResponse{ - MetaData: reference.FileRefToFileRefGRPC(fileref), - Collaborators: collaboratorsGRPC, - }, nil + return convert.GetFileStatsResponseCreator(resp), nil } -func (b *blobberGRPCService) GetFileStats(ctx context.Context, req *blobbergrpc.GetFileStatsRequest) (*blobbergrpc.GetFileStatsResponse, error) { - allocationTx := req.Context.Allocation - alloc, err := b.storageHandler.verifyAllocation(ctx, allocationTx, true) - +func (b *blobberGRPCService) ListEntities(ctx context.Context, req *blobbergrpc.ListEntitiesRequest) (*blobbergrpc.ListEntitiesResponse, error) { + r, err := http.NewRequest("", "", nil) if err != nil { - return nil, common.NewError("invalid_parameters", "Invalid allocation id passed."+err.Error()) + return nil, err } - - clientID := req.Context.Client - if len(clientID) == 0 || alloc.OwnerID != clientID { - return nil, common.NewError("invalid_operation", "Operation needs to be performed by the owner of the allocation") + httpRequestWithMetaData(r, GetGRPCMetaDataFromCtx(ctx), req.Allocation) + r.Form = map[string][]string{ + "path": {req.Path}, + "path_hash": {req.PathHash}, + "auth_token": {req.AuthToken}, } - path_hash := req.PathHash - path := req.Path - if len(path_hash) == 0 { - if len(path) == 0 { - return nil, common.NewError("invalid_parameters", "Invalid path") - } - path_hash = reference.GetReferenceLookup(alloc.ID, path) + resp, err := ListHandler(ctx, r) + if err != nil { + return nil, err } - fileref, err := b.packageHandler.GetReferenceFromLookupHash(ctx, alloc.ID, path_hash) + return convert.ListEntitesResponseCreator(resp), nil +} +func (b *blobberGRPCService) GetObjectPath(ctx context.Context, req *blobbergrpc.GetObjectPathRequest) (*blobbergrpc.GetObjectPathResponse, error) { + r, err := http.NewRequest("", "", nil) if err != nil { - return nil, common.NewError("invalid_parameters", "Invalid file path. "+err.Error()) + return nil, err } - - if fileref.Type != reference.FILE { - return nil, common.NewError("invalid_parameters", "Path is not a file.") + httpRequestWithMetaData(r, GetGRPCMetaDataFromCtx(ctx), req.Allocation) + r.Form = map[string][]string{ + "path": {req.Path}, + "block_num": {req.BlockNum}, } - stats, _ := b.packageHandler.GetFileStats(ctx, fileref.ID) - wm, _ := b.packageHandler.GetWriteMarkerEntity(ctx, fileref.WriteMarker) - if wm != nil && stats != nil { - stats.WriteMarkerRedeemTxn = wm.CloseTxnID + resp, err := ObjectPathHandler(ctx, r) + if err != nil { + return nil, err } - return &blobbergrpc.GetFileStatsResponse{ - MetaData: reference.FileRefToFileRefGRPC(fileref), - Stats: FileStatsToFileStatsGRPC(stats), - }, nil + return convert.GetObjectPathResponseCreator(resp), nil } -func (b *blobberGRPCService) ListEntities(ctx context.Context, req *blobbergrpc.ListEntitiesRequest) (*blobbergrpc.ListEntitiesResponse, error) { - logger := ctxzap.Extract(ctx) - - clientID := req.Context.Client - allocationTx := req.Context.Allocation - alloc, err := b.storageHandler.verifyAllocation(ctx, allocationTx, true) - +func (b *blobberGRPCService) GetReferencePath(ctx context.Context, req *blobbergrpc.GetReferencePathRequest) (*blobbergrpc.GetReferencePathResponse, error) { + r, err := http.NewRequest("", "", nil) if err != nil { - return nil, common.NewError("invalid_parameters", "Invalid allocation id passed."+err.Error()) + return nil, err } - - if len(clientID) == 0 { - return nil, common.NewError("invalid_operation", "Operation needs to be performed by the owner of the allocation") + httpRequestWithMetaData(r, GetGRPCMetaDataFromCtx(ctx), req.Allocation) + r.Form = map[string][]string{ + "path": {req.Path}, + "paths": {req.Paths}, } - path_hash := req.PathHash - path := req.Path - if len(path_hash) == 0 { - if len(path) == 0 { - return nil, common.NewError("invalid_parameters", "Invalid path") - } - path_hash = reference.GetReferenceLookup(alloc.ID, path) + resp, err := ReferencePathHandler(ctx, r) + if err != nil { + return nil, err } - logger.Info("Path Hash for list dir :" + path_hash) + return convert.GetReferencePathResponseCreator(resp), nil +} - fileref, err := b.packageHandler.GetReferenceFromLookupHash(ctx, alloc.ID, path_hash) +func (b *blobberGRPCService) GetObjectTree(ctx context.Context, req *blobbergrpc.GetObjectTreeRequest) (*blobbergrpc.GetObjectTreeResponse, error) { + r, err := http.NewRequest("", "", nil) if err != nil { - return nil, common.NewError("invalid_parameters", "Invalid path. "+err.Error()) + return nil, err } - authTokenString := req.AuthToken - if clientID != alloc.OwnerID || len(authTokenString) > 0 { - authTicketVerified, err := b.storageHandler.verifyAuthTicket(ctx, authTokenString, alloc, fileref, clientID) - if err != nil { - return nil, err - } - if !authTicketVerified { - return nil, common.NewError("auth_ticket_verification_failed", "Could not verify the auth ticket.") - } + httpRequestWithMetaData(r, GetGRPCMetaDataFromCtx(ctx), req.Allocation) + r.Form = map[string][]string{ + "path": {req.Path}, } - dirref, err := b.packageHandler.GetRefWithChildren(ctx, alloc.ID, fileref.Path) + resp, err := ObjectTreeHandler(ctx, r) if err != nil { - return nil, common.NewError("invalid_parameters", "Invalid path. "+err.Error()) - } - - if clientID != alloc.OwnerID { - dirref.Path = "" - } - - var entities []*blobbergrpc.FileRef - for _, entity := range dirref.Children { - if clientID != alloc.OwnerID { - entity.Path = "" - } - entities = append(entities, reference.FileRefToFileRefGRPC(entity)) + return nil, err } - refGRPC := reference.FileRefToFileRefGRPC(dirref) - refGRPC.DirMetaData.Children = entities - return &blobbergrpc.ListEntitiesResponse{ - AllocationRoot: alloc.AllocationRoot, - MetaData: refGRPC, - }, nil + return convert.GetObjectTreeResponseCreator(resp), nil } -func (b *blobberGRPCService) GetObjectPath(ctx context.Context, req *blobbergrpc.GetObjectPathRequest) (*blobbergrpc.GetObjectPathResponse, error) { - allocationTx := req.Context.Allocation - alloc, err := b.storageHandler.verifyAllocation(ctx, allocationTx, false) - +func (b *blobberGRPCService) CalculateHash(ctx context.Context, req *blobbergrpc.CalculateHashRequest) (*blobbergrpc.CalculateHashResponse, error) { + r, err := http.NewRequest("POST", "", nil) if err != nil { - return nil, common.NewError("invalid_parameters", "Invalid allocation id passed."+err.Error()) - } - - clientID := req.Context.Client - if len(clientID) == 0 || alloc.OwnerID != clientID { - return nil, common.NewError("invalid_operation", "Operation needs to be performed by the owner of the allocation") - } - path := req.Path - if len(path) == 0 { - return nil, common.NewError("invalid_parameters", "Invalid path") - } - - blockNumStr := req.BlockNum - if len(blockNumStr) == 0 { - return nil, common.NewError("invalid_parameters", "Invalid path") + return nil, err } - - blockNum, err := strconv.ParseInt(blockNumStr, 10, 64) - if err != nil || blockNum < 0 { - return nil, common.NewError("invalid_parameters", "Invalid block number") + httpRequestWithMetaData(r, GetGRPCMetaDataFromCtx(ctx), req.Allocation) + r.Form = map[string][]string{ + "path": {req.Path}, + "paths": {req.Paths}, } - objectPath, err := b.packageHandler.GetObjectPathGRPC(ctx, alloc.ID, blockNum) + resp, err := CalculateHashHandler(ctx, r) if err != nil { return nil, err } - var latestWM *writemarker.WriteMarkerEntity - if len(alloc.AllocationRoot) == 0 { - latestWM = nil - } else { - latestWM, err = b.packageHandler.GetWriteMarkerEntity(ctx, alloc.AllocationRoot) - if err != nil { - return nil, common.NewError("latest_write_marker_read_error", "Error reading the latest write marker for allocation."+err.Error()) - } - } - var latestWriteMarketGRPC *blobbergrpc.WriteMarker - if latestWM != nil { - latestWriteMarketGRPC = WriteMarkerToWriteMarkerGRPC(latestWM.WM) - } - return &blobbergrpc.GetObjectPathResponse{ - ObjectPath: objectPath, - LatestWriteMarker: latestWriteMarketGRPC, - }, nil + return convert.GetCalculateHashResponseCreator(resp), nil } -func (b *blobberGRPCService) GetReferencePath(ctx context.Context, req *blobbergrpc.GetReferencePathRequest) (*blobbergrpc.GetReferencePathResponse, error) { - - allocationTx := req.Context.Allocation - alloc, err := b.storageHandler.verifyAllocation(ctx, allocationTx, false) - +func (b *blobberGRPCService) CommitMetaTxn(ctx context.Context, req *blobbergrpc.CommitMetaTxnRequest) (*blobbergrpc.CommitMetaTxnResponse, error) { + r, err := http.NewRequest("POST", "", nil) if err != nil { - return nil, common.NewError("invalid_parameters", "Invalid allocation id passed."+err.Error()) + return nil, err } - - clientID := req.Context.Client - if len(clientID) == 0 { - return nil, common.NewError("invalid_operation", "Please pass clientID in the header") + httpRequestWithMetaData(r, GetGRPCMetaDataFromCtx(ctx), req.Allocation) + r.Form = map[string][]string{ + "path": {req.Path}, + "path_hash": {req.PathHash}, + "auth_token": {req.AuthToken}, + "txn_id": {req.TxnId}, } - var paths []string - pathsString := req.Paths - if len(pathsString) == 0 { - path := req.Path - if len(path) == 0 { - return nil, common.NewError("invalid_parameters", "Invalid path") - } - paths = append(paths, path) - } else { - err = json.Unmarshal([]byte(pathsString), &paths) - if err != nil { - return nil, common.NewError("invalid_parameters", "Invalid path array json") - } - } - - rootRef, err := b.packageHandler.GetReferencePathFromPaths(ctx, alloc.ID, paths) + resp, err := CommitMetaTxnHandler(ctx, r) if err != nil { return nil, err } - refPath := &blobbergrpc.ReferencePath{MetaData: reference.FileRefToFileRefGRPC(rootRef)} - refsToProcess := make([]*blobbergrpc.ReferencePath, 0) - refsToProcess = append(refsToProcess, refPath) - for len(refsToProcess) > 0 { - refToProcess := refsToProcess[0] - if len(refToProcess.MetaData.DirMetaData.Children) > 0 { - refToProcess.List = make([]*blobbergrpc.ReferencePath, len(refToProcess.MetaData.DirMetaData.Children)) - } - for idx, child := range refToProcess.MetaData.DirMetaData.Children { - childRefPath := &blobbergrpc.ReferencePath{MetaData: child} - refToProcess.List[idx] = childRefPath - refsToProcess = append(refsToProcess, childRefPath) - } - refsToProcess = refsToProcess[1:] - } - - var latestWM *writemarker.WriteMarkerEntity - if len(alloc.AllocationRoot) == 0 { - latestWM = nil - } else { - latestWM, err = writemarker.GetWriteMarkerEntity(ctx, alloc.AllocationRoot) - if err != nil { - return nil, common.NewError("latest_write_marker_read_error", "Error reading the latest write marker for allocation."+err.Error()) - } - } - var refPathResult blobbergrpc.GetReferencePathResponse - refPathResult.ReferencePath = refPath - if latestWM != nil { - refPathResult.LatestWM = WriteMarkerToWriteMarkerGRPC(latestWM.WM) - } - - return &refPathResult, nil + return convert.GetCommitMetaTxnResponseCreator(resp), nil } -func (b *blobberGRPCService) GetObjectTree(ctx context.Context, req *blobbergrpc.GetObjectTreeRequest) (*blobbergrpc.GetObjectTreeResponse, error) { - allocationTx := req.Context.Allocation - alloc, err := b.storageHandler.verifyAllocation(ctx, allocationTx, false) - +func (b *blobberGRPCService) Collaborator(ctx context.Context, req *blobbergrpc.CollaboratorRequest) (*blobbergrpc.CollaboratorResponse, error) { + r, err := http.NewRequest(strings.ToUpper(req.Method), "", nil) if err != nil { - return nil, common.NewError("invalid_parameters", "Invalid allocation id passed."+err.Error()) - } - - clientID := req.Context.Client - if len(clientID) == 0 || alloc.OwnerID != clientID { - return nil, common.NewError("invalid_operation", "Operation needs to be performed by the owner of the allocation") + return nil, err } - path := req.Path - if len(path) == 0 { - return nil, common.NewError("invalid_parameters", "Invalid path") + httpRequestWithMetaData(r, GetGRPCMetaDataFromCtx(ctx), req.Allocation) + r.Form = map[string][]string{ + "path": {req.Path}, + "path_hash": {req.PathHash}, + "collab_id": {req.CollabId}, } - rootRef, err := b.packageHandler.GetObjectTree(ctx, alloc.ID, path) + resp, err := CollaboratorHandler(ctx, r) if err != nil { return nil, err } - refPath := &blobbergrpc.ReferencePath{MetaData: reference.FileRefToFileRefGRPC(rootRef)} - refsToProcess := make([]*blobbergrpc.ReferencePath, 0) - refsToProcess = append(refsToProcess, refPath) - for len(refsToProcess) > 0 { - refToProcess := refsToProcess[0] - if len(refToProcess.MetaData.DirMetaData.Children) > 0 { - refToProcess.List = make([]*blobbergrpc.ReferencePath, len(refToProcess.MetaData.DirMetaData.Children)) - } - for idx, child := range refToProcess.MetaData.DirMetaData.Children { - childRefPath := &blobbergrpc.ReferencePath{MetaData: child} - refToProcess.List[idx] = childRefPath - refsToProcess = append(refsToProcess, childRefPath) - } - refsToProcess = refsToProcess[1:] - } - - var latestWM *writemarker.WriteMarkerEntity - if len(alloc.AllocationRoot) == 0 { - latestWM = nil - } else { - latestWM, err = writemarker.GetWriteMarkerEntity(ctx, alloc.AllocationRoot) - if err != nil { - return nil, common.NewError("latest_write_marker_read_error", "Error reading the latest write marker for allocation."+err.Error()) - } - } - var refPathResult blobbergrpc.GetObjectTreeResponse - refPathResult.ReferencePath = refPath - if latestWM != nil { - refPathResult.LatestWM = WriteMarkerToWriteMarkerGRPC(latestWM.WM) - } - return &refPathResult, nil + return convert.CollaboratorResponseCreator(resp), nil } diff --git a/code/go/0chain.net/blobbercore/handler/grpc_handler_helper_unit_test.go b/code/go/0chain.net/blobbercore/handler/grpc_handler_helper_unit_test.go deleted file mode 100644 index 66345b7ab..000000000 --- a/code/go/0chain.net/blobbercore/handler/grpc_handler_helper_unit_test.go +++ /dev/null @@ -1,58 +0,0 @@ -package handler - -import ( - "context" - - "0chain.net/blobbercore/allocation" - "0chain.net/blobbercore/reference" - "github.com/stretchr/testify/mock" -) - -// StorageHandlerI is an autogenerated mock type for the StorageHandlerI type -type storageHandlerI struct { - mock.Mock -} - -// verifyAllocation provides a mock function with given fields: ctx, tx, readonly -func (_m *storageHandlerI) verifyAllocation(ctx context.Context, tx string, readonly bool) (*allocation.Allocation, error) { - ret := _m.Called(ctx, tx, readonly) - - var r0 *allocation.Allocation - if rf, ok := ret.Get(0).(func(context.Context, string, bool) *allocation.Allocation); ok { - r0 = rf(ctx, tx, readonly) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*allocation.Allocation) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, string, bool) error); ok { - r1 = rf(ctx, tx, readonly) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// verifyAuthTicket provides a mock function with given fields: ctx, authTokenString, allocationObj, refRequested, clientID -func (_m *storageHandlerI) verifyAuthTicket(ctx context.Context, authTokenString string, allocationObj *allocation.Allocation, refRequested *reference.Ref, clientID string) (bool, error) { - ret := _m.Called(ctx, authTokenString, allocationObj, refRequested, clientID) - - var r0 bool - if rf, ok := ret.Get(0).(func(context.Context, string, *allocation.Allocation, *reference.Ref, string) bool); ok { - r0 = rf(ctx, authTokenString, allocationObj, refRequested, clientID) - } else { - r0 = ret.Get(0).(bool) - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, string, *allocation.Allocation, *reference.Ref, string) error); ok { - r1 = rf(ctx, authTokenString, allocationObj, refRequested, clientID) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} diff --git a/code/go/0chain.net/blobbercore/handler/grpc_handler_test.go b/code/go/0chain.net/blobbercore/handler/grpc_handler_test.go index 4d75cd05f..4069295b0 100644 --- a/code/go/0chain.net/blobbercore/handler/grpc_handler_test.go +++ b/code/go/0chain.net/blobbercore/handler/grpc_handler_test.go @@ -8,12 +8,14 @@ import ( "testing" "time" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/convert" + rl "go.uber.org/ratelimit" - "0chain.net/blobbercore/allocation" - "0chain.net/blobbercore/blobbergrpc" - "0chain.net/blobbercore/datastore" - "0chain.net/core/common" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/allocation" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/blobbergrpc" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/datastore" + "github.com/0chain/blobber/code/go/0chain.net/core/common" "github.com/DATA-DOG/go-sqlmock" "github.com/gorilla/mux" "github.com/stretchr/testify/assert" @@ -30,8 +32,7 @@ var ( func startGRPCServer(t *testing.T) { lis = bufconn.Listen(1024 * 1024) - grpcS := NewServerWithMiddlewares(&common.GRPCRateLimiter{Limiter: rl.New(1000)}) - RegisterGRPCServices(mux.NewRouter(), grpcS) + grpcS := NewGRPCServerWithMiddlewares(&common.GRPCRateLimiter{Limiter: rl.New(1000)}, mux.NewRouter()) go func() { if err := grpcS.Serve(lis); err != nil { t.Errorf("Server exited with error: %v", err) @@ -125,13 +126,12 @@ func Test_GetAllocation(t *testing.T) { }, args: args{ allocationR: &blobbergrpc.GetAllocationRequest{ - Id: alloc.Tx, - Context: &blobbergrpc.RequestContext{}, + Id: alloc.Tx, }, }, expectCommit: true, wantCode: codes.OK.String(), - wantAlloc: AllocationToGRPCAllocation(alloc), + wantAlloc: convert.AllocationToGRPCAllocation(alloc), }, { name: "Commiting_Transaction_ERR", @@ -157,13 +157,12 @@ func Test_GetAllocation(t *testing.T) { }, args: args{ allocationR: &blobbergrpc.GetAllocationRequest{ - Id: alloc.Tx, - Context: &blobbergrpc.RequestContext{}, + Id: alloc.Tx, }, }, expectCommit: true, wantCode: codes.OK.String(), - wantAlloc: AllocationToGRPCAllocation(alloc), + wantAlloc: convert.AllocationToGRPCAllocation(alloc), }, { name: "Expired_Allocation_ERR", @@ -189,8 +188,7 @@ func Test_GetAllocation(t *testing.T) { }, args: args{ allocationR: &blobbergrpc.GetAllocationRequest{ - Id: expiredAlloc.Tx, - Context: &blobbergrpc.RequestContext{}, + Id: expiredAlloc.Tx, }, }, wantCode: codes.Unknown.String(), @@ -206,8 +204,7 @@ func Test_GetAllocation(t *testing.T) { }, args: args{ allocationR: &blobbergrpc.GetAllocationRequest{ - Id: "", - Context: &blobbergrpc.RequestContext{}, + Id: "", }, }, wantCode: codes.Unknown.String(), @@ -223,8 +220,7 @@ func Test_GetAllocation(t *testing.T) { }, args: args{ allocationR: &blobbergrpc.GetAllocationRequest{ - Id: "id", - Context: &blobbergrpc.RequestContext{}, + Id: "id", }, }, wantCode: codes.Unknown.String(), diff --git a/code/go/0chain.net/blobbercore/handler/grpc_handler_unit_test.go b/code/go/0chain.net/blobbercore/handler/grpc_handler_unit_test.go deleted file mode 100644 index 79d576b97..000000000 --- a/code/go/0chain.net/blobbercore/handler/grpc_handler_unit_test.go +++ /dev/null @@ -1,474 +0,0 @@ -package handler - -import ( - "context" - "errors" - "testing" - - "0chain.net/blobbercore/stats" - - "0chain.net/blobbercore/reference" - - "0chain.net/blobbercore/mocks" - - "github.com/stretchr/testify/assert" - - "0chain.net/blobbercore/allocation" - - "github.com/stretchr/testify/mock" - - "0chain.net/blobbercore/blobbergrpc" -) - -func TestBlobberGRPCService_GetAllocation_Success(t *testing.T) { - req := &blobbergrpc.GetAllocationRequest{ - Context: &blobbergrpc.RequestContext{}, - Id: "something", - } - - mockStorageHandler := &storageHandlerI{} - mockReferencePackage := &mocks.PackageHandler{} - mockStorageHandler.On("verifyAllocation", mock.Anything, req.Id, false).Return(&allocation.Allocation{ - Tx: req.Id, - }, nil) - - svc := newGRPCBlobberService(mockStorageHandler, mockReferencePackage) - allocation, err := svc.GetAllocation(context.Background(), req) - assert.NoError(t, err) - assert.Equal(t, allocation.Allocation.Tx, req.Id) -} - -func TestBlobberGRPCService_GetAllocation_invalidAllocation(t *testing.T) { - req := &blobbergrpc.GetAllocationRequest{ - Context: &blobbergrpc.RequestContext{}, - Id: "invalid_allocation", - } - - mockStorageHandler := &storageHandlerI{} - mockReferencePackage := &mocks.PackageHandler{} - mockStorageHandler.On("verifyAllocation", mock.Anything, req.Id, false).Return(nil, errors.New("some error")) - - svc := newGRPCBlobberService(mockStorageHandler, mockReferencePackage) - _, err := svc.GetAllocation(context.Background(), req) - if err == nil { - t.Fatal("expected error") - } - - assert.Equal(t, err.Error(), "some error") -} - -func TestBlobberGRPCService_GetFileMetaData_Success(t *testing.T) { - req := &blobbergrpc.GetFileMetaDataRequest{ - Context: &blobbergrpc.RequestContext{ - Client: "client", - ClientKey: "", - Allocation: "", - }, - Path: "path", - PathHash: "path_hash", - AuthToken: "testval", - Allocation: "something", - } - - mockStorageHandler := &storageHandlerI{} - mockReferencePackage := &mocks.PackageHandler{} - mockStorageHandler.On("verifyAllocation", mock.Anything, req.Allocation, true).Return(&allocation.Allocation{ - ID: "allocationId", - Tx: req.Allocation, - }, nil) - mockReferencePackage.On("GetReferenceFromLookupHash", mock.Anything, mock.Anything, mock.Anything).Return(&reference.Ref{ - Name: "test", - Type: reference.FILE, - }, nil) - mockReferencePackage.On("GetCommitMetaTxns", mock.Anything, mock.Anything).Return(nil, nil) - mockReferencePackage.On("GetCollaborators", mock.Anything, mock.Anything).Return([]reference.Collaborator{ - reference.Collaborator{ - RefID: 1, - ClientID: "test", - }, - }, nil) - mockReferencePackage.On("IsACollaborator", mock.Anything, mock.Anything, mock.Anything).Return(true) - mockStorageHandler.On("verifyAuthTicket", mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(true, nil) - - svc := newGRPCBlobberService(mockStorageHandler, mockReferencePackage) - resp, err := svc.GetFileMetaData(context.Background(), req) - if err != nil { - t.Fatal("unexpected error") - } - - assert.Equal(t, resp.MetaData.FileMetaData.Name, "test") -} - -func TestBlobberGRPCService_GetFileMetaData_FileNotExist(t *testing.T) { - req := &blobbergrpc.GetFileMetaDataRequest{ - Context: &blobbergrpc.RequestContext{ - Client: "client", - ClientKey: "", - Allocation: "", - }, - Path: "path", - PathHash: "path_hash", - AuthToken: "testval", - Allocation: "something", - } - - mockStorageHandler := &storageHandlerI{} - mockReferencePackage := &mocks.PackageHandler{} - mockStorageHandler.On("verifyAllocation", mock.Anything, req.Allocation, true).Return(&allocation.Allocation{ - ID: "allocationId", - Tx: req.Allocation, - }, nil) - mockReferencePackage.On("GetReferenceFromLookupHash", mock.Anything, mock.Anything, mock.Anything).Return(nil, errors.New("file doesnt exist")) - mockReferencePackage.On("GetCommitMetaTxns", mock.Anything, mock.Anything).Return(nil, nil) - mockReferencePackage.On("GetCollaborators", mock.Anything, mock.Anything).Return([]reference.Collaborator{ - reference.Collaborator{ - RefID: 1, - ClientID: "test", - }, - }, nil) - mockReferencePackage.On("IsACollaborator", mock.Anything, mock.Anything, mock.Anything).Return(true) - mockStorageHandler.On("verifyAuthTicket", mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(true, nil) - - svc := newGRPCBlobberService(mockStorageHandler, mockReferencePackage) - _, err := svc.GetFileMetaData(context.Background(), req) - if err == nil { - t.Fatal("expected error") - } -} - -func TestBlobberGRPCService_GetFileStats_Success(t *testing.T) { - req := &blobbergrpc.GetFileStatsRequest{ - Context: &blobbergrpc.RequestContext{ - Client: "owner", - ClientKey: "", - Allocation: "", - }, - Path: "path", - PathHash: "path_hash", - Allocation: "", - } - - mockStorageHandler := &storageHandlerI{} - mockReferencePackage := &mocks.PackageHandler{} - mockStorageHandler.On("verifyAllocation", mock.Anything, req.Allocation, true).Return(&allocation.Allocation{ - ID: "allocationId", - Tx: req.Allocation, - OwnerID: "owner", - }, nil) - mockReferencePackage.On("GetReferenceFromLookupHash", mock.Anything, mock.Anything, mock.Anything).Return(&reference.Ref{ - ID: 123, - Name: "test", - Type: reference.FILE, - }, nil) - mockReferencePackage.On("GetFileStats", mock.Anything, int64(123)).Return(&stats.FileStats{ - NumBlockDownloads: 10, - }, nil) - mockReferencePackage.On("GetWriteMarkerEntity", mock.Anything, mock.Anything).Return(nil, nil) - - svc := newGRPCBlobberService(mockStorageHandler, mockReferencePackage) - resp, err := svc.GetFileStats(context.Background(), req) - if err != nil { - t.Fatal("unexpected error") - } - - assert.Equal(t, resp.MetaData.FileMetaData.Name, "test") - assert.Equal(t, resp.Stats.NumBlockDownloads, int64(10)) -} - -func TestBlobberGRPCService_GetFileStats_FileNotExist(t *testing.T) { - req := &blobbergrpc.GetFileStatsRequest{ - Context: &blobbergrpc.RequestContext{ - Client: "owner", - ClientKey: "", - Allocation: "", - }, - Path: "path", - PathHash: "path_hash", - Allocation: "", - } - - mockStorageHandler := &storageHandlerI{} - mockReferencePackage := &mocks.PackageHandler{} - mockStorageHandler.On("verifyAllocation", mock.Anything, req.Allocation, true).Return(&allocation.Allocation{ - ID: "allocationId", - Tx: req.Allocation, - OwnerID: "owner", - }, nil) - mockReferencePackage.On("GetReferenceFromLookupHash", mock.Anything, mock.Anything, mock.Anything).Return(nil, errors.New("file does not exist")) - mockReferencePackage.On("GetFileStats", mock.Anything, int64(123)).Return(&stats.FileStats{ - NumBlockDownloads: 10, - }, nil) - mockReferencePackage.On("GetWriteMarkerEntity", mock.Anything, mock.Anything).Return(nil, nil) - - svc := newGRPCBlobberService(mockStorageHandler, mockReferencePackage) - _, err := svc.GetFileStats(context.Background(), req) - if err == nil { - t.Fatal("expected error") - } -} - -func TestBlobberGRPCService_ListEntities_Success(t *testing.T) { - req := &blobbergrpc.ListEntitiesRequest{ - Context: &blobbergrpc.RequestContext{ - Client: "client", - ClientKey: "", - Allocation: "", - }, - Path: "path", - PathHash: "path_hash", - AuthToken: "something", - Allocation: "", - } - - mockStorageHandler := &storageHandlerI{} - mockReferencePackage := &mocks.PackageHandler{} - mockStorageHandler.On("verifyAllocation", mock.Anything, req.Allocation, true).Return(&allocation.Allocation{ - ID: "allocationId", - Tx: req.Allocation, - OwnerID: "owner", - AllocationRoot: "/allocationroot", - }, nil) - mockReferencePackage.On("GetReferenceFromLookupHash", mock.Anything, mock.Anything, mock.Anything).Return(&reference.Ref{ - Name: "test", - Type: reference.FILE, - }, nil) - mockStorageHandler.On("verifyAuthTicket", mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(true, nil) - mockReferencePackage.On("GetRefWithChildren", mock.Anything, mock.Anything, mock.Anything).Return(&reference.Ref{ - Name: "test", - Type: reference.DIRECTORY, - }, nil) - - svc := newGRPCBlobberService(mockStorageHandler, mockReferencePackage) - resp, err := svc.ListEntities(context.Background(), req) - if err != nil { - t.Fatal("unexpected error") - } - - assert.Equal(t, resp.AllocationRoot, "/allocationroot") -} - -func TestBlobberGRPCService_ListEntities_InvalidAuthTicket(t *testing.T) { - req := &blobbergrpc.ListEntitiesRequest{ - Context: &blobbergrpc.RequestContext{ - Client: "client", - ClientKey: "", - Allocation: "", - }, - Path: "path", - PathHash: "path_hash", - AuthToken: "something", - Allocation: "", - } - - mockStorageHandler := &storageHandlerI{} - mockReferencePackage := &mocks.PackageHandler{} - mockStorageHandler.On("verifyAllocation", mock.Anything, req.Allocation, true).Return(&allocation.Allocation{ - ID: "allocationId", - Tx: req.Allocation, - OwnerID: "owner", - }, nil) - mockReferencePackage.On("GetReferenceFromLookupHash", mock.Anything, mock.Anything, mock.Anything).Return(&reference.Ref{ - Name: "test", - Type: reference.FILE, - }, nil) - mockStorageHandler.On("verifyAuthTicket", mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(false, nil) - mockReferencePackage.On("GetRefWithChildren", mock.Anything, mock.Anything, mock.Anything).Return(&reference.Ref{ - Name: "test", - Type: reference.DIRECTORY, - }, nil) - - svc := newGRPCBlobberService(mockStorageHandler, mockReferencePackage) - _, err := svc.ListEntities(context.Background(), req) - if err == nil { - t.Fatal("expected error") - } -} - -func TestBlobberGRPCService_GetObjectPath_Success(t *testing.T) { - req := &blobbergrpc.GetObjectPathRequest{ - Context: &blobbergrpc.RequestContext{ - Client: "owner", - ClientKey: "", - Allocation: "", - }, - Allocation: "", - Path: "path", - BlockNum: "120", - } - - mockStorageHandler := &storageHandlerI{} - mockReferencePackage := &mocks.PackageHandler{} - mockStorageHandler.On("verifyAllocation", mock.Anything, req.Allocation, false).Return(&allocation.Allocation{ - ID: "allocationId", - Tx: req.Allocation, - OwnerID: "owner", - }, nil) - mockReferencePackage.On("GetObjectPathGRPC", mock.Anything, mock.Anything, mock.Anything).Return(&blobbergrpc.ObjectPath{ - RootHash: "hash", - FileBlockNum: 120, - }, nil) - - svc := newGRPCBlobberService(mockStorageHandler, mockReferencePackage) - resp, err := svc.GetObjectPath(context.Background(), req) - if err != nil { - t.Fatal("unexpected error") - } - - assert.Equal(t, resp.ObjectPath.RootHash, "hash") - assert.Equal(t, resp.ObjectPath.FileBlockNum, int64(120)) - -} - -func TestBlobberGRPCService_GetObjectPath_InvalidAllocation(t *testing.T) { - req := &blobbergrpc.GetObjectPathRequest{ - Context: &blobbergrpc.RequestContext{ - Client: "owner", - ClientKey: "", - Allocation: "", - }, - Allocation: "", - Path: "path", - BlockNum: "120", - } - - mockStorageHandler := &storageHandlerI{} - mockReferencePackage := &mocks.PackageHandler{} - mockStorageHandler.On("verifyAllocation", mock.Anything, req.Allocation, false).Return(nil, errors.New("invalid allocation")) - mockReferencePackage.On("GetObjectPathGRPC", mock.Anything, mock.Anything, mock.Anything).Return(&blobbergrpc.ObjectPath{ - RootHash: "hash", - FileBlockNum: 120, - }, nil) - - svc := newGRPCBlobberService(mockStorageHandler, mockReferencePackage) - _, err := svc.GetObjectPath(context.Background(), req) - if err == nil { - t.Fatal("expected error") - } -} - -func TestBlobberGRPCService_GetReferencePath_Success(t *testing.T) { - req := &blobbergrpc.GetReferencePathRequest{ - Context: &blobbergrpc.RequestContext{ - Client: "client", - ClientKey: "", - Allocation: "", - }, - Paths: `["something"]`, - Path: "", - Allocation: "", - } - - mockStorageHandler := &storageHandlerI{} - mockReferencePackage := &mocks.PackageHandler{} - mockStorageHandler.On("verifyAllocation", mock.Anything, req.Allocation, false).Return(&allocation.Allocation{ - ID: "allocationId", - Tx: req.Allocation, - OwnerID: "owner", - }, nil) - mockReferencePackage.On("GetReferencePathFromPaths", mock.Anything, mock.Anything, mock.Anything).Return(&reference.Ref{ - Name: "test", - Type: reference.DIRECTORY, - Children: []*reference.Ref{{Name: "test1", Type: reference.FILE}}, - }, nil) - - svc := newGRPCBlobberService(mockStorageHandler, mockReferencePackage) - resp, err := svc.GetReferencePath(context.Background(), req) - if err != nil { - t.Fatal("unexpected error") - } - - assert.Equal(t, resp.ReferencePath.MetaData.DirMetaData.Name, "test") - -} - -func TestBlobberGRPCService_GetReferencePath_InvalidPaths(t *testing.T) { - req := &blobbergrpc.GetReferencePathRequest{ - Context: &blobbergrpc.RequestContext{ - Client: "client", - ClientKey: "", - Allocation: "", - }, - Paths: `["something"]`, - Path: "", - Allocation: "", - } - - mockStorageHandler := &storageHandlerI{} - mockReferencePackage := &mocks.PackageHandler{} - mockStorageHandler.On("verifyAllocation", mock.Anything, req.Allocation, false).Return(&allocation.Allocation{ - ID: "allocationId", - Tx: req.Allocation, - OwnerID: "owner", - }, nil) - mockReferencePackage.On("GetReferencePathFromPaths", mock.Anything, mock.Anything, mock.Anything).Return(nil, errors.New("invalid paths")) - - svc := newGRPCBlobberService(mockStorageHandler, mockReferencePackage) - _, err := svc.GetReferencePath(context.Background(), req) - if err == nil { - t.Fatal("expected error") - } - - assert.Equal(t, err.Error(), "invalid paths") - -} - -func TestBlobberGRPCService_GetObjectTree_Success(t *testing.T) { - req := &blobbergrpc.GetObjectTreeRequest{ - Context: &blobbergrpc.RequestContext{ - Client: "owner", - ClientKey: "", - Allocation: "", - }, - Path: "something", - Allocation: "", - } - - mockStorageHandler := &storageHandlerI{} - mockReferencePackage := &mocks.PackageHandler{} - mockStorageHandler.On("verifyAllocation", mock.Anything, req.Allocation, false).Return(&allocation.Allocation{ - ID: "allocationId", - Tx: req.Allocation, - OwnerID: "owner", - }, nil) - mockReferencePackage.On("GetObjectTree", mock.Anything, mock.Anything, mock.Anything).Return(&reference.Ref{ - Name: "test", - Type: reference.DIRECTORY, - Children: []*reference.Ref{{Name: "test1", Type: reference.FILE}}, - }, nil) - - svc := newGRPCBlobberService(mockStorageHandler, mockReferencePackage) - resp, err := svc.GetObjectTree(context.Background(), req) - if err != nil { - t.Fatal("unexpected error - " + err.Error()) - } - - assert.Equal(t, resp.ReferencePath.MetaData.DirMetaData.Name, "test") - -} - -func TestBlobberGRPCService_GetObjectTree_NotOwner(t *testing.T) { - req := &blobbergrpc.GetObjectTreeRequest{ - Context: &blobbergrpc.RequestContext{ - Client: "hacker", - ClientKey: "", - Allocation: "", - }, - Path: "something", - Allocation: "", - } - - mockStorageHandler := &storageHandlerI{} - mockReferencePackage := &mocks.PackageHandler{} - mockStorageHandler.On("verifyAllocation", mock.Anything, req.Allocation, false).Return(&allocation.Allocation{ - ID: "allocationId", - Tx: req.Allocation, - OwnerID: "owner", - }, nil) - - svc := newGRPCBlobberService(mockStorageHandler, mockReferencePackage) - _, err := svc.GetObjectTree(context.Background(), req) - if err == nil { - t.Fatal("expected error") - } - -} diff --git a/code/go/0chain.net/blobbercore/handler/grpcMiddleware.go b/code/go/0chain.net/blobbercore/handler/grpc_middleware.go similarity index 73% rename from code/go/0chain.net/blobbercore/handler/grpcMiddleware.go rename to code/go/0chain.net/blobbercore/handler/grpc_middleware.go index 867b8b271..ec027b6fd 100644 --- a/code/go/0chain.net/blobbercore/handler/grpcMiddleware.go +++ b/code/go/0chain.net/blobbercore/handler/grpc_middleware.go @@ -2,16 +2,22 @@ package handler import ( "context" + "net/http" "time" - "0chain.net/core/common" - "0chain.net/core/logging" + "github.com/improbable-eng/grpc-web/go/grpcweb" + + "github.com/gorilla/mux" + + "github.com/0chain/blobber/code/go/0chain.net/core/common" + "github.com/0chain/blobber/code/go/0chain.net/core/logging" grpc_zap "github.com/grpc-ecosystem/go-grpc-middleware/logging/zap" "github.com/grpc-ecosystem/go-grpc-middleware/logging/zap/ctxzap" grpc_ratelimit "github.com/grpc-ecosystem/go-grpc-middleware/ratelimit" grpc_recovery "github.com/grpc-ecosystem/go-grpc-middleware/recovery" "go.uber.org/zap" "google.golang.org/grpc" + _ "google.golang.org/grpc/encoding/gzip" ) const ( @@ -52,8 +58,8 @@ func unaryTimeoutInterceptor() grpc.UnaryServerInterceptor { } } -func NewServerWithMiddlewares(limiter grpc_ratelimit.Limiter) *grpc.Server { - return grpc.NewServer( +func NewGRPCServerWithMiddlewares(limiter grpc_ratelimit.Limiter, r *mux.Router) *grpc.Server { + srv := grpc.NewServer( grpc.ChainStreamInterceptor( grpc_zap.StreamServerInterceptor(logging.Logger), grpc_recovery.StreamServerInterceptor(), @@ -66,4 +72,21 @@ func NewServerWithMiddlewares(limiter grpc_ratelimit.Limiter) *grpc.Server { unaryTimeoutInterceptor(), // should always be the lastest, to be "innermost" ), ) + + registerGRPCServices(r, srv) + + // adds grpc-web middleware + wrappedServer := grpcweb.WrapServer(srv) + r.Use(func(h http.Handler) http.Handler { + return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + if wrappedServer.IsGrpcWebRequest(r) { + wrappedServer.ServeHTTP(w, r) + return + } + + h.ServeHTTP(w, r) + }) + }) + + return srv } diff --git a/code/go/0chain.net/blobbercore/handler/handler.go b/code/go/0chain.net/blobbercore/handler/handler.go index 49da5ac50..45b7163fb 100644 --- a/code/go/0chain.net/blobbercore/handler/handler.go +++ b/code/go/0chain.net/blobbercore/handler/handler.go @@ -9,15 +9,14 @@ import ( "runtime/pprof" "time" - "0chain.net/blobbercore/config" - "0chain.net/blobbercore/constants" - "0chain.net/blobbercore/datastore" - "0chain.net/blobbercore/stats" - "0chain.net/core/common" - - . "0chain.net/core/logging" "go.uber.org/zap" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/config" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/constants" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/datastore" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/stats" + "github.com/0chain/blobber/code/go/0chain.net/core/common" + . "github.com/0chain/blobber/code/go/0chain.net/core/logging" "github.com/gorilla/mux" ) diff --git a/code/go/0chain.net/blobbercore/handler/handler_integration_tests.go b/code/go/0chain.net/blobbercore/handler/handler_integration_tests.go index d386f15b1..9f67e0ab5 100644 --- a/code/go/0chain.net/blobbercore/handler/handler_integration_tests.go +++ b/code/go/0chain.net/blobbercore/handler/handler_integration_tests.go @@ -13,17 +13,17 @@ import ( "os" "runtime/pprof" - "0chain.net/blobbercore/config" - "0chain.net/blobbercore/constants" - "0chain.net/blobbercore/datastore" - "0chain.net/blobbercore/stats" - "0chain.net/core/common" - "0chain.net/core/node" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/config" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/constants" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/datastore" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/stats" + "github.com/0chain/blobber/code/go/0chain.net/core/common" + "github.com/0chain/blobber/code/go/0chain.net/core/node" "github.com/gorilla/mux" // integration tests RPC control - crpc "0chain.net/conductor/conductrpc" + crpc "github.com/0chain/blobber/code/go/0chain.net/conductor/conductrpc" ) var storageHandler StorageHandler diff --git a/code/go/0chain.net/blobbercore/handler/handler_test.go b/code/go/0chain.net/blobbercore/handler/handler_test.go index 0f613734d..49614a930 100644 --- a/code/go/0chain.net/blobbercore/handler/handler_test.go +++ b/code/go/0chain.net/blobbercore/handler/handler_test.go @@ -1,26 +1,9 @@ package handler import ( - "0chain.net/blobbercore/allocation" - bconfig "0chain.net/blobbercore/config" - "0chain.net/blobbercore/datastore" - "0chain.net/blobbercore/filestore" - "0chain.net/blobbercore/reference" - "0chain.net/core/chain" - "0chain.net/core/common" - "0chain.net/core/config" - "0chain.net/core/encryption" - "0chain.net/core/logging" "bytes" "encoding/json" "errors" - "github.com/0chain/gosdk/core/zcncrypto" - "github.com/0chain/gosdk/zcncore" - "github.com/DATA-DOG/go-sqlmock" - "github.com/gorilla/mux" - "github.com/stretchr/testify/assert" - "go.uber.org/zap" - "gorm.io/gorm" "io" "mime/multipart" "net/http" @@ -29,6 +12,24 @@ import ( "regexp" "testing" "time" + + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/allocation" + bconfig "github.com/0chain/blobber/code/go/0chain.net/blobbercore/config" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/datastore" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/filestore" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/reference" + "github.com/0chain/blobber/code/go/0chain.net/core/chain" + "github.com/0chain/blobber/code/go/0chain.net/core/common" + "github.com/0chain/blobber/code/go/0chain.net/core/config" + "github.com/0chain/blobber/code/go/0chain.net/core/encryption" + "github.com/0chain/blobber/code/go/0chain.net/core/logging" + "github.com/0chain/gosdk/core/zcncrypto" + "github.com/0chain/gosdk/zcncore" + "github.com/DATA-DOG/go-sqlmock" + "github.com/gorilla/mux" + "github.com/stretchr/testify/assert" + "go.uber.org/zap" + "gorm.io/gorm" ) func init() { diff --git a/code/go/0chain.net/blobbercore/handler/helper.go b/code/go/0chain.net/blobbercore/handler/helper.go index 4cced3dbb..c0b32be6b 100644 --- a/code/go/0chain.net/blobbercore/handler/helper.go +++ b/code/go/0chain.net/blobbercore/handler/helper.go @@ -3,91 +3,18 @@ package handler import ( "context" - "0chain.net/blobbercore/allocation" - "0chain.net/blobbercore/reference" - "0chain.net/blobbercore/stats" - "0chain.net/blobbercore/writemarker" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/blobbergrpc" "github.com/gorilla/mux" "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" "google.golang.org/grpc" - - "0chain.net/blobbercore/blobbergrpc" - "0chain.net/blobbercore/constants" ) -func setupGRPCHandlerContext(ctx context.Context, r *blobbergrpc.RequestContext) context.Context { - ctx = context.WithValue(ctx, constants.CLIENT_CONTEXT_KEY, r.Client) - ctx = context.WithValue(ctx, constants.CLIENT_KEY_CONTEXT_KEY, r.ClientKey) - ctx = context.WithValue(ctx, constants.ALLOCATION_CONTEXT_KEY, r.Allocation) - return ctx -} +func registerGRPCServices(r *mux.Router, server *grpc.Server) { + blobberService := newGRPCBlobberService() + grpcGatewayHandler := runtime.NewServeMux() -func RegisterGRPCServices(r *mux.Router, server *grpc.Server) { - packHandler := &packageHandler{} - blobberService := newGRPCBlobberService(&storageHandler, packHandler) - mux := runtime.NewServeMux() blobbergrpc.RegisterBlobberServer(server, blobberService) - _ = blobbergrpc.RegisterBlobberHandlerServer(context.Background(), mux, blobberService) - r.PathPrefix("/").Handler(mux) -} - -type StorageHandlerI interface { - verifyAllocation(ctx context.Context, tx string, readonly bool) (alloc *allocation.Allocation, err error) - verifyAuthTicket(ctx context.Context, authTokenString string, allocationObj *allocation.Allocation, refRequested *reference.Ref, clientID string) (bool, error) -} - -// PackageHandler is an interface for all static functions that may need to be mocked -type PackageHandler interface { - GetReferenceFromLookupHash(ctx context.Context, allocationID string, path_hash string) (*reference.Ref, error) - GetCommitMetaTxns(ctx context.Context, refID int64) ([]reference.CommitMetaTxn, error) - GetCollaborators(ctx context.Context, refID int64) ([]reference.Collaborator, error) - IsACollaborator(ctx context.Context, refID int64, clientID string) bool - GetFileStats(ctx context.Context, refID int64) (*stats.FileStats, error) - GetWriteMarkerEntity(ctx context.Context, allocation_root string) (*writemarker.WriteMarkerEntity, error) - GetRefWithChildren(ctx context.Context, allocationID string, path string) (*reference.Ref, error) - GetObjectPathGRPC(ctx context.Context, allocationID string, blockNum int64) (*blobbergrpc.ObjectPath, error) - GetReferencePathFromPaths(ctx context.Context, allocationID string, paths []string) (*reference.Ref, error) - GetObjectTree(ctx context.Context, allocationID string, path string) (*reference.Ref, error) -} - -type packageHandler struct{} - -func (r *packageHandler) GetObjectTree(ctx context.Context, allocationID string, path string) (*reference.Ref, error) { - return reference.GetObjectTree(ctx, allocationID, path) -} - -func (r *packageHandler) GetReferencePathFromPaths(ctx context.Context, allocationID string, paths []string) (*reference.Ref, error) { - return reference.GetReferencePathFromPaths(ctx, allocationID, paths) -} - -func (r *packageHandler) GetRefWithChildren(ctx context.Context, allocationID string, path string) (*reference.Ref, error) { - return reference.GetRefWithChildren(ctx, allocationID, path) -} - -func (r *packageHandler) GetObjectPathGRPC(ctx context.Context, allocationID string, blockNum int64) (*blobbergrpc.ObjectPath, error) { - return reference.GetObjectPathGRPC(ctx, allocationID, blockNum) -} - -func (r *packageHandler) GetFileStats(ctx context.Context, refID int64) (*stats.FileStats, error) { - return stats.GetFileStats(ctx, refID) -} - -func (r *packageHandler) GetWriteMarkerEntity(ctx context.Context, allocation_root string) (*writemarker.WriteMarkerEntity, error) { - return writemarker.GetWriteMarkerEntity(ctx, allocation_root) -} - -func (r *packageHandler) GetReferenceFromLookupHash(ctx context.Context, allocationID string, path_hash string) (*reference.Ref, error) { - return reference.GetReferenceFromLookupHash(ctx, allocationID, path_hash) -} - -func (r *packageHandler) GetCommitMetaTxns(ctx context.Context, refID int64) ([]reference.CommitMetaTxn, error) { - return reference.GetCommitMetaTxns(ctx, refID) -} - -func (r *packageHandler) GetCollaborators(ctx context.Context, refID int64) ([]reference.Collaborator, error) { - return reference.GetCollaborators(ctx, refID) -} + _ = blobbergrpc.RegisterBlobberHandlerServer(context.Background(), grpcGatewayHandler, blobberService) + r.PathPrefix("/").Handler(grpcGatewayHandler) -func (r *packageHandler) IsACollaborator(ctx context.Context, refID int64, clientID string) bool { - return reference.IsACollaborator(ctx, refID, clientID) } diff --git a/code/go/0chain.net/blobbercore/handler/helper_integration_test.go b/code/go/0chain.net/blobbercore/handler/helper_integration_test.go new file mode 100644 index 000000000..52fb4ea48 --- /dev/null +++ b/code/go/0chain.net/blobbercore/handler/helper_integration_test.go @@ -0,0 +1,895 @@ +package handler + +import ( + "context" + "database/sql" + "fmt" + "log" + "math/rand" + "os" + "strings" + "time" + + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/blobbergrpc" + "google.golang.org/grpc" + "gorm.io/driver/postgres" + + "github.com/0chain/blobber/code/go/0chain.net/core/common" + + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/config" + "github.com/spf13/viper" + + "testing" + + "gorm.io/gorm" + + "github.com/0chain/gosdk/core/zcncrypto" +) + +const BlobberTestAddr = "localhost:31501" +const RetryAttempts = 8 +const RetryTimeout = 3 + +func randString(n int) string { + + const hexLetters = "abcdef0123456789" + + var sb strings.Builder + for i := 0; i < n; i++ { + sb.WriteByte(hexLetters[rand.Intn(len(hexLetters))]) + } + return sb.String() +} + +func setupHandlerIntegrationTests(t *testing.T) (blobbergrpc.BlobberClient, *TestDataController) { + args := make(map[string]bool) + for _, arg := range os.Args { + args[arg] = true + } + if !args["integration"] { + t.Skip() + } + + var conn *grpc.ClientConn + var err error + for i := 0; i < RetryAttempts; i++ { + conn, err = grpc.Dial(BlobberTestAddr, grpc.WithInsecure()) + if err != nil { + log.Println(err) + <-time.After(time.Second * RetryTimeout) + continue + } + break + } + if err != nil { + t.Fatal(err) + } + bClient := blobbergrpc.NewBlobberClient(conn) + + setupIntegrationTestConfig(t) + db, err := gorm.Open(postgres.Open(fmt.Sprintf( + "host=%v port=%v user=%v dbname=%v password=%v sslmode=disable", + config.Configuration.DBHost, config.Configuration.DBPort, + config.Configuration.DBUserName, config.Configuration.DBName, + config.Configuration.DBPassword)), &gorm.Config{}) + if err != nil { + t.Fatal(err) + } + tdController := NewTestDataController(db) + + return bClient, tdController +} + +type TestDataController struct { + db *gorm.DB +} + +func NewTestDataController(db *gorm.DB) *TestDataController { + return &TestDataController{db: db} +} + +// ClearDatabase deletes all data from all tables +func (c *TestDataController) ClearDatabase() error { + var err error + var tx *sql.Tx + defer func() { + if err != nil { + if tx != nil { + errRollback := tx.Rollback() + if errRollback != nil { + log.Println(errRollback) + } + } + } + }() + + db, err := c.db.DB() + if err != nil { + return err + } + + tx, err = db.BeginTx(context.Background(), &sql.TxOptions{}) + if err != nil { + return err + } + + _, err = tx.Exec("truncate allocations cascade") + if err != nil { + return err + } + + _, err = tx.Exec("truncate reference_objects cascade") + if err != nil { + return err + } + + _, err = tx.Exec("truncate commit_meta_txns cascade") + if err != nil { + return err + } + + _, err = tx.Exec("truncate collaborators cascade") + if err != nil { + return err + } + + _, err = tx.Exec("truncate allocation_changes cascade") + if err != nil { + return err + } + + _, err = tx.Exec("truncate allocation_connections cascade") + if err != nil { + return err + } + + _, err = tx.Exec("truncate write_markers cascade") + if err != nil { + return err + } + + err = tx.Commit() + if err != nil { + return err + } + + return nil +} + +func (c *TestDataController) AddGetAllocationTestData() error { + var err error + var tx *sql.Tx + defer func() { + if err != nil { + if tx != nil { + errRollback := tx.Rollback() + if errRollback != nil { + log.Println(errRollback) + } + } + } + }() + + db, err := c.db.DB() + if err != nil { + return err + } + + tx, err = db.BeginTx(context.Background(), &sql.TxOptions{}) + if err != nil { + return err + } + + expTime := time.Now().Add(time.Hour * 100000).UnixNano() + + _, err = tx.Exec(` +INSERT INTO allocations (id, tx, owner_id, owner_public_key, expiration_date, payer_id, repairer_id, is_immutable) +VALUES ('exampleId' ,'exampleTransaction','exampleOwnerId','exampleOwnerPublicKey',` + fmt.Sprint(expTime) + `,'examplePayerId', 'repairer_id', false); +`) + if err != nil { + return err + } + + err = tx.Commit() + if err != nil { + return err + } + + return nil +} + +func (c *TestDataController) AddGetFileMetaDataTestData() error { + var err error + var tx *sql.Tx + defer func() { + if err != nil { + if tx != nil { + errRollback := tx.Rollback() + if errRollback != nil { + log.Println(errRollback) + } + } + } + }() + + db, err := c.db.DB() + if err != nil { + return err + } + + tx, err = db.BeginTx(context.Background(), &sql.TxOptions{}) + if err != nil { + return err + } + + expTime := time.Now().Add(time.Hour * 100000).UnixNano() + + _, err = tx.Exec(` +INSERT INTO allocations (id, tx, owner_id, owner_public_key, expiration_date, payer_id, repairer_id, is_immutable) +VALUES ('exampleId' ,'exampleTransaction','exampleOwnerId','exampleOwnerPublicKey',` + fmt.Sprint(expTime) + `,'examplePayerId', 'repairer_id', false); +`) + if err != nil { + return err + } + + _, err = tx.Exec(` +INSERT INTO reference_objects (id, allocation_id, path_hash,lookup_hash,type,name,path,hash,custom_meta,content_hash,merkle_root,actual_file_hash,mimetype,write_marker,thumbnail_hash, actual_thumbnail_hash) +VALUES (1234,'exampleId','exampleId:examplePath','exampleId:examplePath','f','filename','examplePath','someHash','customMeta','contentHash','merkleRoot','actualFileHash','mimetype','writeMarker','thumbnailHash','actualThumbnailHash'); +`) + if err != nil { + return err + } + + _, err = tx.Exec(` +INSERT INTO commit_meta_txns (ref_id,txn_id) +VALUES (1234,'someTxn'); +`) + if err != nil { + return err + } + + _, err = tx.Exec(` +INSERT INTO collaborators (ref_id, client_id) +VALUES (1234, 'someClient'); +`) + if err != nil { + return err + } + + err = tx.Commit() + if err != nil { + return err + } + + return nil +} + +func (c *TestDataController) AddGetFileStatsTestData(allocationTx, pubKey string) error { + var err error + var tx *sql.Tx + defer func() { + if err != nil { + if tx != nil { + errRollback := tx.Rollback() + if errRollback != nil { + log.Println(errRollback) + } + } + } + }() + + db, err := c.db.DB() + if err != nil { + return err + } + + tx, err = db.BeginTx(context.Background(), &sql.TxOptions{}) + if err != nil { + return err + } + + expTime := time.Now().Add(time.Hour * 100000).UnixNano() + + _, err = tx.Exec(` +INSERT INTO allocations (id, tx, owner_id, owner_public_key, expiration_date, payer_id, repairer_id, is_immutable) +VALUES ('exampleId' ,'` + allocationTx + `','exampleOwnerId','` + pubKey + `',` + fmt.Sprint(expTime) + `,'examplePayerId', 'repairer_id', false); +`) + if err != nil { + return err + } + + _, err = tx.Exec(` +INSERT INTO reference_objects (id, allocation_id, path_hash,lookup_hash,type,name,path,hash,custom_meta,content_hash,merkle_root,actual_file_hash,mimetype,write_marker,thumbnail_hash, actual_thumbnail_hash) +VALUES (1234,'exampleId','exampleId:examplePath','exampleId:examplePath','f','filename','examplePath','someHash','customMeta','contentHash','merkleRoot','actualFileHash','mimetype','writeMarker','thumbnailHash','actualThumbnailHash'); +`) + if err != nil { + return err + } + + err = tx.Commit() + if err != nil { + return err + } + + return nil +} + +func (c *TestDataController) AddListEntitiesTestData(allocationTx, pubkey string) error { + var err error + var tx *sql.Tx + defer func() { + if err != nil { + if tx != nil { + errRollback := tx.Rollback() + if errRollback != nil { + log.Println(errRollback) + } + } + } + }() + + db, err := c.db.DB() + if err != nil { + return err + } + + tx, err = db.BeginTx(context.Background(), &sql.TxOptions{}) + if err != nil { + return err + } + + expTime := time.Now().Add(time.Hour * 100000).UnixNano() + + _, err = tx.Exec(` +INSERT INTO allocations (id, tx, owner_id, owner_public_key, expiration_date, payer_id, repairer_id, is_immutable) +VALUES ('exampleId' ,'` + allocationTx + `','exampleOwnerId','` + pubkey + `',` + fmt.Sprint(expTime) + `,'examplePayerId', 'repairer_id', false); +`) + if err != nil { + return err + } + + _, err = tx.Exec(` +INSERT INTO reference_objects (id, allocation_id, path_hash,lookup_hash,type,name,path,hash,custom_meta,content_hash,merkle_root,actual_file_hash,mimetype,write_marker,thumbnail_hash, actual_thumbnail_hash) +VALUES (1234,'exampleId','exampleId:examplePath','exampleId:examplePath','f','filename','examplePath','someHash','customMeta','contentHash','merkleRoot','actualFileHash','mimetype','writeMarker','thumbnailHash','actualThumbnailHash'); +`) + if err != nil { + return err + } + + err = tx.Commit() + if err != nil { + return err + } + + return nil +} + +func (c *TestDataController) AddGetObjectPathTestData(allocationTx, pubKey string) error { + var err error + var tx *sql.Tx + defer func() { + if err != nil { + if tx != nil { + errRollback := tx.Rollback() + if errRollback != nil { + log.Println(errRollback) + } + } + } + }() + + db, err := c.db.DB() + if err != nil { + return err + } + + tx, err = db.BeginTx(context.Background(), &sql.TxOptions{}) + if err != nil { + return err + } + + expTime := time.Now().Add(time.Hour * 100000).UnixNano() + + _, err = tx.Exec(` +INSERT INTO allocations (id, tx, owner_id, owner_public_key, expiration_date, payer_id, repairer_id, is_immutable) +VALUES ('exampleId' ,'` + allocationTx + `','exampleOwnerId','` + pubKey + `',` + fmt.Sprint(expTime) + `,'examplePayerId', 'repairer_id', false); +`) + if err != nil { + return err + } + + err = tx.Commit() + if err != nil { + return err + } + + return nil +} + +func (c *TestDataController) AddGetReferencePathTestData(allocationTx, pubkey string) error { + var err error + var tx *sql.Tx + defer func() { + if err != nil { + if tx != nil { + errRollback := tx.Rollback() + if errRollback != nil { + log.Println(errRollback) + } + } + } + }() + + db, err := c.db.DB() + if err != nil { + return err + } + + tx, err = db.BeginTx(context.Background(), &sql.TxOptions{}) + if err != nil { + return err + } + + expTime := time.Now().Add(time.Hour * 100000).UnixNano() + + _, err = tx.Exec(` +INSERT INTO allocations (id, tx, owner_id, owner_public_key, expiration_date, payer_id, repairer_id, is_immutable) +VALUES ('exampleId' ,'` + allocationTx + `','exampleOwnerId','` + pubkey + `',` + fmt.Sprint(expTime) + `,'examplePayerId', 'repairer_id', false); +`) + if err != nil { + return err + } + + err = tx.Commit() + if err != nil { + return err + } + + return nil +} + +func (c *TestDataController) AddGetObjectTreeTestData(allocationTx, pubkey string) error { + var err error + var tx *sql.Tx + defer func() { + if err != nil { + if tx != nil { + errRollback := tx.Rollback() + if errRollback != nil { + log.Println(errRollback) + } + } + } + }() + + db, err := c.db.DB() + if err != nil { + return err + } + + tx, err = db.BeginTx(context.Background(), &sql.TxOptions{}) + if err != nil { + return err + } + + expTime := time.Now().Add(time.Hour * 100000).UnixNano() + + _, err = tx.Exec(` +INSERT INTO allocations (id, tx, owner_id, owner_public_key, expiration_date, payer_id, repairer_id, is_immutable) +VALUES ('exampleId' ,'` + allocationTx + `','exampleOwnerId','` + pubkey + `',` + fmt.Sprint(expTime) + `,'examplePayerId', 'repairer_id', false); +`) + if err != nil { + return err + } + + _, err = tx.Exec(` +INSERT INTO reference_objects (id, allocation_id, path_hash,lookup_hash,type,name,path,hash,custom_meta,content_hash,merkle_root,actual_file_hash,mimetype,write_marker,thumbnail_hash, actual_thumbnail_hash) +VALUES (1234,'exampleId','exampleId:examplePath','exampleId:examplePath','d','root','/','someHash','customMeta','contentHash','merkleRoot','actualFileHash','mimetype','writeMarker','thumbnailHash','actualThumbnailHash'); +`) + if err != nil { + return err + } + + err = tx.Commit() + if err != nil { + return err + } + + return nil +} + +func GeneratePubPrivateKey(t *testing.T) (string, string, zcncrypto.SignatureScheme) { + + signScheme := zcncrypto.NewSignatureScheme("bls0chain") + wallet, err := signScheme.GenerateKeys() + if err != nil { + t.Fatal(err) + } + keyPair := wallet.Keys[0] + + _ = signScheme.SetPrivateKey(keyPair.PrivateKey) + return keyPair.PublicKey, keyPair.PrivateKey, signScheme +} + +func setupIntegrationTestConfig(t *testing.T) { + + pwd, err := os.Getwd() + if err != nil { + t.Fatal(err) + } + configDir := strings.Split(pwd, "/code/go")[0] + "/config" + config.SetupDefaultConfig() + config.SetupConfig(configDir) + + config.Configuration.DBHost = "localhost" + config.Configuration.DBName = viper.GetString("db.name") + config.Configuration.DBPort = viper.GetString("db.port") + config.Configuration.DBUserName = viper.GetString("db.user") + config.Configuration.DBPassword = viper.GetString("db.password") +} + +func (c *TestDataController) AddCommitTestData(allocationTx, pubkey, clientId, wmSig string, now common.Timestamp) error { + var err error + var tx *sql.Tx + defer func() { + if err != nil { + if tx != nil { + errRollback := tx.Rollback() + if errRollback != nil { + log.Println(errRollback) + } + } + } + }() + + db, err := c.db.DB() + if err != nil { + return err + } + + tx, err = db.BeginTx(context.Background(), &sql.TxOptions{}) + if err != nil { + return err + } + + expTime := time.Now().Add(time.Hour * 100000).UnixNano() + + _, err = tx.Exec(` +INSERT INTO allocations (id, tx, owner_id, owner_public_key, expiration_date, payer_id, blobber_size, allocation_root, repairer_id, is_immutable) +VALUES ('exampleId' ,'` + allocationTx + `','` + clientId + `','` + pubkey + `',` + fmt.Sprint(expTime) + `,'examplePayerId', 99999999, '/', 'repairer_id', false); +`) + if err != nil { + return err + } + + _, err = tx.Exec(` +INSERT INTO allocation_connections (connection_id, allocation_id, client_id, size, status) +VALUES ('connection_id' ,'exampleId','` + clientId + `', 1337, 1); +`) + if err != nil { + return err + } + + _, err = tx.Exec(` +INSERT INTO allocation_changes (id, connection_id, operation, size, input) +VALUES (1 ,'connection_id','rename', 1200, '{"allocation_id":"exampleId","path":"/some_file","new_name":"new_name"}'); +`) + if err != nil { + return err + } + + _, err = tx.Exec(` +INSERT INTO write_markers(prev_allocation_root, allocation_root, status, allocation_id, size, client_id, signature, blobber_id, timestamp, connection_id, client_key) +VALUES ('/', '/', 2,'exampleId', 1337, '` + clientId + `','` + wmSig + `','blobber_id', ` + fmt.Sprint(now) + `, 'connection_id', '` + pubkey + `'); +`) + if err != nil { + return err + } + + _, err = tx.Exec(` +INSERT INTO reference_objects (id, allocation_id, path_hash,lookup_hash,type,name,path,hash,custom_meta,content_hash,merkle_root,actual_file_hash,mimetype,write_marker,thumbnail_hash, actual_thumbnail_hash, parent_path) +VALUES +(1234,'exampleId','exampleId:examplePath','exampleId:examplePath','d','root','/','someHash','customMeta','contentHash','merkleRoot','actualFileHash','mimetype','writeMarker','thumbnailHash','actualThumbnailHash','/'), +(123,'exampleId','exampleId:examplePath','exampleId:examplePath','f','some_file','/some_file','someHash','customMeta','contentHash','merkleRoot','actualFileHash','mimetype','writeMarker','thumbnailHash','actualThumbnailHash','/'); +`) + if err != nil { + return err + } + + err = tx.Commit() + if err != nil { + return err + } + + return nil +} + +func (c *TestDataController) AddAttributesTestData(allocationTx, pubkey, clientId string) error { + var err error + var tx *sql.Tx + defer func() { + if err != nil { + if tx != nil { + errRollback := tx.Rollback() + if errRollback != nil { + log.Println(errRollback) + } + } + } + }() + + db, err := c.db.DB() + if err != nil { + return err + } + + tx, err = db.BeginTx(context.Background(), &sql.TxOptions{}) + if err != nil { + return err + } + + expTime := time.Now().Add(time.Hour * 100000).UnixNano() + + _, err = tx.Exec(` +INSERT INTO allocations (id, tx, owner_id, owner_public_key, expiration_date, payer_id, blobber_size, allocation_root, repairer_id, is_immutable) +VALUES ('exampleId' ,'` + allocationTx + `','` + clientId + `','` + pubkey + `',` + fmt.Sprint(expTime) + `,'examplePayerId', 99999999, '/', 'repairer_id', false); +`) + if err != nil { + return err + } + + _, err = tx.Exec(` +INSERT INTO allocation_connections (connection_id, allocation_id, client_id, size, status) +VALUES ('connection_id' ,'exampleId','` + clientId + `', 1337, 1); +`) + if err != nil { + return err + } + + _, err = tx.Exec(` +INSERT INTO reference_objects (id, allocation_id, path_hash,lookup_hash,type,name,path,hash,custom_meta,content_hash,merkle_root,actual_file_hash,mimetype,write_marker,thumbnail_hash, actual_thumbnail_hash, parent_path) +VALUES +(1234,'exampleId','exampleId:examplePath','exampleId:examplePath','d','root','/','someHash','customMeta','contentHash','merkleRoot','actualFileHash','mimetype','writeMarker','thumbnailHash','actualThumbnailHash','/'), +(123,'exampleId','exampleId:examplePath','exampleId:examplePath','f','some_file','/some_file','someHash','customMeta','contentHash','merkleRoot','actualFileHash','mimetype','writeMarker','thumbnailHash','actualThumbnailHash','/'); +`) + if err != nil { + return err + } + + err = tx.Commit() + if err != nil { + return err + } + + return nil +} + +func (c *TestDataController) AddCopyObjectData(allocationTx, pubkey, clientId string) error { + var err error + var tx *sql.Tx + defer func() { + if err != nil { + if tx != nil { + errRollback := tx.Rollback() + if errRollback != nil { + log.Println(errRollback) + } + } + } + }() + + db, err := c.db.DB() + if err != nil { + return err + } + + tx, err = db.BeginTx(context.Background(), &sql.TxOptions{}) + if err != nil { + return err + } + + expTime := time.Now().Add(time.Hour * 100000).UnixNano() + + _, err = tx.Exec(` +INSERT INTO allocations (id, tx, owner_id, owner_public_key, expiration_date, payer_id, blobber_size, allocation_root, repairer_id, is_immutable) +VALUES ('exampleId' ,'` + allocationTx + `','` + clientId + `','` + pubkey + `',` + fmt.Sprint(expTime) + `,'examplePayerId', 99999999, '/', 'repairer_id', false); +`) + if err != nil { + return err + } + + _, err = tx.Exec(` +INSERT INTO allocation_connections (connection_id, allocation_id, client_id, size, status) +VALUES ('connection_id' ,'exampleId','` + clientId + `', 1337, 1); +`) + if err != nil { + return err + } + + _, err = tx.Exec(` +INSERT INTO reference_objects (id, allocation_id, path_hash,lookup_hash,type,name,path,hash,custom_meta,content_hash,merkle_root,actual_file_hash,mimetype,write_marker,thumbnail_hash, actual_thumbnail_hash, parent_path) +VALUES +(1234,'exampleId','exampleId:examplePath','exampleId:examplePath','d','root','/copy','someHash','customMeta','contentHash','merkleRoot','actualFileHash','mimetype','writeMarker','thumbnailHash','actualThumbnailHash','/'), +(123,'exampleId','exampleId:examplePath','exampleId:examplePath','f','some_file','/some_file','someHash','customMeta','contentHash','merkleRoot','actualFileHash','mimetype','writeMarker','thumbnailHash','actualThumbnailHash','/'); +`) + if err != nil { + return err + } + + err = tx.Commit() + if err != nil { + return err + } + + return nil +} + +func (c *TestDataController) AddRenameTestData(allocationTx, pubkey, clientId string) error { + var err error + var tx *sql.Tx + defer func() { + if err != nil { + if tx != nil { + errRollback := tx.Rollback() + if errRollback != nil { + log.Println(errRollback) + } + } + } + }() + + db, err := c.db.DB() + if err != nil { + return err + } + + tx, err = db.BeginTx(context.Background(), &sql.TxOptions{}) + if err != nil { + return err + } + + expTime := time.Now().Add(time.Hour * 100000).UnixNano() + + _, err = tx.Exec(` +INSERT INTO allocations (id, tx, owner_id, owner_public_key, expiration_date, payer_id, blobber_size, allocation_root, repairer_id, is_immutable) +VALUES ('exampleId' ,'` + allocationTx + `','` + clientId + `','` + pubkey + `',` + fmt.Sprint(expTime) + `,'examplePayerId', 99999999, '/', 'repairer_id', false); +`) + if err != nil { + return err + } + + _, err = tx.Exec(` +INSERT INTO allocation_connections (connection_id, allocation_id, client_id, size, status) +VALUES ('connection_id' ,'exampleId','` + clientId + `', 1337, 1); +`) + if err != nil { + return err + } + + _, err = tx.Exec(` +INSERT INTO reference_objects (id, allocation_id, path_hash,lookup_hash,type,name,path,hash,custom_meta,content_hash,merkle_root,actual_file_hash,mimetype,write_marker,thumbnail_hash, actual_thumbnail_hash, parent_path) +VALUES +(1234,'exampleId','exampleId:examplePath','exampleId:examplePath','d','root','/','someHash','customMeta','contentHash','merkleRoot','actualFileHash','mimetype','writeMarker','thumbnailHash','actualThumbnailHash','/'), +(123,'exampleId','exampleId:examplePath','exampleId:examplePath','f','some_file','/some_file','someHash','customMeta','contentHash','merkleRoot','actualFileHash','mimetype','writeMarker','thumbnailHash','actualThumbnailHash','/'); +`) + if err != nil { + return err + } + + err = tx.Commit() + if err != nil { + return err + } + + return nil +} + +func (c *TestDataController) AddDownloadTestData(allocationTx, pubkey, clientId, wmSig string, now common.Timestamp) error { + var err error + var tx *sql.Tx + defer func() { + if err != nil { + if tx != nil { + errRollback := tx.Rollback() + if errRollback != nil { + log.Println(errRollback) + } + } + } + }() + + db, err := c.db.DB() + if err != nil { + return err + } + + tx, err = db.BeginTx(context.Background(), &sql.TxOptions{}) + if err != nil { + return err + } + + expTime := time.Now().Add(time.Hour * 100000).UnixNano() + + _, err = tx.Exec(` +INSERT INTO allocations (id, tx, owner_id, owner_public_key, expiration_date, payer_id, blobber_size, allocation_root, repairer_id, is_immutable) +VALUES ('exampleId' ,'` + allocationTx + `','` + clientId + `','` + pubkey + `',` + fmt.Sprint(expTime) + `,'examplePayerId', 99999999, '/', 'repairer_id', false); +`) + if err != nil { + return err + } + + _, err = tx.Exec(` +INSERT INTO allocation_connections (connection_id, allocation_id, client_id, size, status) +VALUES ('connection_id' ,'exampleId','` + clientId + `', 1337, 1); +`) + if err != nil { + return err + } + + _, err = tx.Exec(` +INSERT INTO allocation_changes (id, connection_id, operation, size, input) +VALUES (1 ,'connection_id','rename', 1200, '{"allocation_id":"exampleId","path":"/some_file","new_name":"new_name"}'); +`) + if err != nil { + return err + } + + _, err = tx.Exec(` +INSERT INTO reference_objects (id, allocation_id, path_hash,lookup_hash,type,name,path,hash,custom_meta,content_hash,merkle_root,actual_file_hash,mimetype,write_marker,thumbnail_hash, actual_thumbnail_hash, parent_path) +VALUES +(1234,'exampleId','exampleId:examplePath','exampleId:examplePath','d','root','/','someHash','customMeta','contentHash','merkleRoot','actualFileHash','mimetype','writeMarker','thumbnailHash','actualThumbnailHash','/'), +(123,'exampleId','exampleId:examplePath','exampleId:examplePath','f','some_file','/some_file','someHash','customMeta','tmpMonWenMyFile','merkleRoot','actualFileHash','mimetype','writeMarker','thumbnailHash','actualThumbnailHash','/'); +`) + if err != nil { + return err + } + + err = tx.Commit() + if err != nil { + return err + } + + return nil +} + +func (c *TestDataController) AddUploadTestData(allocationTx, pubkey, clientId string) error { + var err error + var tx *sql.Tx + defer func() { + if err != nil { + if tx != nil { + errRollback := tx.Rollback() + if errRollback != nil { + log.Println(errRollback) + } + } + } + }() + + db, err := c.db.DB() + if err != nil { + return err + } + + tx, err = db.BeginTx(context.Background(), &sql.TxOptions{}) + if err != nil { + return err + } + + expTime := time.Now().Add(time.Hour * 100000).UnixNano() + + _, err = tx.Exec(` +INSERT INTO allocations (id, tx, owner_id, owner_public_key, expiration_date, payer_id, blobber_size, allocation_root, repairer_id, is_immutable) +VALUES ('exampleId' ,'` + allocationTx + `','` + clientId + `','` + pubkey + `',` + fmt.Sprint(expTime) + `,'examplePayerId', 99999999, '/', 'repairer_id', false); +`) + if err != nil { + return err + } + + err = tx.Commit() + if err != nil { + return err + } + + return nil +} diff --git a/code/go/0chain.net/blobbercore/handler/listentities_integration_test.go b/code/go/0chain.net/blobbercore/handler/listentities_integration_test.go new file mode 100644 index 000000000..f0a83e4b0 --- /dev/null +++ b/code/go/0chain.net/blobbercore/handler/listentities_integration_test.go @@ -0,0 +1,89 @@ +package handler + +import ( + "context" + "testing" + + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/blobbergrpc" + "github.com/0chain/blobber/code/go/0chain.net/core/common" + "github.com/0chain/blobber/code/go/0chain.net/core/encryption" + "google.golang.org/grpc/metadata" +) + +func TestBlobberGRPCService_ListEntities(t *testing.T) { + bClient, tdController := setupHandlerIntegrationTests(t) + + allocationTx := randString(32) + + pubKey, _, signScheme := GeneratePubPrivateKey(t) + clientSignature, _ := signScheme.Sign(encryption.Hash(allocationTx)) + + err := tdController.ClearDatabase() + if err != nil { + t.Fatal(err) + } + err = tdController.AddListEntitiesTestData(allocationTx, pubKey) + if err != nil { + t.Fatal(err) + } + + testCases := []struct { + name string + context metadata.MD + input *blobbergrpc.ListEntitiesRequest + expectedPath string + expectingError bool + }{ + { + name: "Success", + context: metadata.New(map[string]string{ + common.ClientHeader: "exampleOwnerId", + common.ClientSignatureHeader: clientSignature, + }), + input: &blobbergrpc.ListEntitiesRequest{ + Path: "examplePath", + PathHash: "exampleId:examplePath", + AuthToken: "", + Allocation: allocationTx, + }, + expectedPath: "examplePath", + expectingError: false, + }, + { + name: "bad path", + context: metadata.New(map[string]string{ + common.ClientHeader: "exampleOwnerId", + common.ClientSignatureHeader: clientSignature, + }), + input: &blobbergrpc.ListEntitiesRequest{ + Path: "examplePath", + PathHash: "exampleId:examplePath123", + AuthToken: "", + Allocation: allocationTx, + }, + expectedPath: "", + expectingError: true, + }, + } + + for _, tc := range testCases { + ctx := context.Background() + ctx = metadata.NewOutgoingContext(ctx, tc.context) + listEntitiesResp, err := bClient.ListEntities(ctx, tc.input) + if err != nil { + if !tc.expectingError { + t.Fatal(err) + } + continue + } + + if tc.expectingError { + t.Fatal("expected error") + } + + if listEntitiesResp.MetaData.DirMetaData.Path != tc.expectedPath { + t.Fatal("unexpected path from ListEntities rpc") + } + } + +} diff --git a/code/go/0chain.net/blobbercore/handler/metadata.go b/code/go/0chain.net/blobbercore/handler/metadata.go new file mode 100644 index 000000000..c07a14ea6 --- /dev/null +++ b/code/go/0chain.net/blobbercore/handler/metadata.go @@ -0,0 +1,46 @@ +package handler + +import ( + "context" + "net/http" + + "github.com/gorilla/mux" + + "github.com/0chain/blobber/code/go/0chain.net/core/common" + "google.golang.org/grpc/metadata" +) + +type GRPCMetaData struct { + Client string + ClientKey string + ClientSignature string +} + +func GetGRPCMetaDataFromCtx(ctx context.Context) *GRPCMetaData { + metaData := &GRPCMetaData{} + + md, ok := metadata.FromIncomingContext(ctx) + if !ok { + return metaData + } + + getMetaData := func(key string) string { + list := md.Get(key) + if len(list) > 0 { + return list[0] + } + return "" + } + + metaData.Client = getMetaData(common.ClientHeader) + metaData.ClientKey = getMetaData(common.ClientKeyHeader) + metaData.ClientSignature = getMetaData(common.ClientSignatureHeader) + return metaData +} + +func httpRequestWithMetaData(r *http.Request, md *GRPCMetaData, alloc string) { + r.Header.Set(common.ClientHeader, md.Client) + r.Header.Set(common.ClientKeyHeader, md.ClientKey) + r.Header.Set(common.ClientSignatureHeader, md.ClientSignature) + *r = *mux.SetURLVars(r, map[string]string{"allocation": alloc}) +} diff --git a/code/go/0chain.net/blobbercore/handler/object_operation_grpc_handler.go b/code/go/0chain.net/blobbercore/handler/object_operation_grpc_handler.go new file mode 100644 index 000000000..69fe5afd5 --- /dev/null +++ b/code/go/0chain.net/blobbercore/handler/object_operation_grpc_handler.go @@ -0,0 +1,110 @@ +package handler + +import ( + "context" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/blobbergrpc" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/convert" + "net/http" +) + +func (b *blobberGRPCService) UpdateObjectAttributes(ctx context.Context, req *blobbergrpc.UpdateObjectAttributesRequest) (*blobbergrpc.UpdateObjectAttributesResponse, error) { + r, err := http.NewRequest("POST", "", nil) + if err != nil { + return nil, err + } + httpRequestWithMetaData(r, GetGRPCMetaDataFromCtx(ctx), req.Allocation) + r.Form = map[string][]string{ + "path": {req.Path}, + "path_hash": {req.PathHash}, + "connection_id": {req.ConnectionId}, + "attributes": {req.Attributes}, + } + + resp, err := UpdateAttributesHandler(ctx, r) + if err != nil { + return nil, err + } + + return convert.UpdateObjectAttributesResponseCreator(resp), nil +} + +func (b *blobberGRPCService) CopyObject(ctx context.Context, req *blobbergrpc.CopyObjectRequest) (*blobbergrpc.CopyObjectResponse, error) { + r, err := http.NewRequest("POST", "", nil) + if err != nil { + return nil, err + } + httpRequestWithMetaData(r, GetGRPCMetaDataFromCtx(ctx), req.Allocation) + r.Form = map[string][]string{ + "path": {req.Path}, + "path_hash": {req.PathHash}, + "connection_id": {req.ConnectionId}, + "dest": {req.Dest}, + } + + resp, err := CopyHandler(ctx, r) + if err != nil { + return nil, err + } + + return convert.CopyObjectResponseCreator(resp), nil +} + +func (b *blobberGRPCService) RenameObject(ctx context.Context, req *blobbergrpc.RenameObjectRequest) (*blobbergrpc.RenameObjectResponse, error) { + r, err := http.NewRequest("POST", "", nil) + if err != nil { + return nil, err + } + httpRequestWithMetaData(r, GetGRPCMetaDataFromCtx(ctx), req.Allocation) + r.Form = map[string][]string{ + "path": {req.Path}, + "path_hash": {req.PathHash}, + "connection_id": {req.ConnectionId}, + "new_name": {req.NewName}, + } + + resp, err := RenameHandler(ctx, r) + if err != nil { + return nil, err + } + + return convert.RenameObjectResponseCreator(resp), nil +} + +func (b *blobberGRPCService) DownloadFile(ctx context.Context, req *blobbergrpc.DownloadFileRequest) (*blobbergrpc.DownloadFileResponse, error) { + r, err := convert.DownloadFileGRPCToHTTP(req) + if err != nil { + return nil, err + } + + httpRequestWithMetaData(r, GetGRPCMetaDataFromCtx(ctx), req.Allocation) + + resp, err := DownloadHandler(ctx, r) + if err != nil { + return nil, err + } + + return convert.DownloadFileResponseCreator(resp), nil +} + +func (b *blobberGRPCService) UploadFile(ctx context.Context, req *blobbergrpc.UploadFileRequest) (*blobbergrpc.UploadFileResponse, error) { + + r, err := convert.WriteFileGRPCToHTTP(req) + if err != nil { + return nil, err + } + + httpRequestWithMetaData(r, GetGRPCMetaDataFromCtx(ctx), req.Allocation) + r.Form = map[string][]string{ + "path": {req.Path}, + "connection_id": {req.ConnectionId}, + "uploadMeta": {req.UploadMeta}, + "updateMeta": {req.UpdateMeta}, + } + + resp, err := UploadHandler(ctx, r) + if err != nil { + return nil, err + } + + return convert.UploadFileResponseCreator(resp), nil +} diff --git a/code/go/0chain.net/blobbercore/handler/object_operation_handler.go b/code/go/0chain.net/blobbercore/handler/object_operation_handler.go index 9936fb61d..3f3357d0b 100644 --- a/code/go/0chain.net/blobbercore/handler/object_operation_handler.go +++ b/code/go/0chain.net/blobbercore/handler/object_operation_handler.go @@ -6,29 +6,31 @@ import ( "encoding/json" "errors" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/blobberhttp" + "net/http" "path/filepath" "strconv" - "0chain.net/blobbercore/allocation" - "0chain.net/blobbercore/config" - "0chain.net/blobbercore/constants" - "0chain.net/blobbercore/datastore" - "0chain.net/blobbercore/filestore" - "0chain.net/blobbercore/readmarker" - "0chain.net/blobbercore/reference" - "0chain.net/blobbercore/stats" - "0chain.net/blobbercore/writemarker" - - "0chain.net/core/common" - "0chain.net/core/encryption" - "0chain.net/core/lock" - "0chain.net/core/node" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/allocation" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/config" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/constants" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/datastore" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/filestore" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/readmarker" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/reference" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/stats" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/writemarker" + + "github.com/0chain/blobber/code/go/0chain.net/core/common" + "github.com/0chain/blobber/code/go/0chain.net/core/encryption" + "github.com/0chain/blobber/code/go/0chain.net/core/lock" + "github.com/0chain/blobber/code/go/0chain.net/core/node" "gorm.io/datatypes" "gorm.io/gorm" - . "0chain.net/core/logging" + . "github.com/0chain/blobber/code/go/0chain.net/core/logging" "go.uber.org/zap" ) @@ -281,9 +283,9 @@ func (fsh *StorageHandler) DownloadFile(ctx context.Context, r *http.Request) ( // authorize file access var ( - isOwner = clientID == alloc.OwnerID - isRepairer = clientID == alloc.RepairerID - isCollaborator = reference.IsACollaborator(ctx, fileref.ID, clientID) + isOwner = clientID == alloc.OwnerID + isRepairer = clientID == alloc.RepairerID + isCollaborator = reference.IsACollaborator(ctx, fileref.ID, clientID) ) if !isOwner && !isRepairer && !isCollaborator { @@ -339,7 +341,7 @@ func (fsh *StorageHandler) DownloadFile(ctx context.Context, r *http.Request) ( if latestRM != nil && latestRM.ReadCounter+(numBlocks) != readMarker.ReadCounter { - var response = &DownloadResponse{ + var response = &blobberhttp.DownloadResponse{ Success: false, LatestRM: latestRM, Path: fileref.Path, @@ -393,7 +395,7 @@ func (fsh *StorageHandler) DownloadFile(ctx context.Context, r *http.Request) ( "couldn't save latest read marker: %v", err) } - var response = &DownloadResponse{} + var response = &blobberhttp.DownloadResponse{} response.Success = true response.LatestRM = readMarker response.Data = respData @@ -404,7 +406,7 @@ func (fsh *StorageHandler) DownloadFile(ctx context.Context, r *http.Request) ( return respData, nil } -func (fsh *StorageHandler) CommitWrite(ctx context.Context, r *http.Request) (*CommitResult, error) { +func (fsh *StorageHandler) CommitWrite(ctx context.Context, r *http.Request) (*blobberhttp.CommitResult, error) { if r.Method == "GET" { return nil, common.NewError("invalid_method", "Invalid method used for the upload URL. Use POST instead") @@ -487,7 +489,7 @@ func (fsh *StorageHandler) CommitWrite(ctx context.Context, r *http.Request) (*C err) } - var result CommitResult + var result blobberhttp.CommitResult var latestWM *writemarker.WriteMarkerEntity if len(allocationObj.AllocationRoot) == 0 { latestWM = nil @@ -599,7 +601,7 @@ func (fsh *StorageHandler) RenameObject(ctx context.Context, r *http.Request) (i clientID := ctx.Value(constants.CLIENT_CONTEXT_KEY).(string) _ = ctx.Value(constants.CLIENT_KEY_CONTEXT_KEY).(string) - valid, err := verifySignatureFromRequest(r, allocationObj.OwnerPublicKey) + valid, err := verifySignatureFromRequest(allocationTx, r.Header.Get(common.ClientSignatureHeader), allocationObj.OwnerPublicKey) if !valid || err != nil { return nil, common.NewError("invalid_signature", "Invalid signature") } @@ -658,7 +660,7 @@ func (fsh *StorageHandler) RenameObject(ctx context.Context, r *http.Request) (i return nil, common.NewError("connection_write_error", "Error writing the connection meta data") } - result := &UploadResult{} + result := &blobberhttp.UploadResult{} result.Filename = new_name result.Hash = objectRef.Hash result.MerkleRoot = objectRef.MerkleRoot @@ -687,7 +689,7 @@ func (fsh *StorageHandler) UpdateObjectAttributes(ctx context.Context, "Invalid allocation ID passed: %v", err) } - valid, err := verifySignatureFromRequest(r, alloc.OwnerPublicKey) + valid, err := verifySignatureFromRequest(allocTx, r.Header.Get(common.ClientSignatureHeader), alloc.OwnerPublicKey) if !valid || err != nil { return nil, common.NewError("invalid_signature", "Invalid signature") } @@ -787,7 +789,7 @@ func (fsh *StorageHandler) CopyObject(ctx context.Context, r *http.Request) (int return nil, common.NewError("invalid_parameters", "Invalid allocation id passed."+err.Error()) } - valid, err := verifySignatureFromRequest(r, allocationObj.OwnerPublicKey) + valid, err := verifySignatureFromRequest(allocationTx, r.Header.Get(common.ClientSignatureHeader), allocationObj.OwnerPublicKey) if !valid || err != nil { return nil, common.NewError("invalid_signature", "Invalid signature") } @@ -865,7 +867,7 @@ func (fsh *StorageHandler) CopyObject(ctx context.Context, r *http.Request) (int return nil, common.NewError("connection_write_error", "Error writing the connection meta data") } - result := &UploadResult{} + result := &blobberhttp.UploadResult{} result.Filename = objectRef.Name result.Hash = objectRef.Hash result.MerkleRoot = objectRef.MerkleRoot @@ -874,7 +876,7 @@ func (fsh *StorageHandler) CopyObject(ctx context.Context, r *http.Request) (int return result, nil } -func (fsh *StorageHandler) DeleteFile(ctx context.Context, r *http.Request, connectionObj *allocation.AllocationChangeCollector) (*UploadResult, error) { +func (fsh *StorageHandler) DeleteFile(ctx context.Context, r *http.Request, connectionObj *allocation.AllocationChangeCollector) (*blobberhttp.UploadResult, error) { path := r.FormValue("path") if len(path) == 0 { return nil, common.NewError("invalid_parameters", "Invalid path") @@ -896,7 +898,7 @@ func (fsh *StorageHandler) DeleteFile(ctx context.Context, r *http.Request, conn connectionObj.Size += allocationChange.Size connectionObj.AddChange(allocationChange, dfc) - result := &UploadResult{} + result := &blobberhttp.UploadResult{} result.Filename = fileRef.Name result.Hash = fileRef.Hash result.MerkleRoot = fileRef.MerkleRoot @@ -909,7 +911,7 @@ func (fsh *StorageHandler) DeleteFile(ctx context.Context, r *http.Request, conn } //WriteFile stores the file into the blobber files system from the HTTP request -func (fsh *StorageHandler) WriteFile(ctx context.Context, r *http.Request) (*UploadResult, error) { +func (fsh *StorageHandler) WriteFile(ctx context.Context, r *http.Request) (*blobberhttp.UploadResult, error) { if r.Method == "GET" { return nil, common.NewError("invalid_method", "Invalid method used for the upload URL. Use multi-part form POST / PUT / DELETE instead") @@ -923,7 +925,7 @@ func (fsh *StorageHandler) WriteFile(ctx context.Context, r *http.Request) (*Upl return nil, common.NewError("invalid_parameters", "Invalid allocation id passed."+err.Error()) } - valid, err := verifySignatureFromRequest(r, allocationObj.OwnerPublicKey) + valid, err := verifySignatureFromRequest(allocationTx, r.Header.Get(common.ClientSignatureHeader), allocationObj.OwnerPublicKey) if !valid || err != nil { return nil, common.NewError("invalid_signature", "Invalid signature") } @@ -957,7 +959,7 @@ func (fsh *StorageHandler) WriteFile(ctx context.Context, r *http.Request) (*Upl mutex.Lock() defer mutex.Unlock() - result := &UploadResult{} + result := &blobberhttp.UploadResult{} mode := allocation.INSERT_OPERATION if r.Method == "PUT" { mode = allocation.UPDATE_OPERATION diff --git a/code/go/0chain.net/blobbercore/handler/protocol.go b/code/go/0chain.net/blobbercore/handler/protocol.go index a490de673..b232ff92f 100644 --- a/code/go/0chain.net/blobbercore/handler/protocol.go +++ b/code/go/0chain.net/blobbercore/handler/protocol.go @@ -6,15 +6,16 @@ import ( "errors" "context" "encoding/json" - "go.uber.org/zap" + + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/config" + . "github.com/0chain/blobber/code/go/0chain.net/core/logging" + "github.com/0chain/blobber/code/go/0chain.net/core/node" + "github.com/0chain/blobber/code/go/0chain.net/core/transaction" + "github.com/0chain/blobber/code/go/0chain.net/core/util" + "github.com/0chain/blobber/code/go/0chain.net/core/chain" "github.com/0chain/gosdk/zcncore" - "0chain.net/blobbercore/config" - "0chain.net/core/chain" - "0chain.net/core/node" - "0chain.net/core/transaction" - "0chain.net/core/util" - . "0chain.net/core/logging" + "go.uber.org/zap" ) const ( diff --git a/code/go/0chain.net/blobbercore/handler/renameobject_integration_test.go b/code/go/0chain.net/blobbercore/handler/renameobject_integration_test.go new file mode 100644 index 000000000..bbbd2233e --- /dev/null +++ b/code/go/0chain.net/blobbercore/handler/renameobject_integration_test.go @@ -0,0 +1,93 @@ +package handler + +import ( + "context" + "encoding/hex" + "testing" + + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/blobbergrpc" + "github.com/0chain/blobber/code/go/0chain.net/core/common" + "github.com/0chain/blobber/code/go/0chain.net/core/encryption" + "google.golang.org/grpc/metadata" +) + +func TestBlobberGRPCService_RenameObject(t *testing.T) { + bClient, tdController := setupHandlerIntegrationTests(t) + allocationTx := randString(32) + + pubKey, _, signScheme := GeneratePubPrivateKey(t) + clientSignature, _ := signScheme.Sign(encryption.Hash(allocationTx)) + pubKeyBytes, _ := hex.DecodeString(pubKey) + clientId := encryption.Hash(pubKeyBytes) + + if err := tdController.ClearDatabase(); err != nil { + t.Fatal(err) + } + if err := tdController.AddRenameTestData(allocationTx, pubKey, clientId); err != nil { + t.Fatal(err) + } + + testCases := []struct { + name string + context metadata.MD + input *blobbergrpc.RenameObjectRequest + expectedMessage string + expectingError bool + }{ + { + name: "Success", + context: metadata.New(map[string]string{ + common.ClientHeader: clientId, + common.ClientSignatureHeader: clientSignature, + common.ClientKeyHeader: pubKey, + }), + input: &blobbergrpc.RenameObjectRequest{ + Allocation: allocationTx, + Path: "/some_file", + PathHash: "exampleId:examplePath", + ConnectionId: "connection_id", + NewName: "some_new_file", + }, + expectedMessage: "some_new_file", + expectingError: false, + }, + { + name: "Fail", + context: metadata.New(map[string]string{ + common.ClientHeader: clientId, + common.ClientSignatureHeader: clientSignature, + common.ClientKeyHeader: pubKey, + }), + input: &blobbergrpc.RenameObjectRequest{ + Allocation: "", + Path: "", + PathHash: "", + ConnectionId: "", + NewName: "", + }, + expectedMessage: "", + expectingError: true, + }, + } + + for _, tc := range testCases { + ctx := context.Background() + ctx = metadata.NewOutgoingContext(ctx, tc.context) + response, err := bClient.RenameObject(ctx, tc.input) + if err != nil { + if !tc.expectingError { + t.Fatal(err) + } + + continue + } + + if tc.expectingError { + t.Fatal("expected error") + } + + if response.GetFilename() != tc.expectedMessage { + t.Fatal("failed!") + } + } +} diff --git a/code/go/0chain.net/blobbercore/handler/storage_handler.go b/code/go/0chain.net/blobbercore/handler/storage_handler.go index 406b71b14..002f3ad3c 100644 --- a/code/go/0chain.net/blobbercore/handler/storage_handler.go +++ b/code/go/0chain.net/blobbercore/handler/storage_handler.go @@ -7,20 +7,18 @@ import ( "strconv" "strings" - "0chain.net/core/encryption" - "github.com/gorilla/mux" - - "0chain.net/blobbercore/stats" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/blobberhttp" + + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/allocation" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/constants" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/readmarker" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/reference" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/stats" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/writemarker" + "github.com/0chain/blobber/code/go/0chain.net/core/common" + "github.com/0chain/blobber/code/go/0chain.net/core/encryption" + . "github.com/0chain/blobber/code/go/0chain.net/core/logging" "go.uber.org/zap" - - "0chain.net/blobbercore/allocation" - "0chain.net/blobbercore/constants" - "0chain.net/blobbercore/readmarker" - "0chain.net/blobbercore/reference" - "0chain.net/blobbercore/writemarker" - "0chain.net/core/common" - - . "0chain.net/core/logging" ) const ( @@ -170,9 +168,9 @@ func (fsh *StorageHandler) GetFileMeta(ctx context.Context, r *http.Request) (in // authorize file access var ( - isOwner = clientID == alloc.OwnerID - isRepairer = clientID == alloc.RepairerID - isCollaborator = reference.IsACollaborator(ctx, fileref.ID, clientID) + isOwner = clientID == alloc.OwnerID + isRepairer = clientID == alloc.RepairerID + isCollaborator = reference.IsACollaborator(ctx, fileref.ID, clientID) ) if !isOwner && !isRepairer && !isCollaborator { @@ -263,7 +261,8 @@ func (fsh *StorageHandler) AddCollaborator(ctx context.Context, r *http.Request) return nil, common.NewError("invalid_parameters", "Invalid allocation id passed."+err.Error()) } - valid, err := verifySignatureFromRequest(r, allocationObj.OwnerPublicKey) + clientSign, _ := ctx.Value(constants.CLIENT_SIGNATURE_HEADER_KEY).(string) + valid, err := verifySignatureFromRequest(allocationTx, clientSign, allocationObj.OwnerPublicKey) if !valid || err != nil { return nil, common.NewError("invalid_signature", "Invalid signature") } @@ -349,7 +348,8 @@ func (fsh *StorageHandler) GetFileStats(ctx context.Context, r *http.Request) (i } allocationID := allocationObj.ID - valid, err := verifySignatureFromRequest(r, allocationObj.OwnerPublicKey) + clientSign, _ := ctx.Value(constants.CLIENT_SIGNATURE_HEADER_KEY).(string) + valid, err := verifySignatureFromRequest(allocationTx, clientSign, allocationObj.OwnerPublicKey) if !valid || err != nil { return nil, common.NewError("invalid_signature", "Invalid signature") } @@ -393,7 +393,7 @@ func (fsh *StorageHandler) GetFileStats(ctx context.Context, r *http.Request) (i return result, nil } -func (fsh *StorageHandler) ListEntities(ctx context.Context, r *http.Request) (*ListResult, error) { +func (fsh *StorageHandler) ListEntities(ctx context.Context, r *http.Request) (*blobberhttp.ListResult, error) { if r.Method == "POST" { return nil, common.NewError("invalid_method", "Invalid method used. Use GET instead") @@ -438,7 +438,7 @@ func (fsh *StorageHandler) ListEntities(ctx context.Context, r *http.Request) (* return nil, common.NewError("invalid_parameters", "Invalid path. "+err.Error()) } - var result ListResult + var result blobberhttp.ListResult result.AllocationRoot = allocationObj.AllocationRoot result.Meta = dirref.GetListingData(ctx) if clientID != allocationObj.OwnerID { @@ -455,8 +455,8 @@ func (fsh *StorageHandler) ListEntities(ctx context.Context, r *http.Request) (* return &result, nil } -func (fsh *StorageHandler) GetReferencePath(ctx context.Context, r *http.Request) (*ReferencePathResult, error) { - resCh := make(chan *ReferencePathResult) +func (fsh *StorageHandler) GetReferencePath(ctx context.Context, r *http.Request) (*blobberhttp.ReferencePathResult, error) { + resCh := make(chan *blobberhttp.ReferencePathResult) errCh := make(chan error) go fsh.getReferencePath(ctx, r, resCh, errCh) @@ -472,7 +472,7 @@ func (fsh *StorageHandler) GetReferencePath(ctx context.Context, r *http.Request } } -func (fsh *StorageHandler) getReferencePath(ctx context.Context, r *http.Request, resCh chan<- *ReferencePathResult, errCh chan<- error) { +func (fsh *StorageHandler) getReferencePath(ctx context.Context, r *http.Request, resCh chan<- *blobberhttp.ReferencePathResult, errCh chan<- error) { if r.Method == "POST" { errCh <- common.NewError("invalid_method", "Invalid method used. Use GET instead") return @@ -486,7 +486,8 @@ func (fsh *StorageHandler) getReferencePath(ctx context.Context, r *http.Request } allocationID := allocationObj.ID - valid, err := verifySignatureFromRequest(r, allocationObj.OwnerPublicKey) + clientSign, _ := ctx.Value(constants.CLIENT_SIGNATURE_HEADER_KEY).(string) + valid, err := verifySignatureFromRequest(allocationTx, clientSign, allocationObj.OwnerPublicKey) if !valid || err != nil { errCh <- common.NewError("invalid_signature", "Invalid signature") return @@ -510,17 +511,17 @@ func (fsh *StorageHandler) getReferencePath(ctx context.Context, r *http.Request return } - refPath := &ReferencePath{ref: rootRef} - refsToProcess := make([]*ReferencePath, 0) + refPath := &reference.ReferencePath{Ref: rootRef} + refsToProcess := make([]*reference.ReferencePath, 0) refsToProcess = append(refsToProcess, refPath) for len(refsToProcess) > 0 { refToProcess := refsToProcess[0] - refToProcess.Meta = refToProcess.ref.GetListingData(ctx) - if len(refToProcess.ref.Children) > 0 { - refToProcess.List = make([]*ReferencePath, len(refToProcess.ref.Children)) + refToProcess.Meta = refToProcess.Ref.GetListingData(ctx) + if len(refToProcess.Ref.Children) > 0 { + refToProcess.List = make([]*reference.ReferencePath, len(refToProcess.Ref.Children)) } - for idx, child := range refToProcess.ref.Children { - childRefPath := &ReferencePath{ref: child} + for idx, child := range refToProcess.Ref.Children { + childRefPath := &reference.ReferencePath{Ref: child} refToProcess.List[idx] = childRefPath refsToProcess = append(refsToProcess, childRefPath) } @@ -537,7 +538,7 @@ func (fsh *StorageHandler) getReferencePath(ctx context.Context, r *http.Request return } } - var refPathResult ReferencePathResult + var refPathResult blobberhttp.ReferencePathResult refPathResult.ReferencePath = refPath if latestWM != nil { refPathResult.LatestWM = &latestWM.WM @@ -546,7 +547,7 @@ func (fsh *StorageHandler) getReferencePath(ctx context.Context, r *http.Request resCh <- &refPathResult } -func (fsh *StorageHandler) GetObjectPath(ctx context.Context, r *http.Request) (*ObjectPathResult, error) { +func (fsh *StorageHandler) GetObjectPath(ctx context.Context, r *http.Request) (*blobberhttp.ObjectPathResult, error) { if r.Method == "POST" { return nil, common.NewError("invalid_method", "Invalid method used. Use GET instead") } @@ -557,7 +558,8 @@ func (fsh *StorageHandler) GetObjectPath(ctx context.Context, r *http.Request) ( } allocationID := allocationObj.ID - valid, err := verifySignatureFromRequest(r, allocationObj.OwnerPublicKey) + clientSign, _ := ctx.Value(constants.CLIENT_SIGNATURE_HEADER_KEY).(string) + valid, err := verifySignatureFromRequest(allocationTx, clientSign, allocationObj.OwnerPublicKey) if !valid || err != nil { return nil, common.NewError("invalid_signature", "Invalid signature") } @@ -595,7 +597,7 @@ func (fsh *StorageHandler) GetObjectPath(ctx context.Context, r *http.Request) ( return nil, common.NewError("latest_write_marker_read_error", "Error reading the latest write marker for allocation."+err.Error()) } } - var objPathResult ObjectPathResult + var objPathResult blobberhttp.ObjectPathResult objPathResult.ObjectPath = objectPath if latestWM != nil { objPathResult.LatestWM = &latestWM.WM @@ -603,7 +605,7 @@ func (fsh *StorageHandler) GetObjectPath(ctx context.Context, r *http.Request) ( return &objPathResult, nil } -func (fsh *StorageHandler) GetObjectTree(ctx context.Context, r *http.Request) (*ReferencePathResult, error) { +func (fsh *StorageHandler) GetObjectTree(ctx context.Context, r *http.Request) (*blobberhttp.ReferencePathResult, error) { if r.Method == "POST" { return nil, common.NewError("invalid_method", "Invalid method used. Use GET instead") } @@ -615,7 +617,8 @@ func (fsh *StorageHandler) GetObjectTree(ctx context.Context, r *http.Request) ( } allocationID := allocationObj.ID - valid, err := verifySignatureFromRequest(r, allocationObj.OwnerPublicKey) + clientSign, _ := ctx.Value(constants.CLIENT_SIGNATURE_HEADER_KEY).(string) + valid, err := verifySignatureFromRequest(allocationTx, clientSign, allocationObj.OwnerPublicKey) if !valid || err != nil { return nil, common.NewError("invalid_signature", "Invalid signature") } @@ -634,17 +637,17 @@ func (fsh *StorageHandler) GetObjectTree(ctx context.Context, r *http.Request) ( return nil, err } - refPath := &ReferencePath{ref: rootRef} - refsToProcess := make([]*ReferencePath, 0) + refPath := &reference.ReferencePath{Ref: rootRef} + refsToProcess := make([]*reference.ReferencePath, 0) refsToProcess = append(refsToProcess, refPath) for len(refsToProcess) > 0 { refToProcess := refsToProcess[0] - refToProcess.Meta = refToProcess.ref.GetListingData(ctx) - if len(refToProcess.ref.Children) > 0 { - refToProcess.List = make([]*ReferencePath, len(refToProcess.ref.Children)) + refToProcess.Meta = refToProcess.Ref.GetListingData(ctx) + if len(refToProcess.Ref.Children) > 0 { + refToProcess.List = make([]*reference.ReferencePath, len(refToProcess.Ref.Children)) } - for idx, child := range refToProcess.ref.Children { - childRefPath := &ReferencePath{ref: child} + for idx, child := range refToProcess.Ref.Children { + childRefPath := &reference.ReferencePath{Ref: child} refToProcess.List[idx] = childRefPath refsToProcess = append(refsToProcess, childRefPath) } @@ -660,7 +663,7 @@ func (fsh *StorageHandler) GetObjectTree(ctx context.Context, r *http.Request) ( return nil, common.NewError("latest_write_marker_read_error", "Error reading the latest write marker for allocation."+err.Error()) } } - var refPathResult ReferencePathResult + var refPathResult blobberhttp.ReferencePathResult refPathResult.ReferencePath = refPath if latestWM != nil { refPathResult.LatestWM = &latestWM.WM @@ -704,21 +707,15 @@ func (fsh *StorageHandler) CalculateHash(ctx context.Context, r *http.Request) ( return result, nil } -// verifySignatureFromRequest verifyes signature passed as common.ClientSignatureHeader header. -func verifySignatureFromRequest(r *http.Request, pbK string) (bool, error) { - sign := encryption.MiraclToHerumiSig(r.Header.Get(common.ClientSignatureHeader)) +// verifySignatureFromRequest verifies signature passed as common.ClientSignatureHeader header. +func verifySignatureFromRequest(allocation, sign, pbK string) (bool, error) { + sign = encryption.MiraclToHerumiSig(sign) + if len(sign) < 64 { return false, nil } - vars := mux.Vars(r) - data, ok := vars["allocation"] - if !ok { - return false, common.NewError("invalid_params", "Missing allocation tx") - } - - hash := encryption.Hash(data) - pbK = encryption.MiraclToHerumiPK(pbK) + hash := encryption.Hash(allocation) return encryption.Verify(pbK, sign, hash) } diff --git a/code/go/0chain.net/blobbercore/handler/updateattributes_integration_test.go b/code/go/0chain.net/blobbercore/handler/updateattributes_integration_test.go new file mode 100644 index 000000000..be10a3c74 --- /dev/null +++ b/code/go/0chain.net/blobbercore/handler/updateattributes_integration_test.go @@ -0,0 +1,101 @@ +package handler + +import ( + "context" + "encoding/hex" + "encoding/json" + "testing" + + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/blobbergrpc" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/reference" + "github.com/0chain/blobber/code/go/0chain.net/core/common" + "github.com/0chain/blobber/code/go/0chain.net/core/encryption" + "google.golang.org/grpc/metadata" +) + +func TestBlobberGRPCService_UpdateObjectAttributes(t *testing.T) { + bClient, tdController := setupHandlerIntegrationTests(t) + allocationTx := randString(32) + + pubKey, _, signScheme := GeneratePubPrivateKey(t) + clientSignature, _ := signScheme.Sign(encryption.Hash(allocationTx)) + pubKeyBytes, _ := hex.DecodeString(pubKey) + clientId := encryption.Hash(pubKeyBytes) + + if err := tdController.ClearDatabase(); err != nil { + t.Fatal(err) + } + if err := tdController.AddAttributesTestData(allocationTx, pubKey, clientId); err != nil { + t.Fatal(err) + } + + attr := &reference.Attributes{WhoPaysForReads: common.WhoPays3rdParty} + attrBytes, err := json.Marshal(attr) + if err != nil { + t.Fatal(err) + } + + testCases := []struct { + name string + context metadata.MD + input *blobbergrpc.UpdateObjectAttributesRequest + expectedMessage int + expectingError bool + }{ + { + name: "Success", + context: metadata.New(map[string]string{ + common.ClientHeader: clientId, + common.ClientSignatureHeader: clientSignature, + common.ClientKeyHeader: pubKey, + }), + input: &blobbergrpc.UpdateObjectAttributesRequest{ + Allocation: allocationTx, + Path: "/some_file", + PathHash: "exampleId:examplePath", + ConnectionId: "connection_id", + Attributes: string(attrBytes), + }, + expectedMessage: int(attr.WhoPaysForReads), + expectingError: false, + }, + { + name: "Fail", + context: metadata.New(map[string]string{ + common.ClientHeader: clientId, + common.ClientSignatureHeader: clientSignature, + common.ClientKeyHeader: pubKey, + }), + input: &blobbergrpc.UpdateObjectAttributesRequest{ + Allocation: "", + Path: "", + PathHash: "", + ConnectionId: "", + Attributes: "", + }, + expectedMessage: 0, + expectingError: true, + }, + } + + for _, tc := range testCases { + ctx := context.Background() + ctx = metadata.NewOutgoingContext(ctx, tc.context) + response, err := bClient.UpdateObjectAttributes(ctx, tc.input) + if err != nil { + if !tc.expectingError { + t.Fatal(err) + } + + continue + } + + if tc.expectingError { + t.Fatal("expected error") + } + + if response.GetWhoPaysForReads() != int64(tc.expectedMessage) { + t.Fatal("failed!") + } + } +} diff --git a/code/go/0chain.net/blobbercore/handler/upload_integration_test.go b/code/go/0chain.net/blobbercore/handler/upload_integration_test.go new file mode 100644 index 000000000..479a8ceac --- /dev/null +++ b/code/go/0chain.net/blobbercore/handler/upload_integration_test.go @@ -0,0 +1,123 @@ +package handler + +import ( + "context" + "encoding/hex" + "encoding/json" + "io" + "os" + "testing" + + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/allocation" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/blobbergrpc" + "github.com/0chain/blobber/code/go/0chain.net/core/common" + "github.com/0chain/blobber/code/go/0chain.net/core/encryption" + "google.golang.org/grpc/metadata" +) + +func TestBlobberGRPCService_UploadFile(t *testing.T) { + bClient, tdController := setupHandlerIntegrationTests(t) + allocationTx := randString(32) + + pubKey, _, signScheme := GeneratePubPrivateKey(t) + clientSignature, _ := signScheme.Sign(encryption.Hash(allocationTx)) + pubKeyBytes, _ := hex.DecodeString(pubKey) + clientId := encryption.Hash(pubKeyBytes) + + formFieldByt, err := json.Marshal(&allocation.UpdateFileChange{NewFileChange: allocation.NewFileChange{Filename: `helper_integration_test.go`}}) + if err != nil { + t.Fatal(err) + } + + if err := tdController.ClearDatabase(); err != nil { + t.Fatal(err) + } + if err := tdController.AddUploadTestData(allocationTx, pubKey, clientId); err != nil { + t.Fatal(err) + } + + root, _ := os.Getwd() + file, err := os.Open(root + "/helper_integration_test.go") + if err != nil { + t.Fatal(err) + } + stats, err := file.Stat() + if err != nil { + panic(err) + } + fileB := make([]byte, stats.Size()) + if _, err := io.ReadFull(file, fileB); err != nil { + t.Fatal(err) + } + + testCases := []struct { + name string + context metadata.MD + input *blobbergrpc.UploadFileRequest + expectedFileName string + expectingError bool + }{ + { + name: "Success", + context: metadata.New(map[string]string{ + common.ClientHeader: clientId, + common.ClientSignatureHeader: clientSignature, + common.ClientKeyHeader: pubKey, + }), + + input: &blobbergrpc.UploadFileRequest{ + Allocation: allocationTx, + Path: "/some_file", + ConnectionId: "connection_id", + Method: "POST", + UploadMeta: string(formFieldByt), + UpdateMeta: "", + UploadFile: fileB, + UploadThumbnailFile: []byte{}, + }, + expectedFileName: "helper_integration_test.go", + expectingError: false, + }, + { + name: "Fail", + context: metadata.New(map[string]string{ + common.ClientHeader: clientId, + common.ClientSignatureHeader: clientSignature, + common.ClientKeyHeader: pubKey, + }), + input: &blobbergrpc.UploadFileRequest{ + Allocation: "", + Path: "", + ConnectionId: "", + Method: "", + UploadMeta: "", + UpdateMeta: "", + UploadFile: nil, + UploadThumbnailFile: nil, + }, + expectedFileName: "", + expectingError: true, + }, + } + + for _, tc := range testCases { + ctx := context.Background() + ctx = metadata.NewOutgoingContext(ctx, tc.context) + response, err := bClient.UploadFile(ctx, tc.input) + if err != nil { + if !tc.expectingError { + t.Fatal(err) + } + + continue + } + + if tc.expectingError { + t.Fatal("expected error") + } + + if response.GetFilename() != tc.expectedFileName { + t.Fatal("failed!") + } + } +} diff --git a/code/go/0chain.net/blobbercore/handler/worker.go b/code/go/0chain.net/blobbercore/handler/worker.go index 0716501a0..4a086c402 100644 --- a/code/go/0chain.net/blobbercore/handler/worker.go +++ b/code/go/0chain.net/blobbercore/handler/worker.go @@ -6,16 +6,16 @@ import ( "path/filepath" "time" - "0chain.net/blobbercore/filestore" - "0chain.net/blobbercore/reference" - "0chain.net/blobbercore/stats" - "0chain.net/core/lock" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/filestore" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/reference" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/stats" + "github.com/0chain/blobber/code/go/0chain.net/core/lock" - "0chain.net/blobbercore/allocation" - "0chain.net/blobbercore/config" - "0chain.net/blobbercore/datastore" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/allocation" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/config" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/datastore" - . "0chain.net/core/logging" + . "github.com/0chain/blobber/code/go/0chain.net/core/logging" "go.uber.org/zap" ) diff --git a/code/go/0chain.net/blobbercore/handler/zcncore.go b/code/go/0chain.net/blobbercore/handler/zcncore.go index 175889f82..e7f12c061 100644 --- a/code/go/0chain.net/blobbercore/handler/zcncore.go +++ b/code/go/0chain.net/blobbercore/handler/zcncore.go @@ -1,8 +1,8 @@ package handler import ( - "sync" "encoding/json" + "sync" "github.com/0chain/gosdk/core/common" "github.com/0chain/gosdk/zcncore" @@ -12,7 +12,7 @@ type ZCNStatus struct { wg *sync.WaitGroup success bool balance int64 - info string + info string } func (zcn *ZCNStatus) OnBalanceAvailable(status int, value int64, info string) { @@ -61,7 +61,7 @@ func CheckBalance() (float64, error) { wg.Add(1) err := zcncore.GetBalance(statusBar) if err != nil { - return 0, common.NewError("check_balance_failed", "Call to GetBalance failed with err: " + err.Error()) + return 0, common.NewError("check_balance_failed", "Call to GetBalance failed with err: "+err.Error()) } wg.Wait() if !statusBar.success { @@ -81,7 +81,7 @@ func GetBlobbers() ([]*zcncore.Blobber, error) { err := zcncore.GetBlobbers(statusBar) if err != nil { - return info.Nodes, common.NewError("get_blobbers_failed", "Call to GetBlobbers failed with err: " + err.Error()) + return info.Nodes, common.NewError("get_blobbers_failed", "Call to GetBlobbers failed with err: "+err.Error()) } wg.Wait() @@ -90,7 +90,7 @@ func GetBlobbers() ([]*zcncore.Blobber, error) { } if err = json.Unmarshal([]byte(statusBar.info), &info); err != nil { - return info.Nodes, common.NewError("get_blobbers_failed", "Decoding response to GetBlobbers failed with err: " + err.Error()) + return info.Nodes, common.NewError("get_blobbers_failed", "Decoding response to GetBlobbers failed with err: "+err.Error()) } return info.Nodes, nil diff --git a/code/go/0chain.net/blobbercore/mocks/PackageHandler.go b/code/go/0chain.net/blobbercore/mocks/PackageHandler.go deleted file mode 100644 index 1d6dba917..000000000 --- a/code/go/0chain.net/blobbercore/mocks/PackageHandler.go +++ /dev/null @@ -1,243 +0,0 @@ -// Code generated by mockery v0.0.0-dev. DO NOT EDIT. - -package mocks - -import ( - context "context" - - blobbergrpc "0chain.net/blobbercore/blobbergrpc" - - mock "github.com/stretchr/testify/mock" - - reference "0chain.net/blobbercore/reference" - - stats "0chain.net/blobbercore/stats" - - writemarker "0chain.net/blobbercore/writemarker" -) - -// PackageHandler is an autogenerated mock type for the PackageHandler type -type PackageHandler struct { - mock.Mock -} - -// GetCollaborators provides a mock function with given fields: ctx, refID -func (_m *PackageHandler) GetCollaborators(ctx context.Context, refID int64) ([]reference.Collaborator, error) { - ret := _m.Called(ctx, refID) - - var r0 []reference.Collaborator - if rf, ok := ret.Get(0).(func(context.Context, int64) []reference.Collaborator); ok { - r0 = rf(ctx, refID) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).([]reference.Collaborator) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, int64) error); ok { - r1 = rf(ctx, refID) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// GetCommitMetaTxns provides a mock function with given fields: ctx, refID -func (_m *PackageHandler) GetCommitMetaTxns(ctx context.Context, refID int64) ([]reference.CommitMetaTxn, error) { - ret := _m.Called(ctx, refID) - - var r0 []reference.CommitMetaTxn - if rf, ok := ret.Get(0).(func(context.Context, int64) []reference.CommitMetaTxn); ok { - r0 = rf(ctx, refID) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).([]reference.CommitMetaTxn) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, int64) error); ok { - r1 = rf(ctx, refID) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// GetFileStats provides a mock function with given fields: ctx, refID -func (_m *PackageHandler) GetFileStats(ctx context.Context, refID int64) (*stats.FileStats, error) { - ret := _m.Called(ctx, refID) - - var r0 *stats.FileStats - if rf, ok := ret.Get(0).(func(context.Context, int64) *stats.FileStats); ok { - r0 = rf(ctx, refID) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*stats.FileStats) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, int64) error); ok { - r1 = rf(ctx, refID) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// GetObjectPathGRPC provides a mock function with given fields: ctx, allocationID, blockNum -func (_m *PackageHandler) GetObjectPathGRPC(ctx context.Context, allocationID string, blockNum int64) (*blobbergrpc.ObjectPath, error) { - ret := _m.Called(ctx, allocationID, blockNum) - - var r0 *blobbergrpc.ObjectPath - if rf, ok := ret.Get(0).(func(context.Context, string, int64) *blobbergrpc.ObjectPath); ok { - r0 = rf(ctx, allocationID, blockNum) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*blobbergrpc.ObjectPath) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, string, int64) error); ok { - r1 = rf(ctx, allocationID, blockNum) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// GetObjectTree provides a mock function with given fields: ctx, allocationID, path -func (_m *PackageHandler) GetObjectTree(ctx context.Context, allocationID string, path string) (*reference.Ref, error) { - ret := _m.Called(ctx, allocationID, path) - - var r0 *reference.Ref - if rf, ok := ret.Get(0).(func(context.Context, string, string) *reference.Ref); ok { - r0 = rf(ctx, allocationID, path) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*reference.Ref) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, string, string) error); ok { - r1 = rf(ctx, allocationID, path) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// GetRefWithChildren provides a mock function with given fields: ctx, allocationID, path -func (_m *PackageHandler) GetRefWithChildren(ctx context.Context, allocationID string, path string) (*reference.Ref, error) { - ret := _m.Called(ctx, allocationID, path) - - var r0 *reference.Ref - if rf, ok := ret.Get(0).(func(context.Context, string, string) *reference.Ref); ok { - r0 = rf(ctx, allocationID, path) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*reference.Ref) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, string, string) error); ok { - r1 = rf(ctx, allocationID, path) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// GetReferenceFromLookupHash provides a mock function with given fields: ctx, allocationID, path_hash -func (_m *PackageHandler) GetReferenceFromLookupHash(ctx context.Context, allocationID string, path_hash string) (*reference.Ref, error) { - ret := _m.Called(ctx, allocationID, path_hash) - - var r0 *reference.Ref - if rf, ok := ret.Get(0).(func(context.Context, string, string) *reference.Ref); ok { - r0 = rf(ctx, allocationID, path_hash) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*reference.Ref) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, string, string) error); ok { - r1 = rf(ctx, allocationID, path_hash) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// GetReferencePathFromPaths provides a mock function with given fields: ctx, allocationID, paths -func (_m *PackageHandler) GetReferencePathFromPaths(ctx context.Context, allocationID string, paths []string) (*reference.Ref, error) { - ret := _m.Called(ctx, allocationID, paths) - - var r0 *reference.Ref - if rf, ok := ret.Get(0).(func(context.Context, string, []string) *reference.Ref); ok { - r0 = rf(ctx, allocationID, paths) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*reference.Ref) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, string, []string) error); ok { - r1 = rf(ctx, allocationID, paths) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// GetWriteMarkerEntity provides a mock function with given fields: ctx, allocation_root -func (_m *PackageHandler) GetWriteMarkerEntity(ctx context.Context, allocation_root string) (*writemarker.WriteMarkerEntity, error) { - ret := _m.Called(ctx, allocation_root) - - var r0 *writemarker.WriteMarkerEntity - if rf, ok := ret.Get(0).(func(context.Context, string) *writemarker.WriteMarkerEntity); ok { - r0 = rf(ctx, allocation_root) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*writemarker.WriteMarkerEntity) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, string) error); ok { - r1 = rf(ctx, allocation_root) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// IsACollaborator provides a mock function with given fields: ctx, refID, clientID -func (_m *PackageHandler) IsACollaborator(ctx context.Context, refID int64, clientID string) bool { - ret := _m.Called(ctx, refID, clientID) - - var r0 bool - if rf, ok := ret.Get(0).(func(context.Context, int64, string) bool); ok { - r0 = rf(ctx, refID, clientID) - } else { - r0 = ret.Get(0).(bool) - } - - return r0 -} diff --git a/code/go/0chain.net/blobbercore/openapi/blobber.swagger.json b/code/go/0chain.net/blobbercore/openapi/blobber.swagger.json index 05beb9483..782dac581 100644 --- a/code/go/0chain.net/blobbercore/openapi/blobber.swagger.json +++ b/code/go/0chain.net/blobbercore/openapi/blobber.swagger.json @@ -34,24 +34,6 @@ } }, "parameters": [ - { - "name": "context.client", - "in": "query", - "required": false, - "type": "string" - }, - { - "name": "context.clientKey", - "in": "query", - "required": false, - "type": "string" - }, - { - "name": "context.allocation", - "in": "query", - "required": false, - "type": "string" - }, { "name": "id", "in": "query", @@ -64,14 +46,14 @@ ] } }, - "/v2/file/list/{allocation}": { - "get": { - "operationId": "Blobber_ListEntities", + "/v2/connection/commit/{allocation}": { + "post": { + "operationId": "Blobber_Commit", "responses": { "200": { "description": "A successful response.", "schema": { - "$ref": "#/definitions/v1ListEntitiesResponse" + "$ref": "#/definitions/v1CommitResponse" } }, "default": { @@ -89,40 +71,12 @@ "type": "string" }, { - "name": "context.client", - "in": "query", - "required": false, - "type": "string" - }, - { - "name": "context.clientKey", - "in": "query", - "required": false, - "type": "string" - }, - { - "name": "context.allocation", - "in": "query", - "required": false, - "type": "string" - }, - { - "name": "path", - "in": "query", - "required": false, - "type": "string" - }, - { - "name": "pathHash", - "in": "query", - "required": false, - "type": "string" - }, - { - "name": "authToken", - "in": "query", - "required": false, - "type": "string" + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/v1CommitRequest" + } } ], "tags": [ @@ -130,14 +84,14 @@ ] } }, - "/v2/file/meta/{allocation}": { - "get": { - "operationId": "Blobber_GetFileMetaData", + "/v2/file/attributes/{allocation}": { + "post": { + "operationId": "Blobber_UpdateObjectAttributes", "responses": { "200": { "description": "A successful response.", "schema": { - "$ref": "#/definitions/v1GetFileMetaDataResponse" + "$ref": "#/definitions/v1UpdateObjectAttributesResponse" } }, "default": { @@ -155,40 +109,12 @@ "type": "string" }, { - "name": "context.client", - "in": "query", - "required": false, - "type": "string" - }, - { - "name": "context.clientKey", - "in": "query", - "required": false, - "type": "string" - }, - { - "name": "context.allocation", - "in": "query", - "required": false, - "type": "string" - }, - { - "name": "path", - "in": "query", - "required": false, - "type": "string" - }, - { - "name": "pathHash", - "in": "query", - "required": false, - "type": "string" - }, - { - "name": "authToken", - "in": "query", - "required": false, - "type": "string" + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/v1UpdateObjectAttributesRequest" + } } ], "tags": [ @@ -196,14 +122,14 @@ ] } }, - "/v2/file/objectpath/{allocation}": { - "get": { - "operationId": "Blobber_GetObjectPath", + "/v2/file/calculatehash/{allocation}": { + "post": { + "operationId": "Blobber_CalculateHash", "responses": { "200": { "description": "A successful response.", "schema": { - "$ref": "#/definitions/v1GetObjectPathResponse" + "$ref": "#/definitions/v1CalculateHashResponse" } }, "default": { @@ -221,34 +147,12 @@ "type": "string" }, { - "name": "context.client", - "in": "query", - "required": false, - "type": "string" - }, - { - "name": "context.clientKey", - "in": "query", - "required": false, - "type": "string" - }, - { - "name": "context.allocation", - "in": "query", - "required": false, - "type": "string" - }, - { - "name": "Path", - "in": "query", - "required": false, - "type": "string" - }, - { - "name": "BlockNum", - "in": "query", - "required": false, - "type": "string" + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/v1CalculateHashRequest" + } } ], "tags": [ @@ -256,14 +160,14 @@ ] } }, - "/v2/file/objecttree/{allocation}": { - "get": { - "operationId": "Blobber_GetObjectTree", + "/v2/file/collaborator/{allocation}": { + "post": { + "operationId": "Blobber_Collaborator", "responses": { "200": { "description": "A successful response.", "schema": { - "$ref": "#/definitions/v1GetObjectTreeResponse" + "$ref": "#/definitions/v1CollaboratorResponse" } }, "default": { @@ -281,28 +185,12 @@ "type": "string" }, { - "name": "context.client", - "in": "query", - "required": false, - "type": "string" - }, - { - "name": "context.clientKey", - "in": "query", - "required": false, - "type": "string" - }, - { - "name": "context.allocation", - "in": "query", - "required": false, - "type": "string" - }, - { - "name": "path", - "in": "query", - "required": false, - "type": "string" + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/v1CollaboratorRequest" + } } ], "tags": [ @@ -310,14 +198,14 @@ ] } }, - "/v2/file/referencepath/{allocation}": { - "get": { - "operationId": "Blobber_GetReferencePath", + "/v2/file/commitmetatxn/{allocation}": { + "post": { + "operationId": "Blobber_CommitMetaTxn", "responses": { "200": { "description": "A successful response.", "schema": { - "$ref": "#/definitions/v1GetReferencePathResponse" + "$ref": "#/definitions/v1CommitMetaTxnResponse" } }, "default": { @@ -335,34 +223,88 @@ "type": "string" }, { - "name": "Context.client", - "in": "query", - "required": false, - "type": "string" + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/v1CommitMetaTxnRequest" + } + } + ], + "tags": [ + "Blobber" + ] + } + }, + "/v2/file/copy/{allocation}": { + "post": { + "operationId": "Blobber_CopyObject", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/v1CopyObjectResponse" + } }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ { - "name": "Context.clientKey", - "in": "query", - "required": false, + "name": "allocation", + "in": "path", + "required": true, "type": "string" }, { - "name": "Context.allocation", - "in": "query", - "required": false, - "type": "string" + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/v1CopyObjectRequest" + } + } + ], + "tags": [ + "Blobber" + ] + } + }, + "/v2/file/download/{allocation}": { + "post": { + "operationId": "Blobber_DownloadFile", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/v1DownloadFileResponse" + } }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ { - "name": "Paths", - "in": "query", - "required": false, + "name": "allocation", + "in": "path", + "required": true, "type": "string" }, { - "name": "Path", - "in": "query", - "required": false, - "type": "string" + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/v1DownloadFileRequest" + } } ], "tags": [ @@ -370,14 +312,14 @@ ] } }, - "/v2/file/stats/{allocation}": { + "/v2/file/list/{allocation}": { "get": { - "operationId": "Blobber_GetFileStats", + "operationId": "Blobber_ListEntities", "responses": { "200": { "description": "A successful response.", "schema": { - "$ref": "#/definitions/v1GetFileStatsResponse" + "$ref": "#/definitions/v1ListEntitiesResponse" } }, "default": { @@ -395,31 +337,19 @@ "type": "string" }, { - "name": "context.client", - "in": "query", - "required": false, - "type": "string" - }, - { - "name": "context.clientKey", - "in": "query", - "required": false, - "type": "string" - }, - { - "name": "context.allocation", + "name": "path", "in": "query", "required": false, "type": "string" }, { - "name": "path", + "name": "pathHash", "in": "query", "required": false, "type": "string" }, { - "name": "pathHash", + "name": "authToken", "in": "query", "required": false, "type": "string" @@ -429,267 +359,821 @@ "Blobber" ] } - } - }, - "definitions": { - "protobufAny": { + }, + "/v2/file/meta/{allocation}": { + "post": { + "operationId": "Blobber_GetFileMetaData", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/v1GetFileMetaDataResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "allocation", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/v1GetFileMetaDataRequest" + } + } + ], + "tags": [ + "Blobber" + ] + } + }, + "/v2/file/objectpath/{allocation}": { + "get": { + "operationId": "Blobber_GetObjectPath", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/v1GetObjectPathResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "allocation", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "path", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "blockNum", + "in": "query", + "required": false, + "type": "string" + } + ], + "tags": [ + "Blobber" + ] + } + }, + "/v2/file/objecttree/{allocation}": { + "get": { + "operationId": "Blobber_GetObjectTree", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/v1GetObjectTreeResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "allocation", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "path", + "in": "query", + "required": false, + "type": "string" + } + ], + "tags": [ + "Blobber" + ] + } + }, + "/v2/file/referencepath/{allocation}": { + "get": { + "operationId": "Blobber_GetReferencePath", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/v1GetReferencePathResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "allocation", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "paths", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "path", + "in": "query", + "required": false, + "type": "string" + } + ], + "tags": [ + "Blobber" + ] + } + }, + "/v2/file/rename/{allocation}": { + "post": { + "operationId": "Blobber_RenameObject", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/v1RenameObjectResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "allocation", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/v1RenameObjectRequest" + } + } + ], + "tags": [ + "Blobber" + ] + } + }, + "/v2/file/stats/{allocation}": { + "post": { + "operationId": "Blobber_GetFileStats", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/v1GetFileStatsResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "allocation", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/v1GetFileStatsRequest" + } + } + ], + "tags": [ + "Blobber" + ] + } + }, + "/v2/file/upload/{allocation}": { + "delete": { + "operationId": "Blobber_UploadFile3", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/v1UploadFileResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "allocation", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/v1UploadFileRequest" + } + } + ], + "tags": [ + "Blobber" + ] + }, + "post": { + "operationId": "Blobber_UploadFile", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/v1UploadFileResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "allocation", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/v1UploadFileRequest" + } + } + ], + "tags": [ + "Blobber" + ] + }, + "put": { + "operationId": "Blobber_UploadFile2", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/v1UploadFileResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "allocation", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/v1UploadFileRequest" + } + } + ], + "tags": [ + "Blobber" + ] + } + } + }, + "definitions": { + "protobufAny": { + "type": "object", + "properties": { + "typeUrl": { + "type": "string" + }, + "value": { + "type": "string", + "format": "byte" + } + } + }, + "rpcStatus": { + "type": "object", + "properties": { + "code": { + "type": "integer", + "format": "int32" + }, + "message": { + "type": "string" + }, + "details": { + "type": "array", + "items": { + "$ref": "#/definitions/protobufAny" + } + } + } + }, + "v1Allocation": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "tx": { + "type": "string" + }, + "totalSize": { + "type": "string", + "format": "int64" + }, + "usedSize": { + "type": "string", + "format": "int64" + }, + "ownerId": { + "type": "string" + }, + "ownerPublicKey": { + "type": "string" + }, + "repairerId": { + "type": "string" + }, + "payerId": { + "type": "string" + }, + "expiration": { + "type": "string", + "format": "int64" + }, + "allocationRoot": { + "type": "string" + }, + "blobberSize": { + "type": "string", + "format": "int64" + }, + "blobberSizeUsed": { + "type": "string", + "format": "int64" + }, + "latestRedeemedWm": { + "type": "string" + }, + "isRedeemRequired": { + "type": "boolean" + }, + "timeUnit": { + "type": "string", + "format": "int64" + }, + "cleanedUp": { + "type": "boolean" + }, + "finalized": { + "type": "boolean" + }, + "terms": { + "type": "array", + "items": { + "$ref": "#/definitions/v1Term" + } + } + } + }, + "v1CalculateHashRequest": { + "type": "object", + "properties": { + "allocation": { + "type": "string" + }, + "path": { + "type": "string" + }, + "paths": { + "type": "string" + } + } + }, + "v1CalculateHashResponse": { + "type": "object", + "properties": { + "message": { + "type": "string" + } + } + }, + "v1Collaborator": { + "type": "object", + "properties": { + "refId": { + "type": "string", + "format": "int64" + }, + "clientId": { + "type": "string" + }, + "createdAt": { + "type": "string", + "format": "int64" + } + } + }, + "v1CollaboratorRequest": { + "type": "object", + "properties": { + "allocation": { + "type": "string" + }, + "collabId": { + "type": "string" + }, + "method": { + "type": "string" + }, + "path": { + "type": "string" + }, + "pathHash": { + "type": "string" + } + } + }, + "v1CollaboratorResponse": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "collaborators": { + "type": "array", + "items": { + "$ref": "#/definitions/v1Collaborator" + } + } + } + }, + "v1CommitMetaTxn": { + "type": "object", + "properties": { + "refId": { + "type": "string", + "format": "int64" + }, + "txnId": { + "type": "string" + }, + "createdAt": { + "type": "string", + "format": "int64" + } + } + }, + "v1CommitMetaTxnRequest": { + "type": "object", + "properties": { + "path": { + "type": "string" + }, + "pathHash": { + "type": "string" + }, + "authToken": { + "type": "string" + }, + "allocation": { + "type": "string" + }, + "txnId": { + "type": "string" + } + } + }, + "v1CommitMetaTxnResponse": { "type": "object", "properties": { - "typeUrl": { + "message": { "type": "string" - }, - "value": { - "type": "string", - "format": "byte" } } }, - "rpcStatus": { + "v1CommitRequest": { "type": "object", "properties": { - "code": { - "type": "integer", - "format": "int32" + "allocation": { + "type": "string" }, - "message": { + "connectionId": { "type": "string" }, - "details": { - "type": "array", - "items": { - "$ref": "#/definitions/protobufAny" - } + "writeMarker": { + "type": "string" } } }, - "v1Allocation": { + "v1CommitResponse": { "type": "object", "properties": { - "ID": { + "allocationRoot": { "type": "string" }, - "Tx": { - "type": "string" - }, - "TotalSize": { - "type": "string", - "format": "int64" - }, - "UsedSize": { - "type": "string", - "format": "int64" + "writeMarker": { + "$ref": "#/definitions/v1WriteMarker" }, - "OwnerID": { + "errorMessage": { "type": "string" }, - "OwnerPublicKey": { + "success": { + "type": "boolean" + } + } + }, + "v1CopyObjectRequest": { + "type": "object", + "properties": { + "allocation": { "type": "string" }, - "RepairerID": { + "path": { "type": "string" }, - "PayerID": { + "pathHash": { "type": "string" }, - "Expiration": { - "type": "string", - "format": "int64" - }, - "AllocationRoot": { + "connectionId": { "type": "string" }, - "BlobberSize": { - "type": "string", - "format": "int64" + "dest": { + "type": "string" + } + } + }, + "v1CopyObjectResponse": { + "type": "object", + "properties": { + "filename": { + "type": "string" }, - "BlobberSizeUsed": { + "size": { "type": "string", "format": "int64" }, - "LatestRedeemedWM": { + "contentHash": { "type": "string" }, - "IsRedeemRequired": { - "type": "boolean" + "merkleRoot": { + "type": "string" }, - "TimeUnit": { + "uploadLength": { "type": "string", - "format": "int64" - }, - "CleanedUp": { - "type": "boolean" + "format": "int64", + "description": "UploadLength indicates the size of the entire upload in bytes. The value MUST be a non-negative integer." }, - "Finalized": { - "type": "boolean" - }, - "Terms": { - "type": "array", - "items": { - "$ref": "#/definitions/v1Term" - } + "uploadOffset": { + "type": "string", + "format": "int64", + "description": "Upload-Offset indicates a byte offset within a resource. The value MUST be a non-negative integer." } } }, - "v1Collaborator": { + "v1DirMetaData": { "type": "object", "properties": { - "RefId": { + "type": { + "type": "string" + }, + "lookupHash": { + "type": "string" + }, + "name": { + "type": "string" + }, + "path": { + "type": "string" + }, + "hash": { + "type": "string" + }, + "numBlocks": { "type": "string", "format": "int64" }, - "ClientId": { + "pathHash": { "type": "string" }, - "CreatedAt": { + "size": { "type": "string", "format": "int64" - } - } - }, - "v1CommitMetaTxn": { - "type": "object", - "properties": { - "RefId": { + }, + "createdAt": { "type": "string", "format": "int64" }, - "TxnId": { - "type": "string" - }, - "CreatedAt": { + "updatedAt": { "type": "string", "format": "int64" } } }, - "v1DirMetaData": { + "v1DownloadFileRequest": { "type": "object", "properties": { - "Type": { + "allocation": { "type": "string" }, - "LookupHash": { + "path": { "type": "string" }, - "Name": { + "pathHash": { "type": "string" }, - "Path": { + "rxPay": { "type": "string" }, - "Hash": { + "blockNum": { "type": "string" }, - "NumBlocks": { - "type": "string", - "format": "int64" + "numBlocks": { + "type": "string" }, - "PathHash": { + "readMarker": { "type": "string" }, - "Size": { - "type": "string", - "format": "int64" + "authToken": { + "type": "string" }, - "CreatedAt": { - "type": "string", - "format": "int64" + "content": { + "type": "string" + } + } + }, + "v1DownloadFileResponse": { + "type": "object", + "properties": { + "success": { + "type": "boolean" }, - "UpdatedAt": { + "data": { "type": "string", - "format": "int64" + "format": "byte" }, - "Children": { - "type": "array", - "items": { - "$ref": "#/definitions/v1FileRef" - } + "allocationId": { + "type": "string" + }, + "path": { + "type": "string" + }, + "latestRm": { + "$ref": "#/definitions/v1ReadMaker" } } }, "v1FileMetaData": { "type": "object", "properties": { - "Type": { + "type": { "type": "string" }, - "LookupHash": { + "lookupHash": { "type": "string" }, - "Name": { + "name": { "type": "string" }, - "Path": { + "path": { "type": "string" }, - "Hash": { + "hash": { "type": "string" }, - "NumBlocks": { + "numBlocks": { "type": "string", "format": "int64" }, - "PathHash": { + "pathHash": { "type": "string" }, - "CustomMeta": { + "customMeta": { "type": "string" }, - "ContentHash": { + "contentHash": { "type": "string" }, - "Size": { + "size": { "type": "string", "format": "int64" }, - "MerkleRoot": { + "merkleRoot": { "type": "string" }, - "ActualFileSize": { + "actualFileSize": { "type": "string", "format": "int64" }, - "ActualFileHash": { + "actualFileHash": { "type": "string" }, - "MimeType": { + "mimeType": { "type": "string" }, - "ThumbnailSize": { + "thumbnailSize": { "type": "string", "format": "int64" }, - "ThumbnailHash": { + "thumbnailHash": { "type": "string" }, - "ActualThumbnailSize": { + "actualThumbnailSize": { "type": "string", "format": "int64" }, - "ActualThumbnailHash": { + "actualThumbnailHash": { "type": "string" }, - "EncryptedKey": { + "encryptedKey": { "type": "string" }, - "Attributes": { + "attributes": { "type": "string", "format": "byte" }, - "OnCloud": { + "onCloud": { "type": "boolean" }, - "CommitMetaTxns": { + "commitMetaTxns": { "type": "array", "items": { "$ref": "#/definitions/v1CommitMetaTxn" } }, - "CreatedAt": { + "createdAt": { "type": "string", "format": "int64" }, - "UpdatedAt": { + "updatedAt": { "type": "string", "format": "int64" } @@ -698,13 +1182,13 @@ "v1FileRef": { "type": "object", "properties": { - "Type": { + "type": { "type": "string" }, - "FileMetaData": { + "fileMetaData": { "$ref": "#/definitions/v1FileMetaData" }, - "DirMetaData": { + "dirMetaData": { "$ref": "#/definitions/v1DirMetaData" } } @@ -712,41 +1196,41 @@ "v1FileStats": { "type": "object", "properties": { - "ID": { + "id": { "type": "string", "format": "int64" }, - "RefID": { + "refId": { "type": "string", "format": "int64" }, - "NumUpdates": { + "numUpdates": { "type": "string", "format": "int64" }, - "NumBlockDownloads": { + "numBlockDownloads": { "type": "string", "format": "int64" }, - "SuccessChallenges": { + "successChallenges": { "type": "string", "format": "int64" }, - "FailedChallenges": { + "failedChallenges": { "type": "string", "format": "int64" }, - "LastChallengeResponseTxn": { + "lastChallengeResponseTxn": { "type": "string" }, - "WriteMarkerRedeemTxn": { + "writeMarkerRedeemTxn": { "type": "string" }, - "CreatedAt": { + "createdAt": { "type": "string", "format": "int64" }, - "UpdatedAt": { + "updatedAt": { "type": "string", "format": "int64" } @@ -760,13 +1244,30 @@ } } }, + "v1GetFileMetaDataRequest": { + "type": "object", + "properties": { + "path": { + "type": "string" + }, + "pathHash": { + "type": "string" + }, + "authToken": { + "type": "string" + }, + "allocation": { + "type": "string" + } + } + }, "v1GetFileMetaDataResponse": { "type": "object", "properties": { - "MetaData": { + "metaData": { "$ref": "#/definitions/v1FileRef" }, - "Collaborators": { + "collaborators": { "type": "array", "items": { "$ref": "#/definitions/v1Collaborator" @@ -774,13 +1275,27 @@ } } }, + "v1GetFileStatsRequest": { + "type": "object", + "properties": { + "path": { + "type": "string" + }, + "pathHash": { + "type": "string" + }, + "allocation": { + "type": "string" + } + } + }, "v1GetFileStatsResponse": { "type": "object", "properties": { - "MetaData": { + "metaData": { "$ref": "#/definitions/v1FileRef" }, - "Stats": { + "stats": { "$ref": "#/definitions/v1FileStats" } } @@ -788,10 +1303,10 @@ "v1GetObjectPathResponse": { "type": "object", "properties": { - "ObjectPath": { + "objectPath": { "$ref": "#/definitions/v1ObjectPath" }, - "LatestWriteMarker": { + "latestWriteMarker": { "$ref": "#/definitions/v1WriteMarker" } } @@ -799,10 +1314,10 @@ "v1GetObjectTreeResponse": { "type": "object", "properties": { - "ReferencePath": { + "referencePath": { "$ref": "#/definitions/v1ReferencePath" }, - "LatestWM": { + "latestWm": { "$ref": "#/definitions/v1WriteMarker" } } @@ -810,10 +1325,10 @@ "v1GetReferencePathResponse": { "type": "object", "properties": { - "ReferencePath": { + "referencePath": { "$ref": "#/definitions/v1ReferencePath" }, - "LatestWM": { + "latestWm": { "$ref": "#/definitions/v1WriteMarker" } } @@ -821,39 +1336,93 @@ "v1ListEntitiesResponse": { "type": "object", "properties": { - "AllocationRoot": { + "allocationRoot": { "type": "string" }, - "MetaData": { + "metaData": { "$ref": "#/definitions/v1FileRef" + }, + "entities": { + "type": "array", + "items": { + "$ref": "#/definitions/v1FileRef" + } } } }, "v1ObjectPath": { "type": "object", "properties": { - "RootHash": { + "rootHash": { "type": "string" }, - "Meta": { + "meta": { "$ref": "#/definitions/v1FileRef" }, - "Path": { + "path": { "$ref": "#/definitions/v1FileRef" }, - "FileBlockNum": { + "pathList": { + "type": "array", + "items": { + "$ref": "#/definitions/v1FileRef" + } + }, + "fileBlockNum": { + "type": "string", + "format": "int64" + } + } + }, + "v1ReadMaker": { + "type": "object", + "properties": { + "clientId": { + "type": "string" + }, + "clientPublicKey": { + "type": "string" + }, + "blobberId": { + "type": "string" + }, + "allocationId": { + "type": "string" + }, + "ownerId": { + "type": "string" + }, + "timestamp": { + "type": "string", + "format": "int64" + }, + "counter": { + "type": "string", + "format": "int64" + }, + "signature": { + "type": "string" + }, + "suspend": { "type": "string", "format": "int64" + }, + "payerId": { + "type": "string" + }, + "authTicket": { + "type": "string", + "format": "byte" } } }, "v1ReferencePath": { "type": "object", "properties": { - "MetaData": { + "metaData": { "$ref": "#/definitions/v1FileRef" }, - "List": { + "list": { "type": "array", "items": { "$ref": "#/definitions/v1ReferencePath" @@ -861,70 +1430,192 @@ } } }, - "v1RequestContext": { + "v1RenameObjectRequest": { "type": "object", "properties": { - "client": { + "allocation": { "type": "string" }, - "clientKey": { + "path": { "type": "string" }, - "allocation": { + "pathHash": { + "type": "string" + }, + "connectionId": { + "type": "string" + }, + "newName": { + "type": "string" + } + } + }, + "v1RenameObjectResponse": { + "type": "object", + "properties": { + "filename": { + "type": "string" + }, + "size": { + "type": "string", + "format": "int64" + }, + "contentHash": { "type": "string" + }, + "merkleRoot": { + "type": "string" + }, + "uploadLength": { + "type": "string", + "format": "int64", + "description": "UploadLength indicates the size of the entire upload in bytes. The value MUST be a non-negative integer." + }, + "uploadOffset": { + "type": "string", + "format": "int64", + "description": "Upload-Offset indicates a byte offset within a resource. The value MUST be a non-negative integer." } } }, "v1Term": { "type": "object", "properties": { - "ID": { + "id": { + "type": "string", + "format": "int64" + }, + "blobberId": { + "type": "string" + }, + "allocationId": { + "type": "string" + }, + "readPrice": { + "type": "string", + "format": "int64" + }, + "writePrice": { "type": "string", "format": "int64" + } + } + }, + "v1UpdateObjectAttributesRequest": { + "type": "object", + "properties": { + "allocation": { + "type": "string" + }, + "path": { + "type": "string" }, - "BlobberID": { + "pathHash": { "type": "string" }, - "AllocationID": { + "connectionId": { "type": "string" }, - "ReadPrice": { + "attributes": { + "type": "string" + } + } + }, + "v1UpdateObjectAttributesResponse": { + "type": "object", + "properties": { + "whoPaysForReads": { "type": "string", "format": "int64" + } + } + }, + "v1UploadFileRequest": { + "type": "object", + "properties": { + "allocation": { + "type": "string" + }, + "path": { + "type": "string" + }, + "connectionId": { + "type": "string" + }, + "method": { + "type": "string" + }, + "uploadMeta": { + "type": "string" + }, + "updateMeta": { + "type": "string" + }, + "uploadFile": { + "type": "string", + "format": "byte" + }, + "uploadThumbnailFile": { + "type": "string", + "format": "byte" + } + } + }, + "v1UploadFileResponse": { + "type": "object", + "properties": { + "filename": { + "type": "string" }, - "WritePrice": { + "size": { "type": "string", "format": "int64" + }, + "contentHash": { + "type": "string" + }, + "merkleRoot": { + "type": "string" + }, + "uploadLength": { + "type": "string", + "format": "int64", + "description": "UploadLength indicates the size of the entire upload in bytes. The value MUST be a non-negative integer." + }, + "uploadOffset": { + "type": "string", + "format": "int64", + "description": "Upload-Offset indicates a byte offset within a resource. The value MUST be a non-negative integer." } } }, "v1WriteMarker": { "type": "object", "properties": { - "AllocationRoot": { + "allocationRoot": { "type": "string" }, - "PreviousAllocationRoot": { + "previousAllocationRoot": { "type": "string" }, - "AllocationID": { + "allocationId": { "type": "string" }, - "Size": { + "size": { "type": "string", "format": "int64" }, - "BlobberID": { + "blobberId": { "type": "string" }, - "Timestamp": { + "timestamp": { "type": "string", "format": "int64" }, - "ClientID": { + "clientId": { "type": "string" }, - "Signature": { + "signature": { "type": "string" } } diff --git a/code/go/0chain.net/blobbercore/readmarker/entity.go b/code/go/0chain.net/blobbercore/readmarker/entity.go index f816554e3..bbfde663c 100644 --- a/code/go/0chain.net/blobbercore/readmarker/entity.go +++ b/code/go/0chain.net/blobbercore/readmarker/entity.go @@ -5,14 +5,14 @@ import ( "encoding/json" "fmt" - "0chain.net/blobbercore/allocation" - "0chain.net/blobbercore/datastore" - "0chain.net/core/common" - "0chain.net/core/encryption" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/allocation" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/datastore" + "github.com/0chain/blobber/code/go/0chain.net/core/common" + "github.com/0chain/blobber/code/go/0chain.net/core/encryption" "gorm.io/datatypes" - . "0chain.net/core/logging" + . "github.com/0chain/blobber/code/go/0chain.net/core/logging" "go.uber.org/zap" ) diff --git a/code/go/0chain.net/blobbercore/readmarker/protocol.go b/code/go/0chain.net/blobbercore/readmarker/protocol.go index 1089a7dc9..fb2e08f4f 100644 --- a/code/go/0chain.net/blobbercore/readmarker/protocol.go +++ b/code/go/0chain.net/blobbercore/readmarker/protocol.go @@ -5,17 +5,17 @@ import ( "encoding/json" "time" - "0chain.net/blobbercore/allocation" - "0chain.net/blobbercore/constants" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/allocation" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/constants" - "0chain.net/blobbercore/datastore" - "0chain.net/core/chain" - "0chain.net/core/common" - "0chain.net/core/encryption" - "0chain.net/core/node" - "0chain.net/core/transaction" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/datastore" + "github.com/0chain/blobber/code/go/0chain.net/core/chain" + "github.com/0chain/blobber/code/go/0chain.net/core/common" + "github.com/0chain/blobber/code/go/0chain.net/core/encryption" + "github.com/0chain/blobber/code/go/0chain.net/core/node" + "github.com/0chain/blobber/code/go/0chain.net/core/transaction" - . "0chain.net/core/logging" + . "github.com/0chain/blobber/code/go/0chain.net/core/logging" "go.uber.org/zap" ) diff --git a/code/go/0chain.net/blobbercore/readmarker/worker.go b/code/go/0chain.net/blobbercore/readmarker/worker.go index d700e3400..ffabc4764 100644 --- a/code/go/0chain.net/blobbercore/readmarker/worker.go +++ b/code/go/0chain.net/blobbercore/readmarker/worker.go @@ -5,11 +5,11 @@ import ( "encoding/json" "time" - "0chain.net/blobbercore/config" - "0chain.net/blobbercore/datastore" - "0chain.net/core/chain" - . "0chain.net/core/logging" - "0chain.net/core/transaction" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/config" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/datastore" + "github.com/0chain/blobber/code/go/0chain.net/core/chain" + . "github.com/0chain/blobber/code/go/0chain.net/core/logging" + "github.com/0chain/blobber/code/go/0chain.net/core/transaction" "github.com/remeh/sizedwaitgroup" "go.uber.org/zap" diff --git a/code/go/0chain.net/blobbercore/reference/collaborator.go b/code/go/0chain.net/blobbercore/reference/collaborator.go index 65205ff67..748c6ad56 100644 --- a/code/go/0chain.net/blobbercore/reference/collaborator.go +++ b/code/go/0chain.net/blobbercore/reference/collaborator.go @@ -4,7 +4,7 @@ import ( "context" "time" - "0chain.net/blobbercore/datastore" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/datastore" ) type Collaborator struct { diff --git a/code/go/0chain.net/blobbercore/reference/commitmetatxn.go b/code/go/0chain.net/blobbercore/reference/commitmetatxn.go index 6e52caeab..2c63e0d75 100644 --- a/code/go/0chain.net/blobbercore/reference/commitmetatxn.go +++ b/code/go/0chain.net/blobbercore/reference/commitmetatxn.go @@ -4,7 +4,7 @@ import ( "context" "time" - "0chain.net/blobbercore/datastore" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/datastore" ) type CommitMetaTxn struct { diff --git a/code/go/0chain.net/blobbercore/reference/objectpath.go b/code/go/0chain.net/blobbercore/reference/objectpath.go index 3c5786dcf..3712b86e7 100644 --- a/code/go/0chain.net/blobbercore/reference/objectpath.go +++ b/code/go/0chain.net/blobbercore/reference/objectpath.go @@ -4,9 +4,7 @@ import ( "context" "fmt" - "0chain.net/blobbercore/blobbergrpc" - - "0chain.net/core/common" + "github.com/0chain/blobber/code/go/0chain.net/core/common" ) type ObjectPath struct { @@ -89,150 +87,3 @@ func GetObjectPath(ctx context.Context, allocationID string, blockNum int64) (*O return &retObj, nil } - -// TODO needs to be refactored, current implementation can probably be heavily simplified -func GetObjectPathGRPC(ctx context.Context, allocationID string, blockNum int64) (*blobbergrpc.ObjectPath, error) { - - rootRef, err := GetRefWithSortedChildren(ctx, allocationID, "/") - if err != nil { - return nil, common.NewError("invalid_dir_struct", "Allocation root corresponds to an invalid directory structure") - } - - if rootRef.NumBlocks < blockNum { - return nil, common.NewError("invalid_block_num", fmt.Sprintf("Invalid block number %d/%d", rootRef.NumBlocks, blockNum)) - } - - if rootRef.NumBlocks == 0 { - children := make([]*blobbergrpc.FileRef, len(rootRef.Children)) - for idx, child := range rootRef.Children { - children[idx] = FileRefToFileRefGRPC(child) - } - path := FileRefToFileRefGRPC(rootRef) - path.DirMetaData.Children = children - return &blobbergrpc.ObjectPath{ - RootHash: rootRef.Hash, - Path: path, - FileBlockNum: 0, - }, nil - } - - found := false - var curRef *Ref - curRef = rootRef - remainingBlocks := blockNum - - result := curRef.GetListingData(ctx) - curResult := result - - for !found { - list := make([]map[string]interface{}, len(curRef.Children)) - for idx, child := range curRef.Children { - list[idx] = child.GetListingData(ctx) - } - curResult["list"] = list - for idx, child := range curRef.Children { - - if child.NumBlocks < remainingBlocks { - remainingBlocks = remainingBlocks - child.NumBlocks - continue - } - if child.Type == FILE { - found = true - curRef = child - break - } - curRef, err = GetRefWithSortedChildren(ctx, allocationID, child.Path) - if err != nil || len(curRef.Hash) == 0 { - return nil, common.NewError("failed_object_path", "Failed to get the object path") - } - curResult = list[idx] - break - } - } - if !found { - return nil, common.NewError("invalid_parameters", "Block num was not found") - } - - var children []*blobbergrpc.FileRef - for _, child := range rootRef.Children { - children = append(children, FileRefToFileRefGRPC(child)) - } - path := FileRefToFileRefGRPC(rootRef) - path.DirMetaData.Children = children - return &blobbergrpc.ObjectPath{ - RootHash: rootRef.Hash, - Meta: FileRefToFileRefGRPC(curRef), - Path: path, - FileBlockNum: remainingBlocks, - }, nil -} - -func FileRefToFileRefGRPC(ref *Ref) *blobbergrpc.FileRef { - - var fileMetaData *blobbergrpc.FileMetaData - var dirMetaData *blobbergrpc.DirMetaData - switch ref.Type { - case FILE: - fileMetaData = convertFileRefToFileMetaDataGRPC(ref) - case DIRECTORY: - dirMetaData = convertDirRefToDirMetaDataGRPC(ref) - } - - return &blobbergrpc.FileRef{ - Type: ref.Type, - FileMetaData: fileMetaData, - DirMetaData: dirMetaData, - } -} - -func convertFileRefToFileMetaDataGRPC(fileref *Ref) *blobbergrpc.FileMetaData { - var commitMetaTxnsGRPC []*blobbergrpc.CommitMetaTxn - for _, c := range fileref.CommitMetaTxns { - commitMetaTxnsGRPC = append(commitMetaTxnsGRPC, &blobbergrpc.CommitMetaTxn{ - RefId: c.RefID, - TxnId: c.TxnID, - CreatedAt: c.CreatedAt.UnixNano(), - }) - } - return &blobbergrpc.FileMetaData{ - Type: fileref.Type, - LookupHash: fileref.LookupHash, - Name: fileref.Name, - Path: fileref.Path, - Hash: fileref.Hash, - NumBlocks: fileref.NumBlocks, - PathHash: fileref.PathHash, - CustomMeta: fileref.CustomMeta, - ContentHash: fileref.ContentHash, - Size: fileref.Size, - MerkleRoot: fileref.MerkleRoot, - ActualFileSize: fileref.ActualFileSize, - ActualFileHash: fileref.ActualFileHash, - MimeType: fileref.MimeType, - ThumbnailSize: fileref.ThumbnailSize, - ThumbnailHash: fileref.ThumbnailHash, - ActualThumbnailSize: fileref.ActualThumbnailSize, - ActualThumbnailHash: fileref.ActualThumbnailHash, - EncryptedKey: fileref.EncryptedKey, - Attributes: fileref.Attributes, - OnCloud: fileref.OnCloud, - CommitMetaTxns: commitMetaTxnsGRPC, - CreatedAt: fileref.CreatedAt.UnixNano(), - UpdatedAt: fileref.UpdatedAt.UnixNano(), - } -} - -func convertDirRefToDirMetaDataGRPC(dirref *Ref) *blobbergrpc.DirMetaData { - return &blobbergrpc.DirMetaData{ - Type: dirref.Type, - LookupHash: dirref.LookupHash, - Name: dirref.Name, - Path: dirref.Path, - Hash: dirref.Hash, - NumBlocks: dirref.NumBlocks, - PathHash: dirref.PathHash, - Size: dirref.Size, - CreatedAt: dirref.CreatedAt.UnixNano(), - UpdatedAt: dirref.UpdatedAt.UnixNano(), - } -} diff --git a/code/go/0chain.net/blobbercore/reference/ref.go b/code/go/0chain.net/blobbercore/reference/ref.go index f422f501f..6d7b3813e 100644 --- a/code/go/0chain.net/blobbercore/reference/ref.go +++ b/code/go/0chain.net/blobbercore/reference/ref.go @@ -11,9 +11,9 @@ import ( "strings" "time" - "0chain.net/blobbercore/datastore" - "0chain.net/core/common" - "0chain.net/core/encryption" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/datastore" + "github.com/0chain/blobber/code/go/0chain.net/core/common" + "github.com/0chain/blobber/code/go/0chain.net/core/encryption" "gorm.io/datatypes" "gorm.io/gorm" @@ -342,12 +342,54 @@ func (r *Ref) Save(ctx context.Context) error { } func (r *Ref) GetListingData(ctx context.Context) map[string]interface{} { + if r == nil { + return make(map[string]interface{}) + } + if r.Type == FILE { return GetListingFieldsMap(*r, FILE_LIST_TAG) } return GetListingFieldsMap(*r, DIR_LIST_TAG) } +func ListingDataToRef(refMap map[string]interface{}) *Ref { + if len(refMap) < 1 { + return nil + } + + ref := &Ref{} + + refType, _ := refMap["type"].(string) + var tagName string + if refType == FILE { + tagName = FILE_LIST_TAG + } else { + tagName = DIR_LIST_TAG + } + + t := reflect.TypeOf(ref).Elem() + v := reflect.ValueOf(ref).Elem() + + // Iterate over all available fields and read the tag value + for i := 0; i < t.NumField(); i++ { + field := t.Field(i) + + // Get the field tag value + tag := field.Tag.Get(tagName) + // Skip if tag is not defined or ignored + if tag == "" || tag == "-" { + continue + } + + val := refMap[tag] + if val != nil { + v.FieldByName(field.Name).Set(reflect.ValueOf(val)) + } + } + + return ref +} + func GetListingFieldsMap(refEntity interface{}, tagName string) map[string]interface{} { result := make(map[string]interface{}) t := reflect.TypeOf(refEntity) diff --git a/code/go/0chain.net/blobbercore/reference/referencepath.go b/code/go/0chain.net/blobbercore/reference/referencepath.go index cc424a25e..4103d8dc0 100644 --- a/code/go/0chain.net/blobbercore/reference/referencepath.go +++ b/code/go/0chain.net/blobbercore/reference/referencepath.go @@ -4,10 +4,16 @@ import ( "context" "path/filepath" - "0chain.net/blobbercore/datastore" - "0chain.net/core/common" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/datastore" + "github.com/0chain/blobber/code/go/0chain.net/core/common" ) +type ReferencePath struct { + Meta map[string]interface{} `json:"meta_data"` + List []*ReferencePath `json:"list,omitempty"` + Ref *Ref +} + func GetReferencePath(ctx context.Context, allocationID string, path string) (*Ref, error) { return GetReferencePathFromPaths(ctx, allocationID, []string{path}) } diff --git a/code/go/0chain.net/blobbercore/scripts/generate-grpc.sh b/code/go/0chain.net/blobbercore/scripts/generate-grpc.sh deleted file mode 100755 index eacae03fb..000000000 --- a/code/go/0chain.net/blobbercore/scripts/generate-grpc.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env bash - -protoc -I ./blobbergrpc/proto --go-grpc_out=. --go_out=. --grpc-gateway_out=. --openapiv2_out=./openapi ./blobbergrpc/proto/blobber.proto \ No newline at end of file diff --git a/code/go/0chain.net/blobbercore/stats/allocationstats.go b/code/go/0chain.net/blobbercore/stats/allocationstats.go index fc0f2b6ab..55ddafaab 100644 --- a/code/go/0chain.net/blobbercore/stats/allocationstats.go +++ b/code/go/0chain.net/blobbercore/stats/allocationstats.go @@ -3,7 +3,7 @@ package stats import ( "time" - "0chain.net/blobbercore/filestore" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/filestore" ) // Timestamp that implements standard fmt.Stringer interface. diff --git a/code/go/0chain.net/blobbercore/stats/blobberstats.go b/code/go/0chain.net/blobbercore/stats/blobberstats.go index 5d4f1c111..6fe5b15a9 100644 --- a/code/go/0chain.net/blobbercore/stats/blobberstats.go +++ b/code/go/0chain.net/blobbercore/stats/blobberstats.go @@ -6,14 +6,14 @@ import ( "encoding/json" "time" - "0chain.net/blobbercore/config" - "0chain.net/blobbercore/datastore" - "0chain.net/blobbercore/filestore" - "0chain.net/core/common" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/config" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/datastore" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/filestore" + "github.com/0chain/blobber/code/go/0chain.net/core/common" - "0chain.net/core/node" + "github.com/0chain/blobber/code/go/0chain.net/core/node" - . "0chain.net/core/logging" + . "github.com/0chain/blobber/code/go/0chain.net/core/logging" "go.uber.org/zap" "gorm.io/datatypes" diff --git a/code/go/0chain.net/blobbercore/stats/filestats.go b/code/go/0chain.net/blobbercore/stats/filestats.go index 8ce642387..76ac3d2b0 100644 --- a/code/go/0chain.net/blobbercore/stats/filestats.go +++ b/code/go/0chain.net/blobbercore/stats/filestats.go @@ -3,7 +3,7 @@ package stats import ( "context" - "0chain.net/blobbercore/datastore" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/datastore" "gorm.io/gorm" ) diff --git a/code/go/0chain.net/blobbercore/stats/handler.go b/code/go/0chain.net/blobbercore/stats/handler.go index faea3cdaa..bf1a1be0a 100644 --- a/code/go/0chain.net/blobbercore/stats/handler.go +++ b/code/go/0chain.net/blobbercore/stats/handler.go @@ -6,10 +6,10 @@ import ( "html/template" "net/http" - "0chain.net/blobbercore/constants" - "0chain.net/blobbercore/datastore" - "0chain.net/core/common" - . "0chain.net/core/logging" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/constants" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/datastore" + "github.com/0chain/blobber/code/go/0chain.net/core/common" + . "github.com/0chain/blobber/code/go/0chain.net/core/logging" "go.uber.org/zap" ) diff --git a/code/go/0chain.net/blobbercore/writemarker/entity.go b/code/go/0chain.net/blobbercore/writemarker/entity.go index 64636208e..27b7c5e4f 100644 --- a/code/go/0chain.net/blobbercore/writemarker/entity.go +++ b/code/go/0chain.net/blobbercore/writemarker/entity.go @@ -5,9 +5,9 @@ import ( "encoding/json" "fmt" - "0chain.net/blobbercore/allocation" - "0chain.net/blobbercore/datastore" - "0chain.net/core/common" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/allocation" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/datastore" + "github.com/0chain/blobber/code/go/0chain.net/core/common" ) type WriteMarker struct { diff --git a/code/go/0chain.net/blobbercore/writemarker/protocol.go b/code/go/0chain.net/blobbercore/writemarker/protocol.go index c152adde2..d4e3a7e56 100644 --- a/code/go/0chain.net/blobbercore/writemarker/protocol.go +++ b/code/go/0chain.net/blobbercore/writemarker/protocol.go @@ -5,14 +5,14 @@ import ( "encoding/json" "time" - "0chain.net/blobbercore/allocation" - "0chain.net/blobbercore/constants" - "0chain.net/core/chain" - "0chain.net/core/common" - "0chain.net/core/encryption" - . "0chain.net/core/logging" - "0chain.net/core/node" - "0chain.net/core/transaction" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/allocation" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/constants" + "github.com/0chain/blobber/code/go/0chain.net/core/chain" + "github.com/0chain/blobber/code/go/0chain.net/core/common" + "github.com/0chain/blobber/code/go/0chain.net/core/encryption" + . "github.com/0chain/blobber/code/go/0chain.net/core/logging" + "github.com/0chain/blobber/code/go/0chain.net/core/node" + "github.com/0chain/blobber/code/go/0chain.net/core/transaction" "go.uber.org/zap" ) diff --git a/code/go/0chain.net/blobbercore/writemarker/worker.go b/code/go/0chain.net/blobbercore/writemarker/worker.go index 7456d5d49..84a112a13 100644 --- a/code/go/0chain.net/blobbercore/writemarker/worker.go +++ b/code/go/0chain.net/blobbercore/writemarker/worker.go @@ -4,10 +4,10 @@ import ( "context" "time" - "0chain.net/blobbercore/allocation" - "0chain.net/blobbercore/config" - "0chain.net/blobbercore/datastore" - . "0chain.net/core/logging" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/allocation" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/config" + "github.com/0chain/blobber/code/go/0chain.net/blobbercore/datastore" + . "github.com/0chain/blobber/code/go/0chain.net/core/logging" "github.com/remeh/sizedwaitgroup" "go.uber.org/zap" diff --git a/code/go/0chain.net/conductor/conductrpc/server.go b/code/go/0chain.net/conductor/conductrpc/server.go index 2b0d0de97..01979c52a 100644 --- a/code/go/0chain.net/conductor/conductrpc/server.go +++ b/code/go/0chain.net/conductor/conductrpc/server.go @@ -3,7 +3,7 @@ package conductrpc import ( "errors" - "0chain.net/conductor/config" + "github.com/0chain/blobber/code/go/0chain.net/conductor/config" ) var ErrShutdown = errors.New("server shutdown") diff --git a/code/go/0chain.net/conductor/conductrpc/state.go b/code/go/0chain.net/conductor/conductrpc/state.go index c3ab62d8a..7f723162f 100644 --- a/code/go/0chain.net/conductor/conductrpc/state.go +++ b/code/go/0chain.net/conductor/conductrpc/state.go @@ -1,7 +1,7 @@ package conductrpc import ( - "0chain.net/conductor/config" + "github.com/0chain/blobber/code/go/0chain.net/conductor/config" ) // diff --git a/code/go/0chain.net/core/chain/entity.go b/code/go/0chain.net/core/chain/entity.go index ad2825e86..7360a4f93 100644 --- a/code/go/0chain.net/core/chain/entity.go +++ b/code/go/0chain.net/core/chain/entity.go @@ -3,8 +3,8 @@ package chain import ( "context" - "0chain.net/core/common" - "0chain.net/core/config" + "github.com/0chain/blobber/code/go/0chain.net/core/common" + "github.com/0chain/blobber/code/go/0chain.net/core/config" "github.com/spf13/viper" ) diff --git a/code/go/0chain.net/core/common/context.go b/code/go/0chain.net/core/common/context.go index 63eebfb32..8d69fdcba 100644 --- a/code/go/0chain.net/core/common/context.go +++ b/code/go/0chain.net/core/common/context.go @@ -8,7 +8,7 @@ import ( "syscall" "time" - "0chain.net/core/logging" + "github.com/0chain/blobber/code/go/0chain.net/core/logging" "go.uber.org/zap" ) diff --git a/code/go/0chain.net/core/common/rate_limiter.go b/code/go/0chain.net/core/common/rate_limiter.go index a4cacdda0..6bb04168f 100644 --- a/code/go/0chain.net/core/common/rate_limiter.go +++ b/code/go/0chain.net/core/common/rate_limiter.go @@ -32,7 +32,7 @@ func (rl *ratelimit) init() { const DefaultRequestPerSecond = 100000 //ConfigRateLimits - configure the rate limits -func ConfigRateLimits() *GRPCRateLimiter { +func ConfigRateLimits() { userRl := viper.GetFloat64("handlers.rate_limit") if userRl == 0 { @@ -41,6 +41,14 @@ func ConfigRateLimits() *GRPCRateLimiter { userRateLimit = &ratelimit{RequestsPerSecond: userRl} userRateLimit.init() +} + +func NewGRPCRateLimiter() *GRPCRateLimiter { + userRl := viper.GetFloat64("handlers.rate_limit") + + if userRl == 0 { + userRl = DefaultRequestPerSecond + } return &GRPCRateLimiter{rl.New(int(userRl))} } diff --git a/code/go/0chain.net/core/encryption/keys.go b/code/go/0chain.net/core/encryption/keys.go index 7000c2560..977db108d 100644 --- a/code/go/0chain.net/core/encryption/keys.go +++ b/code/go/0chain.net/core/encryption/keys.go @@ -5,9 +5,9 @@ import ( "io" "strings" - "0chain.net/core/common" - "0chain.net/core/config" - . "0chain.net/core/logging" + "github.com/0chain/blobber/code/go/0chain.net/core/common" + "github.com/0chain/blobber/code/go/0chain.net/core/config" + . "github.com/0chain/blobber/code/go/0chain.net/core/logging" "github.com/0chain/gosdk/core/zcncrypto" "github.com/herumi/bls-go-binary/bls" @@ -50,6 +50,7 @@ func Verify(publicKey string, signature string, hash string) (bool, error) { // // This is an example of the raw public key we expect from MIRACL var miraclExamplePK = `0418a02c6bd223ae0dfda1d2f9a3c81726ab436ce5e9d17c531ff0a385a13a0b491bdfed3a85690775ee35c61678957aaba7b1a1899438829f1dc94248d87ed36817f6dfafec19bfa87bf791a4d694f43fec227ae6f5a867490e30328cac05eaff039ac7dfc3364e851ebd2631ea6f1685609fc66d50223cc696cb59ff2fee47ac` + // // This is an example of the same MIRACL public key serialized with ToString(). // pk ([1bdfed3a85690775ee35c61678957aaba7b1a1899438829f1dc94248d87ed368,18a02c6bd223ae0dfda1d2f9a3c81726ab436ce5e9d17c531ff0a385a13a0b49],[039ac7dfc3364e851ebd2631ea6f1685609fc66d50223cc696cb59ff2fee47ac,17f6dfafec19bfa87bf791a4d694f43fec227ae6f5a867490e30328cac05eaff]) @@ -59,9 +60,9 @@ func MiraclToHerumiPK(pk string) string { return pk } n1 := pk[2:66] - n2 := pk[66:(66+64)] - n3 := pk[(66+64):(66+64+64)] - n4 := pk[(66+64+64):(66+64+64+64)] + n2 := pk[66:(66 + 64)] + n3 := pk[(66 + 64):(66 + 64 + 64)] + n4 := pk[(66 + 64 + 64):(66 + 64 + 64 + 64)] var p bls.PublicKey err := p.SetHexString("1 " + n2 + " " + n1 + " " + n4 + " " + n3) if err != nil { @@ -76,6 +77,7 @@ func MiraclToHerumiPK(pk string) string { // // If the 'sig' was not in MIRACL format, we just return the original sig. const miraclExampleSig = `(0d4dbad6d2586d5e01b6b7fbad77e4adfa81212c52b4a0b885e19c58e0944764,110061aa16d5ba36eef0ad4503be346908d3513c0a2aedfd0d2923411b420eca)` + func MiraclToHerumiSig(sig string) string { if len(sig) <= 2 { return sig @@ -83,13 +85,13 @@ func MiraclToHerumiSig(sig string) string { if sig[0] != miraclExampleSig[0] { return sig } - withoutParens := sig[1: (len(sig)-1) ] + withoutParens := sig[1:(len(sig) - 1)] comma := strings.Index(withoutParens, ",") if comma < 0 { return "00" } n1 := withoutParens[0:comma] - n2 := withoutParens[(comma+1):] + n2 := withoutParens[(comma + 1):] var sign bls.Sign err := sign.SetHexString("1 " + n1 + " " + n2) if err != nil { diff --git a/code/go/0chain.net/core/node/context.go b/code/go/0chain.net/core/node/context.go index 9d41b740b..120c160cd 100644 --- a/code/go/0chain.net/core/node/context.go +++ b/code/go/0chain.net/core/node/context.go @@ -3,7 +3,7 @@ package node import ( "context" - "0chain.net/core/common" + "github.com/0chain/blobber/code/go/0chain.net/core/common" ) const SELF_NODE common.ContextKey = "SELF_NODE" diff --git a/code/go/0chain.net/core/node/self_node.go b/code/go/0chain.net/core/node/self_node.go index 573b9baf3..19afb1369 100644 --- a/code/go/0chain.net/core/node/self_node.go +++ b/code/go/0chain.net/core/node/self_node.go @@ -5,8 +5,8 @@ import ( "encoding/json" "fmt" - "0chain.net/core/common" - "0chain.net/core/config" + "github.com/0chain/blobber/code/go/0chain.net/core/common" + "github.com/0chain/blobber/code/go/0chain.net/core/config" "github.com/0chain/gosdk/core/zcncrypto" "golang.org/x/crypto/sha3" ) diff --git a/code/go/0chain.net/core/transaction/entity.go b/code/go/0chain.net/core/transaction/entity.go index 8be9e6c31..fbbcbfc8c 100644 --- a/code/go/0chain.net/core/transaction/entity.go +++ b/code/go/0chain.net/core/transaction/entity.go @@ -7,9 +7,9 @@ import ( "github.com/0chain/gosdk/zcncore" - "0chain.net/core/chain" - "0chain.net/core/common" - "0chain.net/core/node" + "github.com/0chain/blobber/code/go/0chain.net/core/chain" + "github.com/0chain/blobber/code/go/0chain.net/core/common" + "github.com/0chain/blobber/code/go/0chain.net/core/node" ) //Transaction entity that encapsulates the transaction related data and meta data diff --git a/code/go/0chain.net/core/transaction/http.go b/code/go/0chain.net/core/transaction/http.go index 11bab7fb7..8c8bd925b 100644 --- a/code/go/0chain.net/core/transaction/http.go +++ b/code/go/0chain.net/core/transaction/http.go @@ -15,13 +15,13 @@ import ( //"sync" "time" - "0chain.net/core/chain" - "0chain.net/core/common" - . "0chain.net/core/logging" + "github.com/0chain/blobber/code/go/0chain.net/core/chain" + "github.com/0chain/blobber/code/go/0chain.net/core/common" + . "github.com/0chain/blobber/code/go/0chain.net/core/logging" "github.com/0chain/gosdk/core/util" "github.com/0chain/gosdk/zcncore" - //"0chain.net/core/util" + //"github.com/0chain/blobber/code/go/0chain.net/core/util" "go.uber.org/zap" ) @@ -33,7 +33,7 @@ const REGISTER_CLIENT = "v1/client/put" const ( SLEEP_FOR_TXN_CONFIRMATION = 5 - SC_REST_API_ATTEMPTS = 3 + SC_REST_API_ATTEMPTS = 3 ) var ErrNoTxnDetail = common.NewError("missing_transaction_detail", "No transaction detail was found on any of the sharders") @@ -214,10 +214,12 @@ func MakeSCRestAPICall(scAddress string, relativePath string, params map[string] for counter > 0 { resp, err = netClient.Get(u.String()) - if err != nil { break } + if err != nil { + break + } // if it's not available, retry if there are any retry attempts - if (resp.StatusCode == 503 || resp.StatusCode == 504) { + if resp.StatusCode == 503 || resp.StatusCode == 504 { resp.Body.Close() counter-- } else { diff --git a/code/go/0chain.net/core/util/http.go b/code/go/0chain.net/core/util/http.go index 920af26d7..a1e983f33 100644 --- a/code/go/0chain.net/core/util/http.go +++ b/code/go/0chain.net/core/util/http.go @@ -8,10 +8,10 @@ import ( "sync" "time" - "0chain.net/core/common" - "0chain.net/core/encryption" - . "0chain.net/core/logging" - "0chain.net/core/node" + "github.com/0chain/blobber/code/go/0chain.net/core/common" + "github.com/0chain/blobber/code/go/0chain.net/core/encryption" + . "github.com/0chain/blobber/code/go/0chain.net/core/logging" + "github.com/0chain/blobber/code/go/0chain.net/core/node" "go.uber.org/zap" ) diff --git a/code/go/0chain.net/core/util/merkle_tree_interface.go b/code/go/0chain.net/core/util/merkle_tree_interface.go index 83c31f95a..4eeea3ede 100644 --- a/code/go/0chain.net/core/util/merkle_tree_interface.go +++ b/code/go/0chain.net/core/util/merkle_tree_interface.go @@ -1,6 +1,6 @@ package util -import "0chain.net/core/encryption" +import "github.com/0chain/blobber/code/go/0chain.net/core/encryption" /*MerkleTreeI - a merkle tree interface required for constructing and providing verification */ type MerkleTreeI interface { diff --git a/code/go/0chain.net/core/util/merkle_tree_test.go b/code/go/0chain.net/core/util/merkle_tree_test.go index da84b49af..57fe65380 100644 --- a/code/go/0chain.net/core/util/merkle_tree_test.go +++ b/code/go/0chain.net/core/util/merkle_tree_test.go @@ -5,7 +5,7 @@ import ( "math/rand" "testing" - "0chain.net/core/encryption" + "github.com/0chain/blobber/code/go/0chain.net/core/encryption" ) type Txn struct { diff --git a/code/go/0chain.net/core/util/secure_value.go b/code/go/0chain.net/core/util/secure_value.go index 7b730fd32..78c8ff8ae 100644 --- a/code/go/0chain.net/core/util/secure_value.go +++ b/code/go/0chain.net/core/util/secure_value.go @@ -4,7 +4,7 @@ import ( "encoding/hex" "strings" - "0chain.net/core/encryption" + "github.com/0chain/blobber/code/go/0chain.net/core/encryption" ) /*Hashable - anything that can provide it's hash */ diff --git a/code/go/0chain.net/tools/tool.go b/code/go/0chain.net/tools/tool.go new file mode 100644 index 000000000..5d7fa0ee8 --- /dev/null +++ b/code/go/0chain.net/tools/tool.go @@ -0,0 +1,10 @@ +// +build tools + +package tools + +import ( + _ "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway" + _ "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2" + _ "google.golang.org/grpc/cmd/protoc-gen-go-grpc" + _ "google.golang.org/protobuf/cmd/protoc-gen-go" +) diff --git a/code/go/0chain.net/validator/main.go b/code/go/0chain.net/validator/main.go index 684041f31..4d673d13e 100644 --- a/code/go/0chain.net/validator/main.go +++ b/code/go/0chain.net/validator/main.go @@ -10,18 +10,18 @@ import ( "strconv" "time" - "0chain.net/core/build" - "0chain.net/core/chain" - - "0chain.net/core/common" - "0chain.net/core/encryption" - "0chain.net/core/logging" - . "0chain.net/core/logging" - "0chain.net/core/node" - "0chain.net/core/transaction" - "0chain.net/core/util" - "0chain.net/validatorcore/config" - "0chain.net/validatorcore/storage" + "github.com/0chain/blobber/code/go/0chain.net/core/build" + "github.com/0chain/blobber/code/go/0chain.net/core/chain" + + "github.com/0chain/blobber/code/go/0chain.net/core/common" + "github.com/0chain/blobber/code/go/0chain.net/core/encryption" + "github.com/0chain/blobber/code/go/0chain.net/core/logging" + . "github.com/0chain/blobber/code/go/0chain.net/core/logging" + "github.com/0chain/blobber/code/go/0chain.net/core/node" + "github.com/0chain/blobber/code/go/0chain.net/core/transaction" + "github.com/0chain/blobber/code/go/0chain.net/core/util" + "github.com/0chain/blobber/code/go/0chain.net/validatorcore/config" + "github.com/0chain/blobber/code/go/0chain.net/validatorcore/storage" "github.com/0chain/gosdk/zcncore" "github.com/gorilla/handlers" diff --git a/code/go/0chain.net/validatorcore/config/config.go b/code/go/0chain.net/validatorcore/config/config.go index 5194a62a4..f6ae4ce8f 100644 --- a/code/go/0chain.net/validatorcore/config/config.go +++ b/code/go/0chain.net/validatorcore/config/config.go @@ -3,7 +3,7 @@ package config import ( "fmt" - "0chain.net/core/config" + "github.com/0chain/blobber/code/go/0chain.net/core/config" "github.com/spf13/viper" ) diff --git a/code/go/0chain.net/validatorcore/storage/challenge_handler.go b/code/go/0chain.net/validatorcore/storage/challenge_handler.go index 528eb6531..ea3a78d01 100644 --- a/code/go/0chain.net/validatorcore/storage/challenge_handler.go +++ b/code/go/0chain.net/validatorcore/storage/challenge_handler.go @@ -8,10 +8,10 @@ import ( "net/http" "time" - "0chain.net/core/cache" - "0chain.net/core/common" - . "0chain.net/core/logging" - "0chain.net/core/node" + "github.com/0chain/blobber/code/go/0chain.net/core/cache" + "github.com/0chain/blobber/code/go/0chain.net/core/common" + . "github.com/0chain/blobber/code/go/0chain.net/core/logging" + "github.com/0chain/blobber/code/go/0chain.net/core/node" "go.uber.org/zap" "golang.org/x/crypto/sha3" diff --git a/code/go/0chain.net/validatorcore/storage/challenge_handler_test.go b/code/go/0chain.net/validatorcore/storage/challenge_handler_test.go index 359d0720d..a4034d394 100644 --- a/code/go/0chain.net/validatorcore/storage/challenge_handler_test.go +++ b/code/go/0chain.net/validatorcore/storage/challenge_handler_test.go @@ -6,8 +6,8 @@ import ( "net/http" "testing" - "0chain.net/core/logging" - "0chain.net/validatorcore/storage" + "github.com/0chain/blobber/code/go/0chain.net/core/logging" + "github.com/0chain/blobber/code/go/0chain.net/validatorcore/storage" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/code/go/0chain.net/validatorcore/storage/context.go b/code/go/0chain.net/validatorcore/storage/context.go index 2a761fe4a..5cfa922c8 100644 --- a/code/go/0chain.net/validatorcore/storage/context.go +++ b/code/go/0chain.net/validatorcore/storage/context.go @@ -4,7 +4,7 @@ import ( "context" "net/http" - "0chain.net/core/common" + "github.com/0chain/blobber/code/go/0chain.net/core/common" ) func SetupContext(handler common.JSONResponderF) common.JSONResponderF { diff --git a/code/go/0chain.net/validatorcore/storage/handler.go b/code/go/0chain.net/validatorcore/storage/handler.go index 6f6e01713..bfa73f0ae 100644 --- a/code/go/0chain.net/validatorcore/storage/handler.go +++ b/code/go/0chain.net/validatorcore/storage/handler.go @@ -6,7 +6,7 @@ import ( "os" "runtime/pprof" - "0chain.net/core/common" + "github.com/0chain/blobber/code/go/0chain.net/core/common" "github.com/gorilla/mux" ) diff --git a/code/go/0chain.net/validatorcore/storage/models.go b/code/go/0chain.net/validatorcore/storage/models.go index e890fabe5..b64296932 100644 --- a/code/go/0chain.net/validatorcore/storage/models.go +++ b/code/go/0chain.net/validatorcore/storage/models.go @@ -8,15 +8,15 @@ import ( "strconv" "strings" - "0chain.net/core/common" - "0chain.net/core/encryption" - "0chain.net/core/node" - "0chain.net/core/util" - "0chain.net/validatorcore/storage/writemarker" + "github.com/0chain/blobber/code/go/0chain.net/core/common" + "github.com/0chain/blobber/code/go/0chain.net/core/encryption" + "github.com/0chain/blobber/code/go/0chain.net/core/node" + "github.com/0chain/blobber/code/go/0chain.net/core/util" + "github.com/0chain/blobber/code/go/0chain.net/validatorcore/storage/writemarker" "github.com/mitchellh/mapstructure" - . "0chain.net/core/logging" + . "github.com/0chain/blobber/code/go/0chain.net/core/logging" "go.uber.org/zap" ) diff --git a/code/go/0chain.net/validatorcore/storage/models_test.go b/code/go/0chain.net/validatorcore/storage/models_test.go index 6a12fbd88..1fb88e24e 100644 --- a/code/go/0chain.net/validatorcore/storage/models_test.go +++ b/code/go/0chain.net/validatorcore/storage/models_test.go @@ -3,11 +3,11 @@ package storage_test import ( "testing" - "0chain.net/core/common" - "0chain.net/core/config" - "0chain.net/core/logging" - "0chain.net/core/node" - "0chain.net/validatorcore/storage" + "github.com/0chain/blobber/code/go/0chain.net/core/common" + "github.com/0chain/blobber/code/go/0chain.net/core/config" + "github.com/0chain/blobber/code/go/0chain.net/core/logging" + "github.com/0chain/blobber/code/go/0chain.net/core/node" + "github.com/0chain/blobber/code/go/0chain.net/validatorcore/storage" "github.com/0chain/gosdk/core/zcncrypto" "github.com/stretchr/testify/assert" diff --git a/code/go/0chain.net/validatorcore/storage/protocol.go b/code/go/0chain.net/validatorcore/storage/protocol.go index cc3ad9924..f9175988b 100644 --- a/code/go/0chain.net/validatorcore/storage/protocol.go +++ b/code/go/0chain.net/validatorcore/storage/protocol.go @@ -6,12 +6,12 @@ import ( "sync" "time" - "0chain.net/core/chain" - "0chain.net/core/common" - . "0chain.net/core/logging" - "0chain.net/core/node" - "0chain.net/core/transaction" - "0chain.net/validatorcore/config" + "github.com/0chain/blobber/code/go/0chain.net/core/chain" + "github.com/0chain/blobber/code/go/0chain.net/core/common" + . "github.com/0chain/blobber/code/go/0chain.net/core/logging" + "github.com/0chain/blobber/code/go/0chain.net/core/node" + "github.com/0chain/blobber/code/go/0chain.net/core/transaction" + "github.com/0chain/blobber/code/go/0chain.net/validatorcore/config" "github.com/0chain/gosdk/zcncore" "go.uber.org/zap" diff --git a/code/go/0chain.net/validatorcore/storage/writemarker/entity.go b/code/go/0chain.net/validatorcore/storage/writemarker/entity.go index 0b44519f4..b5850d1eb 100644 --- a/code/go/0chain.net/validatorcore/storage/writemarker/entity.go +++ b/code/go/0chain.net/validatorcore/storage/writemarker/entity.go @@ -4,8 +4,8 @@ import ( "encoding/hex" "fmt" - "0chain.net/core/common" - "0chain.net/core/encryption" + "github.com/0chain/blobber/code/go/0chain.net/core/common" + "github.com/0chain/blobber/code/go/0chain.net/core/encryption" ) type WriteMarkerEntity struct { diff --git a/code/go/0chain.net/validatorcore/storage/writemarker/entity_test.go b/code/go/0chain.net/validatorcore/storage/writemarker/entity_test.go index bdd4f0283..15b613d76 100644 --- a/code/go/0chain.net/validatorcore/storage/writemarker/entity_test.go +++ b/code/go/0chain.net/validatorcore/storage/writemarker/entity_test.go @@ -4,10 +4,10 @@ import ( "fmt" "testing" - "0chain.net/core/common" - "0chain.net/core/config" - "0chain.net/core/encryption" - "0chain.net/validatorcore/storage/writemarker" + "github.com/0chain/blobber/code/go/0chain.net/core/common" + "github.com/0chain/blobber/code/go/0chain.net/core/config" + "github.com/0chain/blobber/code/go/0chain.net/core/encryption" + "github.com/0chain/blobber/code/go/0chain.net/validatorcore/storage/writemarker" "github.com/0chain/gosdk/core/zcncrypto" "github.com/stretchr/testify/assert" diff --git a/docker.local/Dockerfile b/docker.local/Dockerfile index bcd2320a4..ef7b728b0 100644 --- a/docker.local/Dockerfile +++ b/docker.local/Dockerfile @@ -24,24 +24,29 @@ ENV GO111MODULE=on # Download the dependencies: # Will be cached if we don't change mod/sum files -COPY ./code/go/0chain.net/go.mod ./code/go/0chain.net/go.sum $SRC_DIR/go/0chain.net/ -RUN cd $SRC_DIR/go/0chain.net && go mod download +COPY ./go.mod ./go.sum $SRC_DIR/ +RUN cd $SRC_DIR && go mod download #Add the source code -ADD ./code/go/0chain.net $SRC_DIR/go/0chain.net +ADD ./code/go/0chain.net $SRC_DIR/code/go/0chain.net -WORKDIR $SRC_DIR/go/0chain.net/blobber +WORKDIR $SRC_DIR/code/go/0chain.net/blobber ARG GIT_COMMIT ENV GIT_COMMIT=$GIT_COMMIT -RUN go build -v -tags "bn256 development" -ldflags "-X 0chain.net/core/build.BuildTag=$GIT_COMMIT" +RUN go build -v -tags "bn256 development" -gcflags "all=-N -l" -ldflags "-X 0chain.net/core/build.BuildTag=$GIT_COMMIT" # Copy the build artifact into a minimal runtime image: FROM golang:1.14.9-alpine3.12 -RUN apk add gmp gmp-dev openssl-dev +RUN apk add gmp gmp-dev openssl-dev git COPY --from=blobber_build /usr/local/lib/libmcl*.so \ /usr/local/lib/libbls*.so \ /usr/local/lib/ + +RUN git clone --branch v1.4.1 https://github.com/go-delve/delve +WORKDIR ./delve +RUN go install ./cmd/dlv + ENV APP_DIR=/blobber WORKDIR $APP_DIR -COPY --from=blobber_build $APP_DIR/go/0chain.net/blobber/blobber $APP_DIR/bin/blobber +COPY --from=blobber_build $APP_DIR/code/go/0chain.net/blobber/blobber $APP_DIR/bin/blobber diff --git a/docker.local/ValidatorDockerfile b/docker.local/ValidatorDockerfile index b9fa07c8a..cd5f594a1 100644 --- a/docker.local/ValidatorDockerfile +++ b/docker.local/ValidatorDockerfile @@ -24,13 +24,13 @@ ENV GO111MODULE=on # Download the dependencies: # Will be cached if we don't change mod/sum files -COPY ./code/go/0chain.net/go.mod ./code/go/0chain.net/go.sum $SRC_DIR/go/0chain.net/ -RUN cd $SRC_DIR/go/0chain.net && go mod download +COPY ./go.mod ./go.sum $SRC_DIR/ +RUN cd $SRC_DIR && go mod download #Add the source code -ADD ./code/go/0chain.net $SRC_DIR/go/0chain.net +ADD . $SRC_DIR -WORKDIR $SRC_DIR/go/0chain.net/validator +WORKDIR $SRC_DIR/code/go/0chain.net/validator RUN go build -v -tags "bn256 development" -ldflags "-X 0chain.net/core/build.BuildTag=$GIT_COMMIT" @@ -42,4 +42,4 @@ COPY --from=validator_build /usr/local/lib/libmcl*.so \ /usr/local/lib/ ENV APP_DIR=/blobber WORKDIR $APP_DIR -COPY --from=validator_build $APP_DIR/go/0chain.net/validator/validator $APP_DIR/bin/validator +COPY --from=validator_build $APP_DIR/code/go/0chain.net/validator/validator $APP_DIR/bin/validator diff --git a/docker.local/b0docker-compose-debug.yml b/docker.local/b0docker-compose-debug.yml new file mode 100644 index 000000000..d185d0b3d --- /dev/null +++ b/docker.local/b0docker-compose-debug.yml @@ -0,0 +1,83 @@ +version: "3" +services: + postgres: + image: postgres:11 + environment: + POSTGRES_PORT: 5432 + POSTGRES_HOST: postgres + POSTGRES_USER: postgres + POSTGRES_HOST_AUTH_METHOD: trust + ports: + - "5432:5432" + volumes: + - ./blobber${BLOBBER}/data/postgresql:/var/lib/postgresql/data + networks: + default: + postgres-post: + image: postgres:11 + environment: + POSTGRES_PORT: 5432 + POSTGRES_HOST: postgres + POSTGRES_USER: postgres + volumes: + - ../bin:/blobber/bin + - ../sql:/blobber/sql + command: bash /blobber/bin/postgres-entrypoint.sh + links: + - postgres:postgres + validator: + image: validator + environment: + - DOCKER= true + depends_on: + - postgres-post + links: + - postgres-post:postgres-post + volumes: + - ../config:/blobber/config + - ./blobber${BLOBBER}/data:/blobber/data + - ./blobber${BLOBBER}/log:/blobber/log + - ./keys_config:/blobber/keysconfig + ports: + - "506${BLOBBER}:506${BLOBBER}" + command: ./bin/validator --port 506${BLOBBER} --hostname 198.18.0.6${BLOBBER} --deployment_mode 0 --keys_file keysconfig/b0bnode${BLOBBER}_keys.txt --log_dir /blobber/log + networks: + default: + testnet0: + ipv4_address: 198.18.0.6${BLOBBER} + + blobber: + image: blobber + environment: + - DOCKER= true + depends_on: + - validator + links: + - validator:validator + volumes: + - ../config:/blobber/config + - ./blobber${BLOBBER}/files:/blobber/files + - ./blobber${BLOBBER}/data:/blobber/data + - ./blobber${BLOBBER}/log:/blobber/log + - ./keys_config:/blobber/keysconfig + - ./blobber${BLOBBER}/data/tmp:/tmp + ports: + - "505${BLOBBER}:505${BLOBBER}" + - "3150${BLOBBER}:3150${BLOBBER}" + - "236${BLOBBER}:236${BLOBBER}" + command: dlv --listen=:236${BLOBBER} --headless=true --api-version=2 --accept-multiclient exec ./bin/blobber -- --port 505${BLOBBER} --grpc_port 3150${BLOBBER} --hostname localhost --deployment_mode 0 --keys_file keysconfig/b0bnode${BLOBBER}_keys.txt --files_dir /blobber/files --log_dir /blobber/log --db_dir /blobber/data --minio_file keysconfig/minio_config.txt + networks: + default: + testnet0: + ipv4_address: 198.18.0.9${BLOBBER} + +networks: + default: + driver: bridge + testnet0: + external: true + +volumes: + data: + config: + bin: diff --git a/docker.local/b0docker-compose.yml b/docker.local/b0docker-compose.yml index af8ba85c1..c574276b3 100644 --- a/docker.local/b0docker-compose.yml +++ b/docker.local/b0docker-compose.yml @@ -7,6 +7,8 @@ services: POSTGRES_HOST: postgres POSTGRES_USER: postgres POSTGRES_HOST_AUTH_METHOD: trust + ports: + - "5432:5432" volumes: - ./blobber${BLOBBER}/data/postgresql:/var/lib/postgresql/data networks: @@ -61,8 +63,8 @@ services: - ./blobber${BLOBBER}/data/tmp:/tmp ports: - "505${BLOBBER}:505${BLOBBER}" - - "703${BLOBBER}:703${BLOBBER}" - command: ./bin/blobber --port 505${BLOBBER} --grpc_port 703${BLOBBER} --hostname 198.18.0.9${BLOBBER} --deployment_mode 0 --keys_file keysconfig/b0bnode${BLOBBER}_keys.txt --files_dir /blobber/files --log_dir /blobber/log --db_dir /blobber/data --minio_file keysconfig/minio_config.txt + - "3150${BLOBBER}:3150${BLOBBER}" + command: ./bin/blobber --port 505${BLOBBER} --grpc_port 3150${BLOBBER} --hostname 198.18.0.9${BLOBBER} --deployment_mode 0 --keys_file keysconfig/b0bnode${BLOBBER}_keys.txt --files_dir /blobber/files --log_dir /blobber/log --db_dir /blobber/data --minio_file keysconfig/minio_config.txt networks: default: testnet0: diff --git a/docker.local/bin/blobber.start_bls.sh b/docker.local/bin/blobber.start_bls.sh index f3686577b..4aba602ee 100755 --- a/docker.local/bin/blobber.start_bls.sh +++ b/docker.local/bin/blobber.start_bls.sh @@ -1,11 +1,15 @@ -#!/bin/sh +#!/bin/bash +set -e + PWD=`pwd` BLOBBER_DIR=`basename $PWD` BLOBBER_ID=`echo my directory $BLOBBER_DIR | sed -e 's/.*\(.\)$/\1/'` - -echo Starting blobber$BLOBBER_ID ... - -# echo blobber$i - -BLOBBER=$BLOBBER_ID docker-compose -p blobber$BLOBBER_ID -f ../b0docker-compose.yml up +if [[ "$*" == *"--debug"* ]] +then + echo Starting blobber$BLOBBER_ID in debug mode... + BLOBBER=$BLOBBER_ID docker-compose -p blobber$BLOBBER_ID -f ../b0docker-compose-debug.yml up +else + echo Starting blobber$BLOBBER_ID ... + BLOBBER=$BLOBBER_ID docker-compose -p blobber$BLOBBER_ID -f ../b0docker-compose.yml up +fi \ No newline at end of file diff --git a/code/go/0chain.net/go.mod b/go.mod similarity index 81% rename from code/go/0chain.net/go.mod rename to go.mod index 8bdf88b70..d2f2fdee8 100644 --- a/code/go/0chain.net/go.mod +++ b/go.mod @@ -1,21 +1,24 @@ -module 0chain.net +module github.com/0chain/blobber require ( github.com/0chain/gosdk v1.1.6 github.com/DATA-DOG/go-sqlmock v1.5.0 + github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f // indirect github.com/didip/tollbooth v4.0.2+incompatible github.com/go-ini/ini v1.55.0 // indirect github.com/gorilla/handlers v1.4.2 github.com/gorilla/mux v1.7.3 github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 github.com/grpc-ecosystem/grpc-gateway/v2 v2.3.0 - github.com/herumi/bls-go-binary v0.0.0-20191119080710-898950e1a520 // indirect + github.com/herumi/bls-go-binary v0.0.0-20191119080710-898950e1a520 + github.com/improbable-eng/grpc-web v0.14.0 // indirect github.com/jackc/pgproto3/v2 v2.0.4 // indirect github.com/koding/cache v0.0.0-20161222233015-e8a81b0b3f20 github.com/minio/minio-go v6.0.14+incompatible github.com/mitchellh/mapstructure v1.3.1 github.com/patrickmn/go-cache v2.1.0+incompatible // indirect github.com/remeh/sizedwaitgroup v0.0.0-20180822144253-5e7302b12cce + github.com/rs/cors v1.8.0 // indirect github.com/spf13/viper v1.7.0 github.com/stretchr/testify v1.7.0 go.uber.org/ratelimit v0.2.0 @@ -23,6 +26,7 @@ require ( golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a google.golang.org/genproto v0.0.0-20210224155714-063164c882e6 google.golang.org/grpc v1.36.0 + google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.0.0 google.golang.org/protobuf v1.26.0 gopkg.in/ini.v1 v1.61.0 // indirect gopkg.in/mgo.v2 v2.0.0-20180705113604-9856a29383ce // indirect @@ -30,6 +34,7 @@ require ( gorm.io/datatypes v0.0.0-20200806042100-bc394008dd0d gorm.io/driver/postgres v1.0.0 gorm.io/gorm v1.20.4 + nhooyr.io/websocket v1.8.7 // indirect ) go 1.13 diff --git a/code/go/0chain.net/go.sum b/go.sum similarity index 95% rename from code/go/0chain.net/go.sum rename to go.sum index a0ecd3327..9f457be40 100644 --- a/code/go/0chain.net/go.sum +++ b/go.sum @@ -81,6 +81,8 @@ 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/denisenkom/go-mssqldb v0.0.0-20200428022330-06a60b6afbbc h1:VRRKCwnzqk8QCaRC4os14xoKDdbHqqlJtJA0oc1ZAjg= github.com/denisenkom/go-mssqldb v0.0.0-20200428022330-06a60b6afbbc/go.mod h1:xbL0rPBG9cCiLr28tMa8zpbdarY27NDyej4t/EjAShU= +github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f h1:U5y3Y5UE0w7amNe7Z5G/twsBW0KEalRQXZzf8ufSh9I= +github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f/go.mod h1:xH/i4TFMt8koVQZ6WFms69WAsDWr2XsYL3Hkl7jkoLE= github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= github.com/didip/tollbooth v4.0.2+incompatible h1:fVSa33JzSz0hoh2NxpwZtksAzAgd7zjmGO20HCZtF4M= @@ -94,7 +96,11 @@ github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5Kwzbycv github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/gedex/inflector v0.0.0-20170307190818-16278e9db813/go.mod h1:P+oSoE9yhSRvsmYyZsshflcR6ePWYLql6UU1amW13IM= +github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= +github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI= +github.com/gin-gonic/gin v1.5.0/go.mod h1:Nd6IXA8m5kNZdNEHMBd93KT+mdY3+bewLgRvmCsR2Do= +github.com/gin-gonic/gin v1.6.3/go.mod h1:75u5sXoLsGZoRN5Sgbi1eraJ4GU3++wFwWzhwvtwp4M= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= @@ -104,9 +110,18 @@ github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2 github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= +github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= +github.com/go-playground/locales v0.12.1/go.mod h1:IUMDtCfWo/w/mtMfIE/IG2K+Ey3ygWanZIBtBW0W2TM= +github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8= +github.com/go-playground/universal-translator v0.16.0/go.mod h1:1AnU7NaIRDWWzGEKwgtJRd2xk99HeFyHw3yid4rvQIY= +github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA= +github.com/go-playground/validator/v10 v10.2.0/go.mod h1:uOYAAleCW8F/7oMFd6aG0GOhaH6EGOAJShg8Id5JGkI= github.com/go-sql-driver/mysql v1.5.0 h1:ozyZYNQW3x3HtqT1jira07DN2PArx2v7/mN66gGcHOs= github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee/go.mod h1:L0fX3K22YWvt/FAX9NnzrNzcI4wNYi9Yku4O0LKYflo= +github.com/gobwas/pool v0.2.0/go.mod h1:q8bcK0KcYlCgd9e7WYLm9LpyS+YeLd8JVDW6WezmKEw= +github.com/gobwas/ws v1.0.2/go.mod h1:szmBTxLgaFppYjEmNtny/v3w89xOydFnnZMcgRRu/EM= github.com/gofrs/flock v0.8.0/go.mod h1:F1TvTiK9OcQqauNUHlbJvyl9Qa1QvF/gOUDKA14jxHU= github.com/gofrs/uuid v3.2.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= github.com/gofrs/uuid v4.0.0+incompatible h1:1SD/1F5pU8p29ybwgQSwpQk+mwdRrXCYuPhW6m+TnJw= @@ -159,6 +174,7 @@ github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= @@ -179,6 +195,7 @@ github.com/gorilla/handlers v1.4.2 h1:0QniY0USkHQ1RGCLfKxeNHK9bkDHGRYGNDFBCS+YAR github.com/gorilla/handlers v1.4.2/go.mod h1:Qkdc/uu4tH4g6mTK6auzZ766c4CA0Ng8+o/OAirnOIQ= github.com/gorilla/mux v1.7.3 h1:gnP5JzjVOuiZD07fKKToCAOjS0yOpj/qPETTXCCS6hw= github.com/gorilla/mux v1.7.3/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= +github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 h1:+9834+KizmvFV7pXQGSXQTsaWhq2GjuNUt0aUU0YBYw= @@ -215,6 +232,8 @@ github.com/herumi/bls-go-binary v0.0.0-20191119080710-898950e1a520 h1:3ek8BJos3J github.com/herumi/bls-go-binary v0.0.0-20191119080710-898950e1a520/go.mod h1:uTBfU/n3h1aOYIl5nNTbLn5dUfNkF1P97JTaz3bdvro= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/idubinskiy/schematyper v0.0.0-20190118213059-f71b40dac30d/go.mod h1:xVHEhsiSJJnT0jlcQpQUg+GyoLf0i0xciM1kqWTGT58= +github.com/improbable-eng/grpc-web v0.14.0 h1:GdoK+cXABdB+1keuqsV1drSFO2XLYIxqt/4Rj8SWGBk= +github.com/improbable-eng/grpc-web v0.14.0/go.mod h1:6hRR09jOEG81ADP5wCQju1z71g6OL4eEvELdran/3cs= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/jackc/chunkreader v1.0.0 h1:4s39bBR8ByfqH+DKm8rQA3E1LHZWB9XWcrz8fqaZbe0= github.com/jackc/chunkreader v1.0.0/go.mod h1:RT6O25fNZIuasFJRyZ4R/Y2BbhasbmZXF9QQ7T3kePo= @@ -278,6 +297,8 @@ github.com/jinzhu/now v1.1.1 h1:g39TucaRWyV3dwDO++eEc6qf8TVIQ/Da48WmqjZ3i7E= github.com/jinzhu/now v1.1.1/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8= github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= +github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo= @@ -286,6 +307,8 @@ github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7V github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= 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.10.3/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= +github.com/klauspost/compress v1.11.7 h1:0hzRabrMN4tSTvMfnL3SCv1ZGeAP23ynzodBgaHeMeg= github.com/klauspost/compress v1.11.7/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= github.com/klauspost/cpuid v1.2.0 h1:NMpwD2G9JSFOE1/TJjGSo5zG7Yb2bTe7eq1jH+irmeE= github.com/klauspost/cpuid v1.2.0/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= @@ -303,6 +326,8 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/pty v1.1.8/go.mod h1:O1sed60cT9XZ5uDucP5qwvh+TE3NnUj51EiZO/lmSfw= github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/leodido/go-urn v1.1.0/go.mod h1:+cyI34gQWZcE1eQU7NVgKkkzdXDQHr1dBMtdAPozLkw= +github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII= github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/lib/pq v1.1.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= @@ -334,11 +359,12 @@ github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eI github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS42BGNg= github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY= github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= -github.com/mitchellh/mapstructure v1.1.2 h1:fmNYVwqnSfB9mZU6OS2O6GsXM+wcskZDuKQzvN1EDeE= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/mitchellh/mapstructure v1.3.1 h1:cCBH2gTD2K0OtLlv/Y5H01VQCqmlDxz30kS5Y5bqfLA= github.com/mitchellh/mapstructure v1.3.1/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/nishanths/predeclared v0.0.0-20200524104333-86fad755b4d3/go.mod h1:nt3d53pc1VYcphSCIaYAJtnPYnr3Zyn8fMq2wvPGPso= @@ -350,7 +376,6 @@ github.com/patrickmn/go-cache v2.1.0+incompatible/go.mod h1:3Qf8kWWT7OJRJbdiICTK github.com/pelletier/go-toml v1.2.0 h1:T5zMGML61Wp+FlcbWjRDT7yAxhJNAiPPLOFECq181zc= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= @@ -373,6 +398,8 @@ github.com/remeh/sizedwaitgroup v0.0.0-20180822144253-5e7302b12cce/go.mod h1:3j2 github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +github.com/rs/cors v1.8.0 h1:P2KMzcFwrPoSjkF1WLRPsp3UMLyql8L4v9hQpVeK5so= +github.com/rs/cors v1.8.0/go.mod h1:EBwu+T5AvHOcXwvZIkQFjUN6s8Czyqw12GL/Y0tUyRM= github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ= github.com/rs/zerolog v1.13.0/go.mod h1:YbFCdg8HfsridGWAh22vktObvhZbQsZXe4/zB0OKkWU= github.com/rs/zerolog v1.15.0/go.mod h1:xYTKnLHcpfU2225ny5qZjxnj9NvkumZYjJHlAThCjNc= @@ -400,7 +427,6 @@ github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkU github.com/spf13/cobra v1.0.1-0.20201006035406-b97b5ead31f7/go.mod h1:yk5b0mALVusDL5fMM6Rd1wgnoO5jUPhwsQ6LQAJTidQ= github.com/spf13/jwalterweatherman v1.0.0 h1:XHEdyB+EcvlqZamSM4ZOMGlc93t6AcsBEu9Gc1vn7yk= github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= -github.com/spf13/pflag v1.0.3 h1:zPAT6CGy6wXeQ7NtTnaTerfKOsV6V6F8agHXFiazDkg= github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= @@ -408,11 +434,9 @@ github.com/spf13/viper v1.7.0 h1:xVKxvI7ouOI5I+U9s2eeiUfMaWBVoXA3AWskkrqK0VM= github.com/spf13/viper v1.7.0/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.2.0 h1:Hbg2NidpLE8veEBkEZTL3CvlkUIVzuU9jDplZO54c48= github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= @@ -424,6 +448,8 @@ github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1 github.com/twitchtv/twirp v7.1.0+incompatible/go.mod h1:RRJoFSAmTEh2weEqWtpPE3vFK5YBhA6bqp2l1kfCC5A= github.com/tyler-smith/go-bip39 v1.0.0 h1:FOHg9gaQLeBBRbHE/QrTLfEiBHy5pQ/yXzf9JG5pYFM= github.com/tyler-smith/go-bip39 v1.0.0/go.mod h1:sJ5fKU0s6JVwZjjcUEX2zFOnvq0ASQ2K9Zr6cf67kNs= +github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw= +github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY= github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= @@ -446,22 +472,18 @@ go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.6/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E= go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= -go.uber.org/atomic v1.6.0 h1:Ezj3JGmsOnG1MoRWQkPBsKLe9DwWD9QeXzTRzzldNVk= go.uber.org/atomic v1.6.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= go.uber.org/atomic v1.7.0 h1:ADUqmZGgLDDfbSL9ZmPxKTybcoEYHgpYfELNoN+7hsw= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= -go.uber.org/multierr v1.5.0 h1:KCa4XfM8CWFCpxXRGok+Q0SS/0XBhMDbHHGABQLvD2A= go.uber.org/multierr v1.5.0/go.mod h1:FeouvMocqHpRaaGuG9EjoKcStLC43Zu/fmqdUMPcKYU= go.uber.org/multierr v1.6.0 h1:y6IPFStTAIT5Ytl7/XYmHvzXQ7S3g/IeZW9hyZ5thw4= go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= go.uber.org/ratelimit v0.2.0 h1:UQE2Bgi7p2B85uP5dC2bbRtig0C+OeNRnNEafLjsLPA= go.uber.org/ratelimit v0.2.0/go.mod h1:YYBV4e4naJvhpitQrWJu1vCpgB7CboMe0qhltKt6mUg= -go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee h1:0mgffUl7nfd+FpvXMVz4IDEaUSmT1ysygQC7qYo7sG4= go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9Ejo0C68/HhF8uaILCdgjnY+goOA= go.uber.org/zap v1.9.1/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= -go.uber.org/zap v1.15.0 h1:ZZCA22JRF2gQE5FoNmhmrf7jeJJ2uhqDUNRYKm8dvmM= go.uber.org/zap v1.15.0/go.mod h1:Mb2vm2krFEG5DV0W9qcHBYFtp/Wku1cvYaqPsS/WYfc= go.uber.org/zap v1.16.0 h1:uFRZXykJGK9lLY4HtgSw44DnIcAM+kRBP7x5m+NpAOM= go.uber.org/zap v1.16.0/go.mod h1:MA8QOfq0BHJwdXa996Y4dYkAqRKB8/1K1QMMZVaNZjQ= @@ -475,7 +497,6 @@ golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8U golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190911031432-227b76d455e7/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550 h1:ObdrDkeb4kJdCP557AjRjq69pTHfNouLtWZG7j9rPN8= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200323165209-0ec3e9974c59/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= @@ -500,7 +521,6 @@ golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTk golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190930215403-16217165b5de h1:5hukYrvBGR8/eNkX5mdUezrA6JiaEZDtJb9Ei+1LlBs= golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs= golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= @@ -513,7 +533,6 @@ golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKG golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= -golang.org/x/mod v0.1.1-0.20191209134235-331c550502dd h1:ePuNC7PZ6O5BzgPn9bZayERXBdfZjUYoXEf5BTfDfh8= golang.org/x/mod v0.1.1-0.20191209134235-331c550502dd/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0 h1:RM4zey1++hCTbCVQfnWeKs9/IEsaBLA8vTkd0WVtmH4= @@ -614,7 +633,6 @@ golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9sn golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= 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.3.5 h1:i6eZZ+zk0SOf0xgBpEpPD18qWcJda6q1sxt3S0kzyUQ= @@ -657,7 +675,6 @@ golang.org/x/tools v0.0.0-20200117161641-43d50277825c/go.mod h1:TB2adYChydJhpapK golang.org/x/tools v0.0.0-20200122220014-bf1340f18c4a/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200204074204-1cc6d1ef6c74/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa h1:5E4dL8+NgFOgjwbTKz+OOEGGhP+ectTmF842l6KjupQ= golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200212150539-ea181f53ac56/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200224181240-023911ca70b2/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= @@ -681,7 +698,6 @@ golang.org/x/xerrors v0.0.0-20190410155217-1f06c39b4373/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20190513163551-3ee3066db522/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= 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 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= 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= @@ -756,6 +772,7 @@ google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv google.golang.org/grpc v1.35.0-dev.0.20201218190559-666aea1fb34c/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.36.0 h1:o1bcQ6imQMIOpdrO3SWf2z5RV72WbDwdXuK0MDlc8As= google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= +google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.0.0 h1:lQ+dE99pFsb8osbJB3oRfE5eW4Hx6a/lZQr8Jh+eoT4= google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.0.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= 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= @@ -777,8 +794,9 @@ gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8 gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= +gopkg.in/go-playground/assert.v1 v1.2.1/go.mod h1:9RXL0bg/zibRAgZUYszZSwO/z8Y/a8bDuhia5mkpMnE= +gopkg.in/go-playground/validator.v9 v9.29.1/go.mod h1:+c9/zcJMFNgbLvly1L1V+PpxWdVbfP1avr/N00E2vyQ= gopkg.in/inconshreveable/log15.v2 v2.0.0-20180818164646-67afb5ed74ec/go.mod h1:aPpfJ7XW+gOuirDoZ8gHhLh3kZ1B08FtV2bbmy7Jv3s= -gopkg.in/ini.v1 v1.51.0 h1:AQvPpx3LzTDM0AjnIRlVFwFFGC+npRopjZxLJj6gdno= gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/ini.v1 v1.61.0 h1:LBCdW4FmFYL4s/vDZD1RQYX7oAR6IjujCYgMdbHBR10= gopkg.in/ini.v1 v1.61.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= @@ -790,8 +808,8 @@ gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.4 h1:/eiJrUcujPVeJ3xlSWaiNi3uSVmDGBK1pDHUHAnao1I= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= @@ -818,11 +836,12 @@ honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWh honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.1-2019.2.3 h1:3JgtbtFHMiCmsznwGVTUWbgGov+pVqnlf1dEJTNAXeM= honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= honnef.co/go/tools v0.0.1-2020.1.4 h1:UoveltGrhghAA7ePc+e+QYDHXrBps2PqFZiHkGR/xK8= honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= +nhooyr.io/websocket v1.8.7 h1:usjR2uOr/zjjkVMy0lW+PPohFok7PCow5sDjLgX4P4g= +nhooyr.io/websocket v1.8.7/go.mod h1:B70DZP8IakI65RVQ51MsWP/8jndNma26DVA/nFSCgW0= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= diff --git a/scripts/generate-grpc.sh b/scripts/generate-grpc.sh new file mode 100755 index 000000000..c03fa71a1 --- /dev/null +++ b/scripts/generate-grpc.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +protoc -I ./code/go/0chain.net/blobbercore/blobbergrpc/proto --go-grpc_out=. --go_out=. --grpc-gateway_out=allow_delete_body=true:. --openapiv2_opt allow_delete_body=true --openapiv2_out=./code/go/0chain.net/blobbercore/openapi ./code/go/0chain.net/blobbercore/blobbergrpc/proto/blobber.proto \ No newline at end of file