Step 9: Proto definitions and gRPC code generation.
Define GardenSync service with 5 RPCs: PushManifest, PushBlobs, PullManifest, PullBlobs, Prune. Messages for manifest, entries, blob chunks (64 KiB streaming), and push/pull protocol flow. Generated Go code in sgardpb/. Added Makefile proto target, gRPC + protobuf + x/crypto deps, protoc tools to flake devShell. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
870
sgardpb/sgard.pb.go
Normal file
870
sgardpb/sgard.pb.go
Normal file
@@ -0,0 +1,870 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.36.10
|
||||
// protoc v6.32.1
|
||||
// source: sgard/v1/sgard.proto
|
||||
|
||||
package sgardpb
|
||||
|
||||
import (
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
timestamppb "google.golang.org/protobuf/types/known/timestamppb"
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
unsafe "unsafe"
|
||||
)
|
||||
|
||||
const (
|
||||
// Verify that this generated code is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
||||
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||
)
|
||||
|
||||
type PushManifestResponse_Decision int32
|
||||
|
||||
const (
|
||||
PushManifestResponse_DECISION_UNSPECIFIED PushManifestResponse_Decision = 0
|
||||
PushManifestResponse_ACCEPTED PushManifestResponse_Decision = 1 // server is older; push proceeds
|
||||
PushManifestResponse_REJECTED PushManifestResponse_Decision = 2 // server is newer; client should pull
|
||||
PushManifestResponse_UP_TO_DATE PushManifestResponse_Decision = 3 // timestamps match; nothing to do
|
||||
)
|
||||
|
||||
// Enum value maps for PushManifestResponse_Decision.
|
||||
var (
|
||||
PushManifestResponse_Decision_name = map[int32]string{
|
||||
0: "DECISION_UNSPECIFIED",
|
||||
1: "ACCEPTED",
|
||||
2: "REJECTED",
|
||||
3: "UP_TO_DATE",
|
||||
}
|
||||
PushManifestResponse_Decision_value = map[string]int32{
|
||||
"DECISION_UNSPECIFIED": 0,
|
||||
"ACCEPTED": 1,
|
||||
"REJECTED": 2,
|
||||
"UP_TO_DATE": 3,
|
||||
}
|
||||
)
|
||||
|
||||
func (x PushManifestResponse_Decision) Enum() *PushManifestResponse_Decision {
|
||||
p := new(PushManifestResponse_Decision)
|
||||
*p = x
|
||||
return p
|
||||
}
|
||||
|
||||
func (x PushManifestResponse_Decision) String() string {
|
||||
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
|
||||
}
|
||||
|
||||
func (PushManifestResponse_Decision) Descriptor() protoreflect.EnumDescriptor {
|
||||
return file_sgard_v1_sgard_proto_enumTypes[0].Descriptor()
|
||||
}
|
||||
|
||||
func (PushManifestResponse_Decision) Type() protoreflect.EnumType {
|
||||
return &file_sgard_v1_sgard_proto_enumTypes[0]
|
||||
}
|
||||
|
||||
func (x PushManifestResponse_Decision) Number() protoreflect.EnumNumber {
|
||||
return protoreflect.EnumNumber(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use PushManifestResponse_Decision.Descriptor instead.
|
||||
func (PushManifestResponse_Decision) EnumDescriptor() ([]byte, []int) {
|
||||
return file_sgard_v1_sgard_proto_rawDescGZIP(), []int{4, 0}
|
||||
}
|
||||
|
||||
// ManifestEntry mirrors manifest.Entry from the YAML model.
|
||||
type ManifestEntry struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Path string `protobuf:"bytes,1,opt,name=path,proto3" json:"path,omitempty"`
|
||||
Hash string `protobuf:"bytes,2,opt,name=hash,proto3" json:"hash,omitempty"`
|
||||
Type string `protobuf:"bytes,3,opt,name=type,proto3" json:"type,omitempty"` // "file", "directory", "link"
|
||||
Mode string `protobuf:"bytes,4,opt,name=mode,proto3" json:"mode,omitempty"`
|
||||
Target string `protobuf:"bytes,5,opt,name=target,proto3" json:"target,omitempty"`
|
||||
Updated *timestamppb.Timestamp `protobuf:"bytes,6,opt,name=updated,proto3" json:"updated,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *ManifestEntry) Reset() {
|
||||
*x = ManifestEntry{}
|
||||
mi := &file_sgard_v1_sgard_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *ManifestEntry) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*ManifestEntry) ProtoMessage() {}
|
||||
|
||||
func (x *ManifestEntry) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_sgard_v1_sgard_proto_msgTypes[0]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use ManifestEntry.ProtoReflect.Descriptor instead.
|
||||
func (*ManifestEntry) Descriptor() ([]byte, []int) {
|
||||
return file_sgard_v1_sgard_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *ManifestEntry) GetPath() string {
|
||||
if x != nil {
|
||||
return x.Path
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *ManifestEntry) GetHash() string {
|
||||
if x != nil {
|
||||
return x.Hash
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *ManifestEntry) GetType() string {
|
||||
if x != nil {
|
||||
return x.Type
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *ManifestEntry) GetMode() string {
|
||||
if x != nil {
|
||||
return x.Mode
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *ManifestEntry) GetTarget() string {
|
||||
if x != nil {
|
||||
return x.Target
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *ManifestEntry) GetUpdated() *timestamppb.Timestamp {
|
||||
if x != nil {
|
||||
return x.Updated
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Manifest mirrors the top-level manifest.Manifest.
|
||||
type Manifest struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Version int32 `protobuf:"varint,1,opt,name=version,proto3" json:"version,omitempty"`
|
||||
Created *timestamppb.Timestamp `protobuf:"bytes,2,opt,name=created,proto3" json:"created,omitempty"`
|
||||
Updated *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=updated,proto3" json:"updated,omitempty"`
|
||||
Message string `protobuf:"bytes,4,opt,name=message,proto3" json:"message,omitempty"`
|
||||
Files []*ManifestEntry `protobuf:"bytes,5,rep,name=files,proto3" json:"files,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *Manifest) Reset() {
|
||||
*x = Manifest{}
|
||||
mi := &file_sgard_v1_sgard_proto_msgTypes[1]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *Manifest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*Manifest) ProtoMessage() {}
|
||||
|
||||
func (x *Manifest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_sgard_v1_sgard_proto_msgTypes[1]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use Manifest.ProtoReflect.Descriptor instead.
|
||||
func (*Manifest) Descriptor() ([]byte, []int) {
|
||||
return file_sgard_v1_sgard_proto_rawDescGZIP(), []int{1}
|
||||
}
|
||||
|
||||
func (x *Manifest) GetVersion() int32 {
|
||||
if x != nil {
|
||||
return x.Version
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *Manifest) GetCreated() *timestamppb.Timestamp {
|
||||
if x != nil {
|
||||
return x.Created
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *Manifest) GetUpdated() *timestamppb.Timestamp {
|
||||
if x != nil {
|
||||
return x.Updated
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *Manifest) GetMessage() string {
|
||||
if x != nil {
|
||||
return x.Message
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *Manifest) GetFiles() []*ManifestEntry {
|
||||
if x != nil {
|
||||
return x.Files
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// BlobChunk is one piece of a streamed blob. The first chunk for a given
|
||||
// hash carries the hash field; subsequent chunks omit it.
|
||||
type BlobChunk struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Hash string `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"` // SHA-256 hex, present on the first chunk of each blob
|
||||
Data []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"` // up to 64 KiB per chunk
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *BlobChunk) Reset() {
|
||||
*x = BlobChunk{}
|
||||
mi := &file_sgard_v1_sgard_proto_msgTypes[2]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *BlobChunk) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*BlobChunk) ProtoMessage() {}
|
||||
|
||||
func (x *BlobChunk) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_sgard_v1_sgard_proto_msgTypes[2]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use BlobChunk.ProtoReflect.Descriptor instead.
|
||||
func (*BlobChunk) Descriptor() ([]byte, []int) {
|
||||
return file_sgard_v1_sgard_proto_rawDescGZIP(), []int{2}
|
||||
}
|
||||
|
||||
func (x *BlobChunk) GetHash() string {
|
||||
if x != nil {
|
||||
return x.Hash
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *BlobChunk) GetData() []byte {
|
||||
if x != nil {
|
||||
return x.Data
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type PushManifestRequest struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Manifest *Manifest `protobuf:"bytes,1,opt,name=manifest,proto3" json:"manifest,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *PushManifestRequest) Reset() {
|
||||
*x = PushManifestRequest{}
|
||||
mi := &file_sgard_v1_sgard_proto_msgTypes[3]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *PushManifestRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*PushManifestRequest) ProtoMessage() {}
|
||||
|
||||
func (x *PushManifestRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_sgard_v1_sgard_proto_msgTypes[3]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use PushManifestRequest.ProtoReflect.Descriptor instead.
|
||||
func (*PushManifestRequest) Descriptor() ([]byte, []int) {
|
||||
return file_sgard_v1_sgard_proto_rawDescGZIP(), []int{3}
|
||||
}
|
||||
|
||||
func (x *PushManifestRequest) GetManifest() *Manifest {
|
||||
if x != nil {
|
||||
return x.Manifest
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type PushManifestResponse struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Decision PushManifestResponse_Decision `protobuf:"varint,1,opt,name=decision,proto3,enum=sgard.v1.PushManifestResponse_Decision" json:"decision,omitempty"`
|
||||
MissingBlobs []string `protobuf:"bytes,2,rep,name=missing_blobs,json=missingBlobs,proto3" json:"missing_blobs,omitempty"` // hashes the server needs
|
||||
ServerUpdated *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=server_updated,json=serverUpdated,proto3" json:"server_updated,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *PushManifestResponse) Reset() {
|
||||
*x = PushManifestResponse{}
|
||||
mi := &file_sgard_v1_sgard_proto_msgTypes[4]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *PushManifestResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*PushManifestResponse) ProtoMessage() {}
|
||||
|
||||
func (x *PushManifestResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_sgard_v1_sgard_proto_msgTypes[4]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use PushManifestResponse.ProtoReflect.Descriptor instead.
|
||||
func (*PushManifestResponse) Descriptor() ([]byte, []int) {
|
||||
return file_sgard_v1_sgard_proto_rawDescGZIP(), []int{4}
|
||||
}
|
||||
|
||||
func (x *PushManifestResponse) GetDecision() PushManifestResponse_Decision {
|
||||
if x != nil {
|
||||
return x.Decision
|
||||
}
|
||||
return PushManifestResponse_DECISION_UNSPECIFIED
|
||||
}
|
||||
|
||||
func (x *PushManifestResponse) GetMissingBlobs() []string {
|
||||
if x != nil {
|
||||
return x.MissingBlobs
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *PushManifestResponse) GetServerUpdated() *timestamppb.Timestamp {
|
||||
if x != nil {
|
||||
return x.ServerUpdated
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type PushBlobsRequest struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Chunk *BlobChunk `protobuf:"bytes,1,opt,name=chunk,proto3" json:"chunk,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *PushBlobsRequest) Reset() {
|
||||
*x = PushBlobsRequest{}
|
||||
mi := &file_sgard_v1_sgard_proto_msgTypes[5]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *PushBlobsRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*PushBlobsRequest) ProtoMessage() {}
|
||||
|
||||
func (x *PushBlobsRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_sgard_v1_sgard_proto_msgTypes[5]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use PushBlobsRequest.ProtoReflect.Descriptor instead.
|
||||
func (*PushBlobsRequest) Descriptor() ([]byte, []int) {
|
||||
return file_sgard_v1_sgard_proto_rawDescGZIP(), []int{5}
|
||||
}
|
||||
|
||||
func (x *PushBlobsRequest) GetChunk() *BlobChunk {
|
||||
if x != nil {
|
||||
return x.Chunk
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type PushBlobsResponse struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
BlobsReceived int32 `protobuf:"varint,1,opt,name=blobs_received,json=blobsReceived,proto3" json:"blobs_received,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *PushBlobsResponse) Reset() {
|
||||
*x = PushBlobsResponse{}
|
||||
mi := &file_sgard_v1_sgard_proto_msgTypes[6]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *PushBlobsResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*PushBlobsResponse) ProtoMessage() {}
|
||||
|
||||
func (x *PushBlobsResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_sgard_v1_sgard_proto_msgTypes[6]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use PushBlobsResponse.ProtoReflect.Descriptor instead.
|
||||
func (*PushBlobsResponse) Descriptor() ([]byte, []int) {
|
||||
return file_sgard_v1_sgard_proto_rawDescGZIP(), []int{6}
|
||||
}
|
||||
|
||||
func (x *PushBlobsResponse) GetBlobsReceived() int32 {
|
||||
if x != nil {
|
||||
return x.BlobsReceived
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
type PullManifestRequest struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *PullManifestRequest) Reset() {
|
||||
*x = PullManifestRequest{}
|
||||
mi := &file_sgard_v1_sgard_proto_msgTypes[7]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *PullManifestRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*PullManifestRequest) ProtoMessage() {}
|
||||
|
||||
func (x *PullManifestRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_sgard_v1_sgard_proto_msgTypes[7]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use PullManifestRequest.ProtoReflect.Descriptor instead.
|
||||
func (*PullManifestRequest) Descriptor() ([]byte, []int) {
|
||||
return file_sgard_v1_sgard_proto_rawDescGZIP(), []int{7}
|
||||
}
|
||||
|
||||
type PullManifestResponse struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Manifest *Manifest `protobuf:"bytes,1,opt,name=manifest,proto3" json:"manifest,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *PullManifestResponse) Reset() {
|
||||
*x = PullManifestResponse{}
|
||||
mi := &file_sgard_v1_sgard_proto_msgTypes[8]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *PullManifestResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*PullManifestResponse) ProtoMessage() {}
|
||||
|
||||
func (x *PullManifestResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_sgard_v1_sgard_proto_msgTypes[8]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use PullManifestResponse.ProtoReflect.Descriptor instead.
|
||||
func (*PullManifestResponse) Descriptor() ([]byte, []int) {
|
||||
return file_sgard_v1_sgard_proto_rawDescGZIP(), []int{8}
|
||||
}
|
||||
|
||||
func (x *PullManifestResponse) GetManifest() *Manifest {
|
||||
if x != nil {
|
||||
return x.Manifest
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type PullBlobsRequest struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Hashes []string `protobuf:"bytes,1,rep,name=hashes,proto3" json:"hashes,omitempty"` // blobs the client needs
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *PullBlobsRequest) Reset() {
|
||||
*x = PullBlobsRequest{}
|
||||
mi := &file_sgard_v1_sgard_proto_msgTypes[9]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *PullBlobsRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*PullBlobsRequest) ProtoMessage() {}
|
||||
|
||||
func (x *PullBlobsRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_sgard_v1_sgard_proto_msgTypes[9]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use PullBlobsRequest.ProtoReflect.Descriptor instead.
|
||||
func (*PullBlobsRequest) Descriptor() ([]byte, []int) {
|
||||
return file_sgard_v1_sgard_proto_rawDescGZIP(), []int{9}
|
||||
}
|
||||
|
||||
func (x *PullBlobsRequest) GetHashes() []string {
|
||||
if x != nil {
|
||||
return x.Hashes
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type PullBlobsResponse struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Chunk *BlobChunk `protobuf:"bytes,1,opt,name=chunk,proto3" json:"chunk,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *PullBlobsResponse) Reset() {
|
||||
*x = PullBlobsResponse{}
|
||||
mi := &file_sgard_v1_sgard_proto_msgTypes[10]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *PullBlobsResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*PullBlobsResponse) ProtoMessage() {}
|
||||
|
||||
func (x *PullBlobsResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_sgard_v1_sgard_proto_msgTypes[10]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use PullBlobsResponse.ProtoReflect.Descriptor instead.
|
||||
func (*PullBlobsResponse) Descriptor() ([]byte, []int) {
|
||||
return file_sgard_v1_sgard_proto_rawDescGZIP(), []int{10}
|
||||
}
|
||||
|
||||
func (x *PullBlobsResponse) GetChunk() *BlobChunk {
|
||||
if x != nil {
|
||||
return x.Chunk
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type PruneRequest struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *PruneRequest) Reset() {
|
||||
*x = PruneRequest{}
|
||||
mi := &file_sgard_v1_sgard_proto_msgTypes[11]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *PruneRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*PruneRequest) ProtoMessage() {}
|
||||
|
||||
func (x *PruneRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_sgard_v1_sgard_proto_msgTypes[11]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use PruneRequest.ProtoReflect.Descriptor instead.
|
||||
func (*PruneRequest) Descriptor() ([]byte, []int) {
|
||||
return file_sgard_v1_sgard_proto_rawDescGZIP(), []int{11}
|
||||
}
|
||||
|
||||
type PruneResponse struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
BlobsRemoved int32 `protobuf:"varint,1,opt,name=blobs_removed,json=blobsRemoved,proto3" json:"blobs_removed,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *PruneResponse) Reset() {
|
||||
*x = PruneResponse{}
|
||||
mi := &file_sgard_v1_sgard_proto_msgTypes[12]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *PruneResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*PruneResponse) ProtoMessage() {}
|
||||
|
||||
func (x *PruneResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_sgard_v1_sgard_proto_msgTypes[12]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use PruneResponse.ProtoReflect.Descriptor instead.
|
||||
func (*PruneResponse) Descriptor() ([]byte, []int) {
|
||||
return file_sgard_v1_sgard_proto_rawDescGZIP(), []int{12}
|
||||
}
|
||||
|
||||
func (x *PruneResponse) GetBlobsRemoved() int32 {
|
||||
if x != nil {
|
||||
return x.BlobsRemoved
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
var File_sgard_v1_sgard_proto protoreflect.FileDescriptor
|
||||
|
||||
const file_sgard_v1_sgard_proto_rawDesc = "" +
|
||||
"\n" +
|
||||
"\x14sgard/v1/sgard.proto\x12\bsgard.v1\x1a\x1fgoogle/protobuf/timestamp.proto\"\xad\x01\n" +
|
||||
"\rManifestEntry\x12\x12\n" +
|
||||
"\x04path\x18\x01 \x01(\tR\x04path\x12\x12\n" +
|
||||
"\x04hash\x18\x02 \x01(\tR\x04hash\x12\x12\n" +
|
||||
"\x04type\x18\x03 \x01(\tR\x04type\x12\x12\n" +
|
||||
"\x04mode\x18\x04 \x01(\tR\x04mode\x12\x16\n" +
|
||||
"\x06target\x18\x05 \x01(\tR\x06target\x124\n" +
|
||||
"\aupdated\x18\x06 \x01(\v2\x1a.google.protobuf.TimestampR\aupdated\"\xd9\x01\n" +
|
||||
"\bManifest\x12\x18\n" +
|
||||
"\aversion\x18\x01 \x01(\x05R\aversion\x124\n" +
|
||||
"\acreated\x18\x02 \x01(\v2\x1a.google.protobuf.TimestampR\acreated\x124\n" +
|
||||
"\aupdated\x18\x03 \x01(\v2\x1a.google.protobuf.TimestampR\aupdated\x12\x18\n" +
|
||||
"\amessage\x18\x04 \x01(\tR\amessage\x12-\n" +
|
||||
"\x05files\x18\x05 \x03(\v2\x17.sgard.v1.ManifestEntryR\x05files\"3\n" +
|
||||
"\tBlobChunk\x12\x12\n" +
|
||||
"\x04hash\x18\x01 \x01(\tR\x04hash\x12\x12\n" +
|
||||
"\x04data\x18\x02 \x01(\fR\x04data\"E\n" +
|
||||
"\x13PushManifestRequest\x12.\n" +
|
||||
"\bmanifest\x18\x01 \x01(\v2\x12.sgard.v1.ManifestR\bmanifest\"\x95\x02\n" +
|
||||
"\x14PushManifestResponse\x12C\n" +
|
||||
"\bdecision\x18\x01 \x01(\x0e2'.sgard.v1.PushManifestResponse.DecisionR\bdecision\x12#\n" +
|
||||
"\rmissing_blobs\x18\x02 \x03(\tR\fmissingBlobs\x12A\n" +
|
||||
"\x0eserver_updated\x18\x03 \x01(\v2\x1a.google.protobuf.TimestampR\rserverUpdated\"P\n" +
|
||||
"\bDecision\x12\x18\n" +
|
||||
"\x14DECISION_UNSPECIFIED\x10\x00\x12\f\n" +
|
||||
"\bACCEPTED\x10\x01\x12\f\n" +
|
||||
"\bREJECTED\x10\x02\x12\x0e\n" +
|
||||
"\n" +
|
||||
"UP_TO_DATE\x10\x03\"=\n" +
|
||||
"\x10PushBlobsRequest\x12)\n" +
|
||||
"\x05chunk\x18\x01 \x01(\v2\x13.sgard.v1.BlobChunkR\x05chunk\":\n" +
|
||||
"\x11PushBlobsResponse\x12%\n" +
|
||||
"\x0eblobs_received\x18\x01 \x01(\x05R\rblobsReceived\"\x15\n" +
|
||||
"\x13PullManifestRequest\"F\n" +
|
||||
"\x14PullManifestResponse\x12.\n" +
|
||||
"\bmanifest\x18\x01 \x01(\v2\x12.sgard.v1.ManifestR\bmanifest\"*\n" +
|
||||
"\x10PullBlobsRequest\x12\x16\n" +
|
||||
"\x06hashes\x18\x01 \x03(\tR\x06hashes\">\n" +
|
||||
"\x11PullBlobsResponse\x12)\n" +
|
||||
"\x05chunk\x18\x01 \x01(\v2\x13.sgard.v1.BlobChunkR\x05chunk\"\x0e\n" +
|
||||
"\fPruneRequest\"4\n" +
|
||||
"\rPruneResponse\x12#\n" +
|
||||
"\rblobs_removed\x18\x01 \x01(\x05R\fblobsRemoved2\xf4\x02\n" +
|
||||
"\n" +
|
||||
"GardenSync\x12M\n" +
|
||||
"\fPushManifest\x12\x1d.sgard.v1.PushManifestRequest\x1a\x1e.sgard.v1.PushManifestResponse\x12F\n" +
|
||||
"\tPushBlobs\x12\x1a.sgard.v1.PushBlobsRequest\x1a\x1b.sgard.v1.PushBlobsResponse(\x01\x12M\n" +
|
||||
"\fPullManifest\x12\x1d.sgard.v1.PullManifestRequest\x1a\x1e.sgard.v1.PullManifestResponse\x12F\n" +
|
||||
"\tPullBlobs\x12\x1a.sgard.v1.PullBlobsRequest\x1a\x1b.sgard.v1.PullBlobsResponse0\x01\x128\n" +
|
||||
"\x05Prune\x12\x16.sgard.v1.PruneRequest\x1a\x17.sgard.v1.PruneResponseB Z\x1egithub.com/kisom/sgard/sgardpbb\x06proto3"
|
||||
|
||||
var (
|
||||
file_sgard_v1_sgard_proto_rawDescOnce sync.Once
|
||||
file_sgard_v1_sgard_proto_rawDescData []byte
|
||||
)
|
||||
|
||||
func file_sgard_v1_sgard_proto_rawDescGZIP() []byte {
|
||||
file_sgard_v1_sgard_proto_rawDescOnce.Do(func() {
|
||||
file_sgard_v1_sgard_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_sgard_v1_sgard_proto_rawDesc), len(file_sgard_v1_sgard_proto_rawDesc)))
|
||||
})
|
||||
return file_sgard_v1_sgard_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_sgard_v1_sgard_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
|
||||
var file_sgard_v1_sgard_proto_msgTypes = make([]protoimpl.MessageInfo, 13)
|
||||
var file_sgard_v1_sgard_proto_goTypes = []any{
|
||||
(PushManifestResponse_Decision)(0), // 0: sgard.v1.PushManifestResponse.Decision
|
||||
(*ManifestEntry)(nil), // 1: sgard.v1.ManifestEntry
|
||||
(*Manifest)(nil), // 2: sgard.v1.Manifest
|
||||
(*BlobChunk)(nil), // 3: sgard.v1.BlobChunk
|
||||
(*PushManifestRequest)(nil), // 4: sgard.v1.PushManifestRequest
|
||||
(*PushManifestResponse)(nil), // 5: sgard.v1.PushManifestResponse
|
||||
(*PushBlobsRequest)(nil), // 6: sgard.v1.PushBlobsRequest
|
||||
(*PushBlobsResponse)(nil), // 7: sgard.v1.PushBlobsResponse
|
||||
(*PullManifestRequest)(nil), // 8: sgard.v1.PullManifestRequest
|
||||
(*PullManifestResponse)(nil), // 9: sgard.v1.PullManifestResponse
|
||||
(*PullBlobsRequest)(nil), // 10: sgard.v1.PullBlobsRequest
|
||||
(*PullBlobsResponse)(nil), // 11: sgard.v1.PullBlobsResponse
|
||||
(*PruneRequest)(nil), // 12: sgard.v1.PruneRequest
|
||||
(*PruneResponse)(nil), // 13: sgard.v1.PruneResponse
|
||||
(*timestamppb.Timestamp)(nil), // 14: google.protobuf.Timestamp
|
||||
}
|
||||
var file_sgard_v1_sgard_proto_depIdxs = []int32{
|
||||
14, // 0: sgard.v1.ManifestEntry.updated:type_name -> google.protobuf.Timestamp
|
||||
14, // 1: sgard.v1.Manifest.created:type_name -> google.protobuf.Timestamp
|
||||
14, // 2: sgard.v1.Manifest.updated:type_name -> google.protobuf.Timestamp
|
||||
1, // 3: sgard.v1.Manifest.files:type_name -> sgard.v1.ManifestEntry
|
||||
2, // 4: sgard.v1.PushManifestRequest.manifest:type_name -> sgard.v1.Manifest
|
||||
0, // 5: sgard.v1.PushManifestResponse.decision:type_name -> sgard.v1.PushManifestResponse.Decision
|
||||
14, // 6: sgard.v1.PushManifestResponse.server_updated:type_name -> google.protobuf.Timestamp
|
||||
3, // 7: sgard.v1.PushBlobsRequest.chunk:type_name -> sgard.v1.BlobChunk
|
||||
2, // 8: sgard.v1.PullManifestResponse.manifest:type_name -> sgard.v1.Manifest
|
||||
3, // 9: sgard.v1.PullBlobsResponse.chunk:type_name -> sgard.v1.BlobChunk
|
||||
4, // 10: sgard.v1.GardenSync.PushManifest:input_type -> sgard.v1.PushManifestRequest
|
||||
6, // 11: sgard.v1.GardenSync.PushBlobs:input_type -> sgard.v1.PushBlobsRequest
|
||||
8, // 12: sgard.v1.GardenSync.PullManifest:input_type -> sgard.v1.PullManifestRequest
|
||||
10, // 13: sgard.v1.GardenSync.PullBlobs:input_type -> sgard.v1.PullBlobsRequest
|
||||
12, // 14: sgard.v1.GardenSync.Prune:input_type -> sgard.v1.PruneRequest
|
||||
5, // 15: sgard.v1.GardenSync.PushManifest:output_type -> sgard.v1.PushManifestResponse
|
||||
7, // 16: sgard.v1.GardenSync.PushBlobs:output_type -> sgard.v1.PushBlobsResponse
|
||||
9, // 17: sgard.v1.GardenSync.PullManifest:output_type -> sgard.v1.PullManifestResponse
|
||||
11, // 18: sgard.v1.GardenSync.PullBlobs:output_type -> sgard.v1.PullBlobsResponse
|
||||
13, // 19: sgard.v1.GardenSync.Prune:output_type -> sgard.v1.PruneResponse
|
||||
15, // [15:20] is the sub-list for method output_type
|
||||
10, // [10:15] is the sub-list for method input_type
|
||||
10, // [10:10] is the sub-list for extension type_name
|
||||
10, // [10:10] is the sub-list for extension extendee
|
||||
0, // [0:10] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_sgard_v1_sgard_proto_init() }
|
||||
func file_sgard_v1_sgard_proto_init() {
|
||||
if File_sgard_v1_sgard_proto != nil {
|
||||
return
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: unsafe.Slice(unsafe.StringData(file_sgard_v1_sgard_proto_rawDesc), len(file_sgard_v1_sgard_proto_rawDesc)),
|
||||
NumEnums: 1,
|
||||
NumMessages: 13,
|
||||
NumExtensions: 0,
|
||||
NumServices: 1,
|
||||
},
|
||||
GoTypes: file_sgard_v1_sgard_proto_goTypes,
|
||||
DependencyIndexes: file_sgard_v1_sgard_proto_depIdxs,
|
||||
EnumInfos: file_sgard_v1_sgard_proto_enumTypes,
|
||||
MessageInfos: file_sgard_v1_sgard_proto_msgTypes,
|
||||
}.Build()
|
||||
File_sgard_v1_sgard_proto = out.File
|
||||
file_sgard_v1_sgard_proto_goTypes = nil
|
||||
file_sgard_v1_sgard_proto_depIdxs = nil
|
||||
}
|
||||
280
sgardpb/sgard_grpc.pb.go
Normal file
280
sgardpb/sgard_grpc.pb.go
Normal file
@@ -0,0 +1,280 @@
|
||||
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
||||
// versions:
|
||||
// - protoc-gen-go-grpc v1.5.1
|
||||
// - protoc v6.32.1
|
||||
// source: sgard/v1/sgard.proto
|
||||
|
||||
package sgardpb
|
||||
|
||||
import (
|
||||
context "context"
|
||||
grpc "google.golang.org/grpc"
|
||||
codes "google.golang.org/grpc/codes"
|
||||
status "google.golang.org/grpc/status"
|
||||
)
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the grpc package it is being compiled against.
|
||||
// Requires gRPC-Go v1.64.0 or later.
|
||||
const _ = grpc.SupportPackageIsVersion9
|
||||
|
||||
const (
|
||||
GardenSync_PushManifest_FullMethodName = "/sgard.v1.GardenSync/PushManifest"
|
||||
GardenSync_PushBlobs_FullMethodName = "/sgard.v1.GardenSync/PushBlobs"
|
||||
GardenSync_PullManifest_FullMethodName = "/sgard.v1.GardenSync/PullManifest"
|
||||
GardenSync_PullBlobs_FullMethodName = "/sgard.v1.GardenSync/PullBlobs"
|
||||
GardenSync_Prune_FullMethodName = "/sgard.v1.GardenSync/Prune"
|
||||
)
|
||||
|
||||
// GardenSyncClient is the client API for GardenSync service.
|
||||
//
|
||||
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
|
||||
//
|
||||
// GardenSync is the sgard remote sync service.
|
||||
type GardenSyncClient interface {
|
||||
// Push flow: send manifest, then stream missing blobs.
|
||||
PushManifest(ctx context.Context, in *PushManifestRequest, opts ...grpc.CallOption) (*PushManifestResponse, error)
|
||||
PushBlobs(ctx context.Context, opts ...grpc.CallOption) (grpc.ClientStreamingClient[PushBlobsRequest, PushBlobsResponse], error)
|
||||
// Pull flow: get manifest, then stream requested blobs.
|
||||
PullManifest(ctx context.Context, in *PullManifestRequest, opts ...grpc.CallOption) (*PullManifestResponse, error)
|
||||
PullBlobs(ctx context.Context, in *PullBlobsRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[PullBlobsResponse], error)
|
||||
// Prune removes orphaned blobs on the server.
|
||||
Prune(ctx context.Context, in *PruneRequest, opts ...grpc.CallOption) (*PruneResponse, error)
|
||||
}
|
||||
|
||||
type gardenSyncClient struct {
|
||||
cc grpc.ClientConnInterface
|
||||
}
|
||||
|
||||
func NewGardenSyncClient(cc grpc.ClientConnInterface) GardenSyncClient {
|
||||
return &gardenSyncClient{cc}
|
||||
}
|
||||
|
||||
func (c *gardenSyncClient) PushManifest(ctx context.Context, in *PushManifestRequest, opts ...grpc.CallOption) (*PushManifestResponse, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(PushManifestResponse)
|
||||
err := c.cc.Invoke(ctx, GardenSync_PushManifest_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *gardenSyncClient) PushBlobs(ctx context.Context, opts ...grpc.CallOption) (grpc.ClientStreamingClient[PushBlobsRequest, PushBlobsResponse], error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
stream, err := c.cc.NewStream(ctx, &GardenSync_ServiceDesc.Streams[0], GardenSync_PushBlobs_FullMethodName, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
x := &grpc.GenericClientStream[PushBlobsRequest, PushBlobsResponse]{ClientStream: stream}
|
||||
return x, nil
|
||||
}
|
||||
|
||||
// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
|
||||
type GardenSync_PushBlobsClient = grpc.ClientStreamingClient[PushBlobsRequest, PushBlobsResponse]
|
||||
|
||||
func (c *gardenSyncClient) PullManifest(ctx context.Context, in *PullManifestRequest, opts ...grpc.CallOption) (*PullManifestResponse, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(PullManifestResponse)
|
||||
err := c.cc.Invoke(ctx, GardenSync_PullManifest_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *gardenSyncClient) PullBlobs(ctx context.Context, in *PullBlobsRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[PullBlobsResponse], error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
stream, err := c.cc.NewStream(ctx, &GardenSync_ServiceDesc.Streams[1], GardenSync_PullBlobs_FullMethodName, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
x := &grpc.GenericClientStream[PullBlobsRequest, PullBlobsResponse]{ClientStream: stream}
|
||||
if err := x.ClientStream.SendMsg(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err := x.ClientStream.CloseSend(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return x, nil
|
||||
}
|
||||
|
||||
// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
|
||||
type GardenSync_PullBlobsClient = grpc.ServerStreamingClient[PullBlobsResponse]
|
||||
|
||||
func (c *gardenSyncClient) Prune(ctx context.Context, in *PruneRequest, opts ...grpc.CallOption) (*PruneResponse, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(PruneResponse)
|
||||
err := c.cc.Invoke(ctx, GardenSync_Prune_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// GardenSyncServer is the server API for GardenSync service.
|
||||
// All implementations must embed UnimplementedGardenSyncServer
|
||||
// for forward compatibility.
|
||||
//
|
||||
// GardenSync is the sgard remote sync service.
|
||||
type GardenSyncServer interface {
|
||||
// Push flow: send manifest, then stream missing blobs.
|
||||
PushManifest(context.Context, *PushManifestRequest) (*PushManifestResponse, error)
|
||||
PushBlobs(grpc.ClientStreamingServer[PushBlobsRequest, PushBlobsResponse]) error
|
||||
// Pull flow: get manifest, then stream requested blobs.
|
||||
PullManifest(context.Context, *PullManifestRequest) (*PullManifestResponse, error)
|
||||
PullBlobs(*PullBlobsRequest, grpc.ServerStreamingServer[PullBlobsResponse]) error
|
||||
// Prune removes orphaned blobs on the server.
|
||||
Prune(context.Context, *PruneRequest) (*PruneResponse, error)
|
||||
mustEmbedUnimplementedGardenSyncServer()
|
||||
}
|
||||
|
||||
// UnimplementedGardenSyncServer must be embedded to have
|
||||
// forward compatible implementations.
|
||||
//
|
||||
// NOTE: this should be embedded by value instead of pointer to avoid a nil
|
||||
// pointer dereference when methods are called.
|
||||
type UnimplementedGardenSyncServer struct{}
|
||||
|
||||
func (UnimplementedGardenSyncServer) PushManifest(context.Context, *PushManifestRequest) (*PushManifestResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method PushManifest not implemented")
|
||||
}
|
||||
func (UnimplementedGardenSyncServer) PushBlobs(grpc.ClientStreamingServer[PushBlobsRequest, PushBlobsResponse]) error {
|
||||
return status.Errorf(codes.Unimplemented, "method PushBlobs not implemented")
|
||||
}
|
||||
func (UnimplementedGardenSyncServer) PullManifest(context.Context, *PullManifestRequest) (*PullManifestResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method PullManifest not implemented")
|
||||
}
|
||||
func (UnimplementedGardenSyncServer) PullBlobs(*PullBlobsRequest, grpc.ServerStreamingServer[PullBlobsResponse]) error {
|
||||
return status.Errorf(codes.Unimplemented, "method PullBlobs not implemented")
|
||||
}
|
||||
func (UnimplementedGardenSyncServer) Prune(context.Context, *PruneRequest) (*PruneResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method Prune not implemented")
|
||||
}
|
||||
func (UnimplementedGardenSyncServer) mustEmbedUnimplementedGardenSyncServer() {}
|
||||
func (UnimplementedGardenSyncServer) testEmbeddedByValue() {}
|
||||
|
||||
// UnsafeGardenSyncServer may be embedded to opt out of forward compatibility for this service.
|
||||
// Use of this interface is not recommended, as added methods to GardenSyncServer will
|
||||
// result in compilation errors.
|
||||
type UnsafeGardenSyncServer interface {
|
||||
mustEmbedUnimplementedGardenSyncServer()
|
||||
}
|
||||
|
||||
func RegisterGardenSyncServer(s grpc.ServiceRegistrar, srv GardenSyncServer) {
|
||||
// If the following call pancis, it indicates UnimplementedGardenSyncServer was
|
||||
// embedded by pointer and is nil. This will cause panics if an
|
||||
// unimplemented method is ever invoked, so we test this at initialization
|
||||
// time to prevent it from happening at runtime later due to I/O.
|
||||
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
|
||||
t.testEmbeddedByValue()
|
||||
}
|
||||
s.RegisterService(&GardenSync_ServiceDesc, srv)
|
||||
}
|
||||
|
||||
func _GardenSync_PushManifest_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(PushManifestRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(GardenSyncServer).PushManifest(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: GardenSync_PushManifest_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(GardenSyncServer).PushManifest(ctx, req.(*PushManifestRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _GardenSync_PushBlobs_Handler(srv interface{}, stream grpc.ServerStream) error {
|
||||
return srv.(GardenSyncServer).PushBlobs(&grpc.GenericServerStream[PushBlobsRequest, PushBlobsResponse]{ServerStream: stream})
|
||||
}
|
||||
|
||||
// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
|
||||
type GardenSync_PushBlobsServer = grpc.ClientStreamingServer[PushBlobsRequest, PushBlobsResponse]
|
||||
|
||||
func _GardenSync_PullManifest_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(PullManifestRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(GardenSyncServer).PullManifest(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: GardenSync_PullManifest_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(GardenSyncServer).PullManifest(ctx, req.(*PullManifestRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _GardenSync_PullBlobs_Handler(srv interface{}, stream grpc.ServerStream) error {
|
||||
m := new(PullBlobsRequest)
|
||||
if err := stream.RecvMsg(m); err != nil {
|
||||
return err
|
||||
}
|
||||
return srv.(GardenSyncServer).PullBlobs(m, &grpc.GenericServerStream[PullBlobsRequest, PullBlobsResponse]{ServerStream: stream})
|
||||
}
|
||||
|
||||
// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
|
||||
type GardenSync_PullBlobsServer = grpc.ServerStreamingServer[PullBlobsResponse]
|
||||
|
||||
func _GardenSync_Prune_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(PruneRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(GardenSyncServer).Prune(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: GardenSync_Prune_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(GardenSyncServer).Prune(ctx, req.(*PruneRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
// GardenSync_ServiceDesc is the grpc.ServiceDesc for GardenSync service.
|
||||
// It's only intended for direct use with grpc.RegisterService,
|
||||
// and not to be introspected or modified (even as a copy)
|
||||
var GardenSync_ServiceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "sgard.v1.GardenSync",
|
||||
HandlerType: (*GardenSyncServer)(nil),
|
||||
Methods: []grpc.MethodDesc{
|
||||
{
|
||||
MethodName: "PushManifest",
|
||||
Handler: _GardenSync_PushManifest_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "PullManifest",
|
||||
Handler: _GardenSync_PullManifest_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "Prune",
|
||||
Handler: _GardenSync_Prune_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{
|
||||
{
|
||||
StreamName: "PushBlobs",
|
||||
Handler: _GardenSync_PushBlobs_Handler,
|
||||
ClientStreams: true,
|
||||
},
|
||||
{
|
||||
StreamName: "PullBlobs",
|
||||
Handler: _GardenSync_PullBlobs_Handler,
|
||||
ServerStreams: true,
|
||||
},
|
||||
},
|
||||
Metadata: "sgard/v1/sgard.proto",
|
||||
}
|
||||
Reference in New Issue
Block a user