From c7e0e36daa6735ec28021269c647cffaa667674e Mon Sep 17 00:00:00 2001 From: Pasha Sviderski Date: Tue, 1 Sep 2026 18:05:14 +1000 Subject: [PATCH] feat(caddystorage): define CaddyStorage gRPC service API for distributed Caddy storage --- internal/machine/api/pb/caddy_storage.pb.go | 934 ++++++++++++++++++ internal/machine/api/pb/caddy_storage.proto | 74 ++ .../machine/api/pb/caddy_storage_grpc.pb.go | 278 ++++++ 3 files changed, 1286 insertions(+) create mode 100644 internal/machine/api/pb/caddy_storage.pb.go create mode 100644 internal/machine/api/pb/caddy_storage.proto create mode 100644 internal/machine/api/pb/caddy_storage_grpc.pb.go diff --git a/internal/machine/api/pb/caddy_storage.pb.go b/internal/machine/api/pb/caddy_storage.pb.go new file mode 100644 index 00000000..af3df586 --- /dev/null +++ b/internal/machine/api/pb/caddy_storage.pb.go @@ -0,0 +1,934 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.34.2 +// protoc v5.27.3 +// source: internal/machine/api/pb/caddy_storage.proto + +package pb + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + emptypb "google.golang.org/protobuf/types/known/emptypb" + timestamppb "google.golang.org/protobuf/types/known/timestamppb" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type StoreCaddyStorageRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + Value []byte `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` +} + +func (x *StoreCaddyStorageRequest) Reset() { + *x = StoreCaddyStorageRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_internal_machine_api_pb_caddy_storage_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *StoreCaddyStorageRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*StoreCaddyStorageRequest) ProtoMessage() {} + +func (x *StoreCaddyStorageRequest) ProtoReflect() protoreflect.Message { + mi := &file_internal_machine_api_pb_caddy_storage_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use StoreCaddyStorageRequest.ProtoReflect.Descriptor instead. +func (*StoreCaddyStorageRequest) Descriptor() ([]byte, []int) { + return file_internal_machine_api_pb_caddy_storage_proto_rawDescGZIP(), []int{0} +} + +func (x *StoreCaddyStorageRequest) GetKey() string { + if x != nil { + return x.Key + } + return "" +} + +func (x *StoreCaddyStorageRequest) GetValue() []byte { + if x != nil { + return x.Value + } + return nil +} + +type LoadCaddyStorageRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` +} + +func (x *LoadCaddyStorageRequest) Reset() { + *x = LoadCaddyStorageRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_internal_machine_api_pb_caddy_storage_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *LoadCaddyStorageRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LoadCaddyStorageRequest) ProtoMessage() {} + +func (x *LoadCaddyStorageRequest) ProtoReflect() protoreflect.Message { + mi := &file_internal_machine_api_pb_caddy_storage_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use LoadCaddyStorageRequest.ProtoReflect.Descriptor instead. +func (*LoadCaddyStorageRequest) Descriptor() ([]byte, []int) { + return file_internal_machine_api_pb_caddy_storage_proto_rawDescGZIP(), []int{1} +} + +func (x *LoadCaddyStorageRequest) GetKey() string { + if x != nil { + return x.Key + } + return "" +} + +type LoadCaddyStorageResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Must contain only one repeated messages field to allow broadcasting Load requests to multiple machines. + Messages []*MachineCaddyStorageValue `protobuf:"bytes,1,rep,name=messages,proto3" json:"messages,omitempty"` +} + +func (x *LoadCaddyStorageResponse) Reset() { + *x = LoadCaddyStorageResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_internal_machine_api_pb_caddy_storage_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *LoadCaddyStorageResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LoadCaddyStorageResponse) ProtoMessage() {} + +func (x *LoadCaddyStorageResponse) ProtoReflect() protoreflect.Message { + mi := &file_internal_machine_api_pb_caddy_storage_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use LoadCaddyStorageResponse.ProtoReflect.Descriptor instead. +func (*LoadCaddyStorageResponse) Descriptor() ([]byte, []int) { + return file_internal_machine_api_pb_caddy_storage_proto_rawDescGZIP(), []int{2} +} + +func (x *LoadCaddyStorageResponse) GetMessages() []*MachineCaddyStorageValue { + if x != nil { + return x.Messages + } + return nil +} + +type MachineCaddyStorageValue struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Metadata *Metadata `protobuf:"bytes,1,opt,name=metadata,proto3" json:"metadata,omitempty"` + Value []byte `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` + UpdatedAt *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=updated_at,json=updatedAt,proto3" json:"updated_at,omitempty"` +} + +func (x *MachineCaddyStorageValue) Reset() { + *x = MachineCaddyStorageValue{} + if protoimpl.UnsafeEnabled { + mi := &file_internal_machine_api_pb_caddy_storage_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MachineCaddyStorageValue) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MachineCaddyStorageValue) ProtoMessage() {} + +func (x *MachineCaddyStorageValue) ProtoReflect() protoreflect.Message { + mi := &file_internal_machine_api_pb_caddy_storage_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use MachineCaddyStorageValue.ProtoReflect.Descriptor instead. +func (*MachineCaddyStorageValue) Descriptor() ([]byte, []int) { + return file_internal_machine_api_pb_caddy_storage_proto_rawDescGZIP(), []int{3} +} + +func (x *MachineCaddyStorageValue) GetMetadata() *Metadata { + if x != nil { + return x.Metadata + } + return nil +} + +func (x *MachineCaddyStorageValue) GetValue() []byte { + if x != nil { + return x.Value + } + return nil +} + +func (x *MachineCaddyStorageValue) GetUpdatedAt() *timestamppb.Timestamp { + if x != nil { + return x.UpdatedAt + } + return nil +} + +type DeleteCaddyStorageRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` +} + +func (x *DeleteCaddyStorageRequest) Reset() { + *x = DeleteCaddyStorageRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_internal_machine_api_pb_caddy_storage_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeleteCaddyStorageRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteCaddyStorageRequest) ProtoMessage() {} + +func (x *DeleteCaddyStorageRequest) ProtoReflect() protoreflect.Message { + mi := &file_internal_machine_api_pb_caddy_storage_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeleteCaddyStorageRequest.ProtoReflect.Descriptor instead. +func (*DeleteCaddyStorageRequest) Descriptor() ([]byte, []int) { + return file_internal_machine_api_pb_caddy_storage_proto_rawDescGZIP(), []int{4} +} + +func (x *DeleteCaddyStorageRequest) GetKey() string { + if x != nil { + return x.Key + } + return "" +} + +type ListCaddyStorageRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Prefix string `protobuf:"bytes,1,opt,name=prefix,proto3" json:"prefix,omitempty"` + Recursive bool `protobuf:"varint,2,opt,name=recursive,proto3" json:"recursive,omitempty"` +} + +func (x *ListCaddyStorageRequest) Reset() { + *x = ListCaddyStorageRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_internal_machine_api_pb_caddy_storage_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListCaddyStorageRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListCaddyStorageRequest) ProtoMessage() {} + +func (x *ListCaddyStorageRequest) ProtoReflect() protoreflect.Message { + mi := &file_internal_machine_api_pb_caddy_storage_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListCaddyStorageRequest.ProtoReflect.Descriptor instead. +func (*ListCaddyStorageRequest) Descriptor() ([]byte, []int) { + return file_internal_machine_api_pb_caddy_storage_proto_rawDescGZIP(), []int{5} +} + +func (x *ListCaddyStorageRequest) GetPrefix() string { + if x != nil { + return x.Prefix + } + return "" +} + +func (x *ListCaddyStorageRequest) GetRecursive() bool { + if x != nil { + return x.Recursive + } + return false +} + +type ListCaddyStorageResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Must contain only one repeated messages field to allow broadcasting List requests to multiple machines. + Messages []*MachineCaddyStorageKeys `protobuf:"bytes,1,rep,name=messages,proto3" json:"messages,omitempty"` +} + +func (x *ListCaddyStorageResponse) Reset() { + *x = ListCaddyStorageResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_internal_machine_api_pb_caddy_storage_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListCaddyStorageResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListCaddyStorageResponse) ProtoMessage() {} + +func (x *ListCaddyStorageResponse) ProtoReflect() protoreflect.Message { + mi := &file_internal_machine_api_pb_caddy_storage_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListCaddyStorageResponse.ProtoReflect.Descriptor instead. +func (*ListCaddyStorageResponse) Descriptor() ([]byte, []int) { + return file_internal_machine_api_pb_caddy_storage_proto_rawDescGZIP(), []int{6} +} + +func (x *ListCaddyStorageResponse) GetMessages() []*MachineCaddyStorageKeys { + if x != nil { + return x.Messages + } + return nil +} + +type MachineCaddyStorageKeys struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Metadata *Metadata `protobuf:"bytes,1,opt,name=metadata,proto3" json:"metadata,omitempty"` + Keys []string `protobuf:"bytes,2,rep,name=keys,proto3" json:"keys,omitempty"` +} + +func (x *MachineCaddyStorageKeys) Reset() { + *x = MachineCaddyStorageKeys{} + if protoimpl.UnsafeEnabled { + mi := &file_internal_machine_api_pb_caddy_storage_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MachineCaddyStorageKeys) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MachineCaddyStorageKeys) ProtoMessage() {} + +func (x *MachineCaddyStorageKeys) ProtoReflect() protoreflect.Message { + mi := &file_internal_machine_api_pb_caddy_storage_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use MachineCaddyStorageKeys.ProtoReflect.Descriptor instead. +func (*MachineCaddyStorageKeys) Descriptor() ([]byte, []int) { + return file_internal_machine_api_pb_caddy_storage_proto_rawDescGZIP(), []int{7} +} + +func (x *MachineCaddyStorageKeys) GetMetadata() *Metadata { + if x != nil { + return x.Metadata + } + return nil +} + +func (x *MachineCaddyStorageKeys) GetKeys() []string { + if x != nil { + return x.Keys + } + return nil +} + +type StatCaddyStorageRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` +} + +func (x *StatCaddyStorageRequest) Reset() { + *x = StatCaddyStorageRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_internal_machine_api_pb_caddy_storage_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *StatCaddyStorageRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*StatCaddyStorageRequest) ProtoMessage() {} + +func (x *StatCaddyStorageRequest) ProtoReflect() protoreflect.Message { + mi := &file_internal_machine_api_pb_caddy_storage_proto_msgTypes[8] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use StatCaddyStorageRequest.ProtoReflect.Descriptor instead. +func (*StatCaddyStorageRequest) Descriptor() ([]byte, []int) { + return file_internal_machine_api_pb_caddy_storage_proto_rawDescGZIP(), []int{8} +} + +func (x *StatCaddyStorageRequest) GetKey() string { + if x != nil { + return x.Key + } + return "" +} + +type StatCaddyStorageResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Must contain only one repeated messages field to allow broadcasting Stat requests to multiple machines. + Messages []*MachineCaddyStorageKeyInfo `protobuf:"bytes,1,rep,name=messages,proto3" json:"messages,omitempty"` +} + +func (x *StatCaddyStorageResponse) Reset() { + *x = StatCaddyStorageResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_internal_machine_api_pb_caddy_storage_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *StatCaddyStorageResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*StatCaddyStorageResponse) ProtoMessage() {} + +func (x *StatCaddyStorageResponse) ProtoReflect() protoreflect.Message { + mi := &file_internal_machine_api_pb_caddy_storage_proto_msgTypes[9] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use StatCaddyStorageResponse.ProtoReflect.Descriptor instead. +func (*StatCaddyStorageResponse) Descriptor() ([]byte, []int) { + return file_internal_machine_api_pb_caddy_storage_proto_rawDescGZIP(), []int{9} +} + +func (x *StatCaddyStorageResponse) GetMessages() []*MachineCaddyStorageKeyInfo { + if x != nil { + return x.Messages + } + return nil +} + +type MachineCaddyStorageKeyInfo struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Metadata *Metadata `protobuf:"bytes,1,opt,name=metadata,proto3" json:"metadata,omitempty"` + Key string `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"` + UpdatedAt *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=updated_at,json=updatedAt,proto3" json:"updated_at,omitempty"` + Size int64 `protobuf:"varint,4,opt,name=size,proto3" json:"size,omitempty"` + IsTerminal bool `protobuf:"varint,5,opt,name=is_terminal,json=isTerminal,proto3" json:"is_terminal,omitempty"` +} + +func (x *MachineCaddyStorageKeyInfo) Reset() { + *x = MachineCaddyStorageKeyInfo{} + if protoimpl.UnsafeEnabled { + mi := &file_internal_machine_api_pb_caddy_storage_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MachineCaddyStorageKeyInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MachineCaddyStorageKeyInfo) ProtoMessage() {} + +func (x *MachineCaddyStorageKeyInfo) ProtoReflect() protoreflect.Message { + mi := &file_internal_machine_api_pb_caddy_storage_proto_msgTypes[10] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use MachineCaddyStorageKeyInfo.ProtoReflect.Descriptor instead. +func (*MachineCaddyStorageKeyInfo) Descriptor() ([]byte, []int) { + return file_internal_machine_api_pb_caddy_storage_proto_rawDescGZIP(), []int{10} +} + +func (x *MachineCaddyStorageKeyInfo) GetMetadata() *Metadata { + if x != nil { + return x.Metadata + } + return nil +} + +func (x *MachineCaddyStorageKeyInfo) GetKey() string { + if x != nil { + return x.Key + } + return "" +} + +func (x *MachineCaddyStorageKeyInfo) GetUpdatedAt() *timestamppb.Timestamp { + if x != nil { + return x.UpdatedAt + } + return nil +} + +func (x *MachineCaddyStorageKeyInfo) GetSize() int64 { + if x != nil { + return x.Size + } + return 0 +} + +func (x *MachineCaddyStorageKeyInfo) GetIsTerminal() bool { + if x != nil { + return x.IsTerminal + } + return false +} + +var File_internal_machine_api_pb_caddy_storage_proto protoreflect.FileDescriptor + +var file_internal_machine_api_pb_caddy_storage_proto_rawDesc = []byte{ + 0x0a, 0x2b, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x6d, 0x61, 0x63, 0x68, 0x69, + 0x6e, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x62, 0x2f, 0x63, 0x61, 0x64, 0x64, 0x79, 0x5f, + 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x03, 0x61, + 0x70, 0x69, 0x1a, 0x1b, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x62, 0x75, 0x66, 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, + 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, + 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x1a, 0x24, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x6d, 0x61, 0x63, 0x68, 0x69, + 0x6e, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x62, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x42, 0x0a, 0x18, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x43, + 0x61, 0x64, 0x64, 0x79, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x0c, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x2b, 0x0a, 0x17, 0x4c, 0x6f, + 0x61, 0x64, 0x43, 0x61, 0x64, 0x64, 0x79, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x22, 0x55, 0x0a, 0x18, 0x4c, 0x6f, 0x61, 0x64, 0x43, + 0x61, 0x64, 0x64, 0x79, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x39, 0x0a, 0x08, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x18, + 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x4d, 0x61, 0x63, 0x68, + 0x69, 0x6e, 0x65, 0x43, 0x61, 0x64, 0x64, 0x79, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x56, + 0x61, 0x6c, 0x75, 0x65, 0x52, 0x08, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x22, 0x96, + 0x01, 0x0a, 0x18, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x43, 0x61, 0x64, 0x64, 0x79, 0x53, + 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x29, 0x0a, 0x08, 0x6d, + 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, + 0x61, 0x70, 0x69, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x08, 0x6d, 0x65, + 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x39, 0x0a, 0x0a, + 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, + 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x09, 0x75, 0x70, + 0x64, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x22, 0x2d, 0x0a, 0x19, 0x44, 0x65, 0x6c, 0x65, 0x74, + 0x65, 0x43, 0x61, 0x64, 0x64, 0x79, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x22, 0x4f, 0x0a, 0x17, 0x4c, 0x69, 0x73, 0x74, 0x43, 0x61, + 0x64, 0x64, 0x79, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x06, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x65, 0x63, + 0x75, 0x72, 0x73, 0x69, 0x76, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x72, 0x65, + 0x63, 0x75, 0x72, 0x73, 0x69, 0x76, 0x65, 0x22, 0x54, 0x0a, 0x18, 0x4c, 0x69, 0x73, 0x74, 0x43, + 0x61, 0x64, 0x64, 0x79, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x38, 0x0a, 0x08, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x18, + 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x4d, 0x61, 0x63, 0x68, + 0x69, 0x6e, 0x65, 0x43, 0x61, 0x64, 0x64, 0x79, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x4b, + 0x65, 0x79, 0x73, 0x52, 0x08, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x22, 0x58, 0x0a, + 0x17, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x43, 0x61, 0x64, 0x64, 0x79, 0x53, 0x74, 0x6f, + 0x72, 0x61, 0x67, 0x65, 0x4b, 0x65, 0x79, 0x73, 0x12, 0x29, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, + 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x61, 0x70, 0x69, + 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, + 0x61, 0x74, 0x61, 0x12, 0x12, 0x0a, 0x04, 0x6b, 0x65, 0x79, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, + 0x09, 0x52, 0x04, 0x6b, 0x65, 0x79, 0x73, 0x22, 0x2b, 0x0a, 0x17, 0x53, 0x74, 0x61, 0x74, 0x43, + 0x61, 0x64, 0x64, 0x79, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x03, 0x6b, 0x65, 0x79, 0x22, 0x57, 0x0a, 0x18, 0x53, 0x74, 0x61, 0x74, 0x43, 0x61, 0x64, 0x64, + 0x79, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x3b, 0x0a, 0x08, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, + 0x43, 0x61, 0x64, 0x64, 0x79, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x4b, 0x65, 0x79, 0x49, + 0x6e, 0x66, 0x6f, 0x52, 0x08, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x22, 0xc9, 0x01, + 0x0a, 0x1a, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x43, 0x61, 0x64, 0x64, 0x79, 0x53, 0x74, + 0x6f, 0x72, 0x61, 0x67, 0x65, 0x4b, 0x65, 0x79, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x29, 0x0a, 0x08, + 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, + 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x08, 0x6d, + 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x39, 0x0a, 0x0a, 0x75, 0x70, 0x64, + 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, + 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, + 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x09, 0x75, 0x70, 0x64, 0x61, 0x74, + 0x65, 0x64, 0x41, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x04, 0x20, 0x01, + 0x28, 0x03, 0x52, 0x04, 0x73, 0x69, 0x7a, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x69, 0x73, 0x5f, 0x74, + 0x65, 0x72, 0x6d, 0x69, 0x6e, 0x61, 0x6c, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x69, + 0x73, 0x54, 0x65, 0x72, 0x6d, 0x69, 0x6e, 0x61, 0x6c, 0x32, 0xdb, 0x02, 0x0a, 0x0c, 0x43, 0x61, + 0x64, 0x64, 0x79, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x12, 0x3e, 0x0a, 0x05, 0x53, 0x74, + 0x6f, 0x72, 0x65, 0x12, 0x1d, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x43, + 0x61, 0x64, 0x64, 0x79, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x43, 0x0a, 0x04, 0x4c, 0x6f, + 0x61, 0x64, 0x12, 0x1c, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x4c, 0x6f, 0x61, 0x64, 0x43, 0x61, 0x64, + 0x64, 0x79, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x1d, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x4c, 0x6f, 0x61, 0x64, 0x43, 0x61, 0x64, 0x64, 0x79, + 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x3c, 0x0a, 0x06, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x12, 0x1e, 0x2e, 0x61, 0x70, 0x69, 0x2e, + 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x43, 0x61, 0x64, 0x64, 0x79, 0x53, 0x74, 0x6f, 0x72, 0x61, + 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x61, 0x70, 0x69, 0x2e, + 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x43, 0x0a, + 0x04, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x1c, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x4c, 0x69, 0x73, 0x74, + 0x43, 0x61, 0x64, 0x64, 0x79, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x43, 0x61, + 0x64, 0x64, 0x79, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x43, 0x0a, 0x04, 0x53, 0x74, 0x61, 0x74, 0x12, 0x1c, 0x2e, 0x61, 0x70, 0x69, + 0x2e, 0x53, 0x74, 0x61, 0x74, 0x43, 0x61, 0x64, 0x64, 0x79, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, + 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x53, + 0x74, 0x61, 0x74, 0x43, 0x61, 0x64, 0x64, 0x79, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x37, 0x5a, 0x35, 0x67, 0x69, 0x74, 0x68, 0x75, + 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x73, 0x76, 0x69, 0x64, 0x65, 0x72, 0x73, 0x6b, 0x69, + 0x2f, 0x75, 0x6e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, + 0x6c, 0x2f, 0x6d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x62, + 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_internal_machine_api_pb_caddy_storage_proto_rawDescOnce sync.Once + file_internal_machine_api_pb_caddy_storage_proto_rawDescData = file_internal_machine_api_pb_caddy_storage_proto_rawDesc +) + +func file_internal_machine_api_pb_caddy_storage_proto_rawDescGZIP() []byte { + file_internal_machine_api_pb_caddy_storage_proto_rawDescOnce.Do(func() { + file_internal_machine_api_pb_caddy_storage_proto_rawDescData = protoimpl.X.CompressGZIP(file_internal_machine_api_pb_caddy_storage_proto_rawDescData) + }) + return file_internal_machine_api_pb_caddy_storage_proto_rawDescData +} + +var file_internal_machine_api_pb_caddy_storage_proto_msgTypes = make([]protoimpl.MessageInfo, 11) +var file_internal_machine_api_pb_caddy_storage_proto_goTypes = []any{ + (*StoreCaddyStorageRequest)(nil), // 0: api.StoreCaddyStorageRequest + (*LoadCaddyStorageRequest)(nil), // 1: api.LoadCaddyStorageRequest + (*LoadCaddyStorageResponse)(nil), // 2: api.LoadCaddyStorageResponse + (*MachineCaddyStorageValue)(nil), // 3: api.MachineCaddyStorageValue + (*DeleteCaddyStorageRequest)(nil), // 4: api.DeleteCaddyStorageRequest + (*ListCaddyStorageRequest)(nil), // 5: api.ListCaddyStorageRequest + (*ListCaddyStorageResponse)(nil), // 6: api.ListCaddyStorageResponse + (*MachineCaddyStorageKeys)(nil), // 7: api.MachineCaddyStorageKeys + (*StatCaddyStorageRequest)(nil), // 8: api.StatCaddyStorageRequest + (*StatCaddyStorageResponse)(nil), // 9: api.StatCaddyStorageResponse + (*MachineCaddyStorageKeyInfo)(nil), // 10: api.MachineCaddyStorageKeyInfo + (*Metadata)(nil), // 11: api.Metadata + (*timestamppb.Timestamp)(nil), // 12: google.protobuf.Timestamp + (*emptypb.Empty)(nil), // 13: google.protobuf.Empty + (*EmptyResponse)(nil), // 14: api.EmptyResponse +} +var file_internal_machine_api_pb_caddy_storage_proto_depIdxs = []int32{ + 3, // 0: api.LoadCaddyStorageResponse.messages:type_name -> api.MachineCaddyStorageValue + 11, // 1: api.MachineCaddyStorageValue.metadata:type_name -> api.Metadata + 12, // 2: api.MachineCaddyStorageValue.updated_at:type_name -> google.protobuf.Timestamp + 7, // 3: api.ListCaddyStorageResponse.messages:type_name -> api.MachineCaddyStorageKeys + 11, // 4: api.MachineCaddyStorageKeys.metadata:type_name -> api.Metadata + 10, // 5: api.StatCaddyStorageResponse.messages:type_name -> api.MachineCaddyStorageKeyInfo + 11, // 6: api.MachineCaddyStorageKeyInfo.metadata:type_name -> api.Metadata + 12, // 7: api.MachineCaddyStorageKeyInfo.updated_at:type_name -> google.protobuf.Timestamp + 0, // 8: api.CaddyStorage.Store:input_type -> api.StoreCaddyStorageRequest + 1, // 9: api.CaddyStorage.Load:input_type -> api.LoadCaddyStorageRequest + 4, // 10: api.CaddyStorage.Delete:input_type -> api.DeleteCaddyStorageRequest + 5, // 11: api.CaddyStorage.List:input_type -> api.ListCaddyStorageRequest + 8, // 12: api.CaddyStorage.Stat:input_type -> api.StatCaddyStorageRequest + 13, // 13: api.CaddyStorage.Store:output_type -> google.protobuf.Empty + 2, // 14: api.CaddyStorage.Load:output_type -> api.LoadCaddyStorageResponse + 14, // 15: api.CaddyStorage.Delete:output_type -> api.EmptyResponse + 6, // 16: api.CaddyStorage.List:output_type -> api.ListCaddyStorageResponse + 9, // 17: api.CaddyStorage.Stat:output_type -> api.StatCaddyStorageResponse + 13, // [13:18] is the sub-list for method output_type + 8, // [8:13] is the sub-list for method input_type + 8, // [8:8] is the sub-list for extension type_name + 8, // [8:8] is the sub-list for extension extendee + 0, // [0:8] is the sub-list for field type_name +} + +func init() { file_internal_machine_api_pb_caddy_storage_proto_init() } +func file_internal_machine_api_pb_caddy_storage_proto_init() { + if File_internal_machine_api_pb_caddy_storage_proto != nil { + return + } + file_internal_machine_api_pb_common_proto_init() + if !protoimpl.UnsafeEnabled { + file_internal_machine_api_pb_caddy_storage_proto_msgTypes[0].Exporter = func(v any, i int) any { + switch v := v.(*StoreCaddyStorageRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_internal_machine_api_pb_caddy_storage_proto_msgTypes[1].Exporter = func(v any, i int) any { + switch v := v.(*LoadCaddyStorageRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_internal_machine_api_pb_caddy_storage_proto_msgTypes[2].Exporter = func(v any, i int) any { + switch v := v.(*LoadCaddyStorageResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_internal_machine_api_pb_caddy_storage_proto_msgTypes[3].Exporter = func(v any, i int) any { + switch v := v.(*MachineCaddyStorageValue); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_internal_machine_api_pb_caddy_storage_proto_msgTypes[4].Exporter = func(v any, i int) any { + switch v := v.(*DeleteCaddyStorageRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_internal_machine_api_pb_caddy_storage_proto_msgTypes[5].Exporter = func(v any, i int) any { + switch v := v.(*ListCaddyStorageRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_internal_machine_api_pb_caddy_storage_proto_msgTypes[6].Exporter = func(v any, i int) any { + switch v := v.(*ListCaddyStorageResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_internal_machine_api_pb_caddy_storage_proto_msgTypes[7].Exporter = func(v any, i int) any { + switch v := v.(*MachineCaddyStorageKeys); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_internal_machine_api_pb_caddy_storage_proto_msgTypes[8].Exporter = func(v any, i int) any { + switch v := v.(*StatCaddyStorageRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_internal_machine_api_pb_caddy_storage_proto_msgTypes[9].Exporter = func(v any, i int) any { + switch v := v.(*StatCaddyStorageResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_internal_machine_api_pb_caddy_storage_proto_msgTypes[10].Exporter = func(v any, i int) any { + switch v := v.(*MachineCaddyStorageKeyInfo); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_internal_machine_api_pb_caddy_storage_proto_rawDesc, + NumEnums: 0, + NumMessages: 11, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_internal_machine_api_pb_caddy_storage_proto_goTypes, + DependencyIndexes: file_internal_machine_api_pb_caddy_storage_proto_depIdxs, + MessageInfos: file_internal_machine_api_pb_caddy_storage_proto_msgTypes, + }.Build() + File_internal_machine_api_pb_caddy_storage_proto = out.File + file_internal_machine_api_pb_caddy_storage_proto_rawDesc = nil + file_internal_machine_api_pb_caddy_storage_proto_goTypes = nil + file_internal_machine_api_pb_caddy_storage_proto_depIdxs = nil +} diff --git a/internal/machine/api/pb/caddy_storage.proto b/internal/machine/api/pb/caddy_storage.proto new file mode 100644 index 00000000..03f9c85e --- /dev/null +++ b/internal/machine/api/pb/caddy_storage.proto @@ -0,0 +1,74 @@ +syntax = "proto3"; + +package api; + +option go_package = "github.com/psviderski/uncloud/internal/machine/api/pb"; + +import "google/protobuf/empty.proto"; +import "google/protobuf/timestamp.proto"; +import "internal/machine/api/pb/common.proto"; + +// CaddyStorage exposes the CertMagic storage operations backed by the distributed cluster store. +service CaddyStorage { + rpc Store(StoreCaddyStorageRequest) returns (google.protobuf.Empty); + rpc Load(LoadCaddyStorageRequest) returns (LoadCaddyStorageResponse); + rpc Delete(DeleteCaddyStorageRequest) returns (EmptyResponse); + rpc List(ListCaddyStorageRequest) returns (ListCaddyStorageResponse); + rpc Stat(StatCaddyStorageRequest) returns (StatCaddyStorageResponse); +} + +message StoreCaddyStorageRequest { + string key = 1; + bytes value = 2; +} + +message LoadCaddyStorageRequest { + string key = 1; +} + +message LoadCaddyStorageResponse { + // Must contain only one repeated messages field to allow broadcasting Load requests to multiple machines. + repeated MachineCaddyStorageValue messages = 1; +} + +message MachineCaddyStorageValue { + Metadata metadata = 1; + bytes value = 2; + google.protobuf.Timestamp updated_at = 3; +} + +message DeleteCaddyStorageRequest { + string key = 1; +} + +message ListCaddyStorageRequest { + string prefix = 1; + bool recursive = 2; +} + +message ListCaddyStorageResponse { + // Must contain only one repeated messages field to allow broadcasting List requests to multiple machines. + repeated MachineCaddyStorageKeys messages = 1; +} + +message MachineCaddyStorageKeys { + Metadata metadata = 1; + repeated string keys = 2; +} + +message StatCaddyStorageRequest { + string key = 1; +} + +message StatCaddyStorageResponse { + // Must contain only one repeated messages field to allow broadcasting Stat requests to multiple machines. + repeated MachineCaddyStorageKeyInfo messages = 1; +} + +message MachineCaddyStorageKeyInfo { + Metadata metadata = 1; + string key = 2; + google.protobuf.Timestamp updated_at = 3; + int64 size = 4; + bool is_terminal = 5; +} diff --git a/internal/machine/api/pb/caddy_storage_grpc.pb.go b/internal/machine/api/pb/caddy_storage_grpc.pb.go new file mode 100644 index 00000000..56fd4812 --- /dev/null +++ b/internal/machine/api/pb/caddy_storage_grpc.pb.go @@ -0,0 +1,278 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.5.1 +// - protoc v5.27.3 +// source: internal/machine/api/pb/caddy_storage.proto + +package pb + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + emptypb "google.golang.org/protobuf/types/known/emptypb" +) + +// 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 ( + CaddyStorage_Store_FullMethodName = "/api.CaddyStorage/Store" + CaddyStorage_Load_FullMethodName = "/api.CaddyStorage/Load" + CaddyStorage_Delete_FullMethodName = "/api.CaddyStorage/Delete" + CaddyStorage_List_FullMethodName = "/api.CaddyStorage/List" + CaddyStorage_Stat_FullMethodName = "/api.CaddyStorage/Stat" +) + +// CaddyStorageClient is the client API for CaddyStorage 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. +// +// CaddyStorage exposes the CertMagic storage operations backed by the distributed cluster store. +type CaddyStorageClient interface { + Store(ctx context.Context, in *StoreCaddyStorageRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) + Load(ctx context.Context, in *LoadCaddyStorageRequest, opts ...grpc.CallOption) (*LoadCaddyStorageResponse, error) + Delete(ctx context.Context, in *DeleteCaddyStorageRequest, opts ...grpc.CallOption) (*EmptyResponse, error) + List(ctx context.Context, in *ListCaddyStorageRequest, opts ...grpc.CallOption) (*ListCaddyStorageResponse, error) + Stat(ctx context.Context, in *StatCaddyStorageRequest, opts ...grpc.CallOption) (*StatCaddyStorageResponse, error) +} + +type caddyStorageClient struct { + cc grpc.ClientConnInterface +} + +func NewCaddyStorageClient(cc grpc.ClientConnInterface) CaddyStorageClient { + return &caddyStorageClient{cc} +} + +func (c *caddyStorageClient) Store(ctx context.Context, in *StoreCaddyStorageRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(emptypb.Empty) + err := c.cc.Invoke(ctx, CaddyStorage_Store_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *caddyStorageClient) Load(ctx context.Context, in *LoadCaddyStorageRequest, opts ...grpc.CallOption) (*LoadCaddyStorageResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(LoadCaddyStorageResponse) + err := c.cc.Invoke(ctx, CaddyStorage_Load_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *caddyStorageClient) Delete(ctx context.Context, in *DeleteCaddyStorageRequest, opts ...grpc.CallOption) (*EmptyResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(EmptyResponse) + err := c.cc.Invoke(ctx, CaddyStorage_Delete_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *caddyStorageClient) List(ctx context.Context, in *ListCaddyStorageRequest, opts ...grpc.CallOption) (*ListCaddyStorageResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(ListCaddyStorageResponse) + err := c.cc.Invoke(ctx, CaddyStorage_List_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *caddyStorageClient) Stat(ctx context.Context, in *StatCaddyStorageRequest, opts ...grpc.CallOption) (*StatCaddyStorageResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(StatCaddyStorageResponse) + err := c.cc.Invoke(ctx, CaddyStorage_Stat_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +// CaddyStorageServer is the server API for CaddyStorage service. +// All implementations must embed UnimplementedCaddyStorageServer +// for forward compatibility. +// +// CaddyStorage exposes the CertMagic storage operations backed by the distributed cluster store. +type CaddyStorageServer interface { + Store(context.Context, *StoreCaddyStorageRequest) (*emptypb.Empty, error) + Load(context.Context, *LoadCaddyStorageRequest) (*LoadCaddyStorageResponse, error) + Delete(context.Context, *DeleteCaddyStorageRequest) (*EmptyResponse, error) + List(context.Context, *ListCaddyStorageRequest) (*ListCaddyStorageResponse, error) + Stat(context.Context, *StatCaddyStorageRequest) (*StatCaddyStorageResponse, error) + mustEmbedUnimplementedCaddyStorageServer() +} + +// UnimplementedCaddyStorageServer 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 UnimplementedCaddyStorageServer struct{} + +func (UnimplementedCaddyStorageServer) Store(context.Context, *StoreCaddyStorageRequest) (*emptypb.Empty, error) { + return nil, status.Errorf(codes.Unimplemented, "method Store not implemented") +} +func (UnimplementedCaddyStorageServer) Load(context.Context, *LoadCaddyStorageRequest) (*LoadCaddyStorageResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Load not implemented") +} +func (UnimplementedCaddyStorageServer) Delete(context.Context, *DeleteCaddyStorageRequest) (*EmptyResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Delete not implemented") +} +func (UnimplementedCaddyStorageServer) List(context.Context, *ListCaddyStorageRequest) (*ListCaddyStorageResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method List not implemented") +} +func (UnimplementedCaddyStorageServer) Stat(context.Context, *StatCaddyStorageRequest) (*StatCaddyStorageResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Stat not implemented") +} +func (UnimplementedCaddyStorageServer) mustEmbedUnimplementedCaddyStorageServer() {} +func (UnimplementedCaddyStorageServer) testEmbeddedByValue() {} + +// UnsafeCaddyStorageServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to CaddyStorageServer will +// result in compilation errors. +type UnsafeCaddyStorageServer interface { + mustEmbedUnimplementedCaddyStorageServer() +} + +func RegisterCaddyStorageServer(s grpc.ServiceRegistrar, srv CaddyStorageServer) { + // If the following call pancis, it indicates UnimplementedCaddyStorageServer 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(&CaddyStorage_ServiceDesc, srv) +} + +func _CaddyStorage_Store_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(StoreCaddyStorageRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(CaddyStorageServer).Store(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: CaddyStorage_Store_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(CaddyStorageServer).Store(ctx, req.(*StoreCaddyStorageRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _CaddyStorage_Load_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(LoadCaddyStorageRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(CaddyStorageServer).Load(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: CaddyStorage_Load_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(CaddyStorageServer).Load(ctx, req.(*LoadCaddyStorageRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _CaddyStorage_Delete_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeleteCaddyStorageRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(CaddyStorageServer).Delete(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: CaddyStorage_Delete_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(CaddyStorageServer).Delete(ctx, req.(*DeleteCaddyStorageRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _CaddyStorage_List_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListCaddyStorageRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(CaddyStorageServer).List(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: CaddyStorage_List_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(CaddyStorageServer).List(ctx, req.(*ListCaddyStorageRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _CaddyStorage_Stat_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(StatCaddyStorageRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(CaddyStorageServer).Stat(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: CaddyStorage_Stat_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(CaddyStorageServer).Stat(ctx, req.(*StatCaddyStorageRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// CaddyStorage_ServiceDesc is the grpc.ServiceDesc for CaddyStorage service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var CaddyStorage_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "api.CaddyStorage", + HandlerType: (*CaddyStorageServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Store", + Handler: _CaddyStorage_Store_Handler, + }, + { + MethodName: "Load", + Handler: _CaddyStorage_Load_Handler, + }, + { + MethodName: "Delete", + Handler: _CaddyStorage_Delete_Handler, + }, + { + MethodName: "List", + Handler: _CaddyStorage_List_Handler, + }, + { + MethodName: "Stat", + Handler: _CaddyStorage_Stat_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "internal/machine/api/pb/caddy_storage.proto", +}