diff --git a/sdk/go/Makefile b/sdk/go/Makefile new file mode 100644 index 0000000..2f7c837 --- /dev/null +++ b/sdk/go/Makefile @@ -0,0 +1,19 @@ +PROTO_DIR := gen/proto +OUT_DIR := aetherpb +PROTO_FILES := $(wildcard $(PROTO_DIR)/*.proto) + +.PHONY: proto tidy + +proto: + @mkdir -p $(OUT_DIR) + PATH="$(PATH):$(shell go env GOPATH)/bin" protoc \ + --proto_path=$(PROTO_DIR) \ + --go_out=$(OUT_DIR) --go_opt=paths=source_relative \ + --go-grpc_out=$(OUT_DIR) --go-grpc_opt=paths=source_relative,require_unimplemented_servers=false \ + $(PROTO_FILES) + @echo "Generated Go code in $(OUT_DIR)/" + +tidy: + go mod tidy + +generate: proto tidy diff --git a/sdk/go/aetherpb/auth.pb.go b/sdk/go/aetherpb/auth.pb.go new file mode 100644 index 0000000..14db6b3 --- /dev/null +++ b/sdk/go/aetherpb/auth.pb.go @@ -0,0 +1,2090 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.6 +// protoc v6.32.0 +// source: auth.proto + +package aetherpb + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + 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) +) + +// PermissionType defines the type of permission. +type PermissionType int32 + +const ( + PermissionType_PERMISSION_TYPE_READ PermissionType = 0 + PermissionType_PERMISSION_TYPE_WRITE PermissionType = 1 + PermissionType_PERMISSION_TYPE_READWRITE PermissionType = 2 +) + +// Enum value maps for PermissionType. +var ( + PermissionType_name = map[int32]string{ + 0: "PERMISSION_TYPE_READ", + 1: "PERMISSION_TYPE_WRITE", + 2: "PERMISSION_TYPE_READWRITE", + } + PermissionType_value = map[string]int32{ + "PERMISSION_TYPE_READ": 0, + "PERMISSION_TYPE_WRITE": 1, + "PERMISSION_TYPE_READWRITE": 2, + } +) + +func (x PermissionType) Enum() *PermissionType { + p := new(PermissionType) + *p = x + return p +} + +func (x PermissionType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (PermissionType) Descriptor() protoreflect.EnumDescriptor { + return file_auth_proto_enumTypes[0].Descriptor() +} + +func (PermissionType) Type() protoreflect.EnumType { + return &file_auth_proto_enumTypes[0] +} + +func (x PermissionType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use PermissionType.Descriptor instead. +func (PermissionType) EnumDescriptor() ([]byte, []int) { + return file_auth_proto_rawDescGZIP(), []int{0} +} + +// Permission defines a key-range permission. +type Permission struct { + state protoimpl.MessageState `protogen:"open.v1"` + PermType PermissionType `protobuf:"varint,1,opt,name=perm_type,json=permType,proto3,enum=aether.PermissionType" json:"perm_type,omitempty"` + Key []byte `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"` + RangeEnd []byte `protobuf:"bytes,3,opt,name=range_end,json=rangeEnd,proto3" json:"range_end,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Permission) Reset() { + *x = Permission{} + mi := &file_auth_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Permission) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Permission) ProtoMessage() {} + +func (x *Permission) ProtoReflect() protoreflect.Message { + mi := &file_auth_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 Permission.ProtoReflect.Descriptor instead. +func (*Permission) Descriptor() ([]byte, []int) { + return file_auth_proto_rawDescGZIP(), []int{0} +} + +func (x *Permission) GetPermType() PermissionType { + if x != nil { + return x.PermType + } + return PermissionType_PERMISSION_TYPE_READ +} + +func (x *Permission) GetKey() []byte { + if x != nil { + return x.Key + } + return nil +} + +func (x *Permission) GetRangeEnd() []byte { + if x != nil { + return x.RangeEnd + } + return nil +} + +// User represents an authenticated user. +type AuthUser struct { + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Roles []string `protobuf:"bytes,2,rep,name=roles,proto3" json:"roles,omitempty"` + Enabled bool `protobuf:"varint,3,opt,name=enabled,proto3" json:"enabled,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *AuthUser) Reset() { + *x = AuthUser{} + mi := &file_auth_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *AuthUser) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AuthUser) ProtoMessage() {} + +func (x *AuthUser) ProtoReflect() protoreflect.Message { + mi := &file_auth_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 AuthUser.ProtoReflect.Descriptor instead. +func (*AuthUser) Descriptor() ([]byte, []int) { + return file_auth_proto_rawDescGZIP(), []int{1} +} + +func (x *AuthUser) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *AuthUser) GetRoles() []string { + if x != nil { + return x.Roles + } + return nil +} + +func (x *AuthUser) GetEnabled() bool { + if x != nil { + return x.Enabled + } + return false +} + +// Role represents an authorization role. +type AuthRole struct { + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Permissions []*Permission `protobuf:"bytes,2,rep,name=permissions,proto3" json:"permissions,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *AuthRole) Reset() { + *x = AuthRole{} + mi := &file_auth_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *AuthRole) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AuthRole) ProtoMessage() {} + +func (x *AuthRole) ProtoReflect() protoreflect.Message { + mi := &file_auth_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 AuthRole.ProtoReflect.Descriptor instead. +func (*AuthRole) Descriptor() ([]byte, []int) { + return file_auth_proto_rawDescGZIP(), []int{2} +} + +func (x *AuthRole) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *AuthRole) GetPermissions() []*Permission { + if x != nil { + return x.Permissions + } + return nil +} + +type UserAddRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Password []byte `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *UserAddRequest) Reset() { + *x = UserAddRequest{} + mi := &file_auth_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *UserAddRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UserAddRequest) ProtoMessage() {} + +func (x *UserAddRequest) ProtoReflect() protoreflect.Message { + mi := &file_auth_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 UserAddRequest.ProtoReflect.Descriptor instead. +func (*UserAddRequest) Descriptor() ([]byte, []int) { + return file_auth_proto_rawDescGZIP(), []int{3} +} + +func (x *UserAddRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *UserAddRequest) GetPassword() []byte { + if x != nil { + return x.Password + } + return nil +} + +type UserAddResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *UserAddResponse) Reset() { + *x = UserAddResponse{} + mi := &file_auth_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *UserAddResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UserAddResponse) ProtoMessage() {} + +func (x *UserAddResponse) ProtoReflect() protoreflect.Message { + mi := &file_auth_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 UserAddResponse.ProtoReflect.Descriptor instead. +func (*UserAddResponse) Descriptor() ([]byte, []int) { + return file_auth_proto_rawDescGZIP(), []int{4} +} + +func (x *UserAddResponse) GetHeader() *ResponseHeader { + if x != nil { + return x.Header + } + return nil +} + +type UserDeleteRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *UserDeleteRequest) Reset() { + *x = UserDeleteRequest{} + mi := &file_auth_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *UserDeleteRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UserDeleteRequest) ProtoMessage() {} + +func (x *UserDeleteRequest) ProtoReflect() protoreflect.Message { + mi := &file_auth_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 UserDeleteRequest.ProtoReflect.Descriptor instead. +func (*UserDeleteRequest) Descriptor() ([]byte, []int) { + return file_auth_proto_rawDescGZIP(), []int{5} +} + +func (x *UserDeleteRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +type UserDeleteResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *UserDeleteResponse) Reset() { + *x = UserDeleteResponse{} + mi := &file_auth_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *UserDeleteResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UserDeleteResponse) ProtoMessage() {} + +func (x *UserDeleteResponse) ProtoReflect() protoreflect.Message { + mi := &file_auth_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 UserDeleteResponse.ProtoReflect.Descriptor instead. +func (*UserDeleteResponse) Descriptor() ([]byte, []int) { + return file_auth_proto_rawDescGZIP(), []int{6} +} + +func (x *UserDeleteResponse) GetHeader() *ResponseHeader { + if x != nil { + return x.Header + } + return nil +} + +type UserGetRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *UserGetRequest) Reset() { + *x = UserGetRequest{} + mi := &file_auth_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *UserGetRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UserGetRequest) ProtoMessage() {} + +func (x *UserGetRequest) ProtoReflect() protoreflect.Message { + mi := &file_auth_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 UserGetRequest.ProtoReflect.Descriptor instead. +func (*UserGetRequest) Descriptor() ([]byte, []int) { + return file_auth_proto_rawDescGZIP(), []int{7} +} + +func (x *UserGetRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +type UserGetResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` + User *AuthUser `protobuf:"bytes,2,opt,name=user,proto3" json:"user,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *UserGetResponse) Reset() { + *x = UserGetResponse{} + mi := &file_auth_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *UserGetResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UserGetResponse) ProtoMessage() {} + +func (x *UserGetResponse) ProtoReflect() protoreflect.Message { + mi := &file_auth_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 UserGetResponse.ProtoReflect.Descriptor instead. +func (*UserGetResponse) Descriptor() ([]byte, []int) { + return file_auth_proto_rawDescGZIP(), []int{8} +} + +func (x *UserGetResponse) GetHeader() *ResponseHeader { + if x != nil { + return x.Header + } + return nil +} + +func (x *UserGetResponse) GetUser() *AuthUser { + if x != nil { + return x.User + } + return nil +} + +type UserListRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *UserListRequest) Reset() { + *x = UserListRequest{} + mi := &file_auth_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *UserListRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UserListRequest) ProtoMessage() {} + +func (x *UserListRequest) ProtoReflect() protoreflect.Message { + mi := &file_auth_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 UserListRequest.ProtoReflect.Descriptor instead. +func (*UserListRequest) Descriptor() ([]byte, []int) { + return file_auth_proto_rawDescGZIP(), []int{9} +} + +type UserListResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` + Users []*AuthUser `protobuf:"bytes,2,rep,name=users,proto3" json:"users,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *UserListResponse) Reset() { + *x = UserListResponse{} + mi := &file_auth_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *UserListResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UserListResponse) ProtoMessage() {} + +func (x *UserListResponse) ProtoReflect() protoreflect.Message { + mi := &file_auth_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 UserListResponse.ProtoReflect.Descriptor instead. +func (*UserListResponse) Descriptor() ([]byte, []int) { + return file_auth_proto_rawDescGZIP(), []int{10} +} + +func (x *UserListResponse) GetHeader() *ResponseHeader { + if x != nil { + return x.Header + } + return nil +} + +func (x *UserListResponse) GetUsers() []*AuthUser { + if x != nil { + return x.Users + } + return nil +} + +type UserChangePasswordRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Password []byte `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *UserChangePasswordRequest) Reset() { + *x = UserChangePasswordRequest{} + mi := &file_auth_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *UserChangePasswordRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UserChangePasswordRequest) ProtoMessage() {} + +func (x *UserChangePasswordRequest) ProtoReflect() protoreflect.Message { + mi := &file_auth_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 UserChangePasswordRequest.ProtoReflect.Descriptor instead. +func (*UserChangePasswordRequest) Descriptor() ([]byte, []int) { + return file_auth_proto_rawDescGZIP(), []int{11} +} + +func (x *UserChangePasswordRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *UserChangePasswordRequest) GetPassword() []byte { + if x != nil { + return x.Password + } + return nil +} + +type UserChangePasswordResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *UserChangePasswordResponse) Reset() { + *x = UserChangePasswordResponse{} + mi := &file_auth_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *UserChangePasswordResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UserChangePasswordResponse) ProtoMessage() {} + +func (x *UserChangePasswordResponse) ProtoReflect() protoreflect.Message { + mi := &file_auth_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 UserChangePasswordResponse.ProtoReflect.Descriptor instead. +func (*UserChangePasswordResponse) Descriptor() ([]byte, []int) { + return file_auth_proto_rawDescGZIP(), []int{12} +} + +func (x *UserChangePasswordResponse) GetHeader() *ResponseHeader { + if x != nil { + return x.Header + } + return nil +} + +type UserGrantRoleRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + User string `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"` + Role string `protobuf:"bytes,2,opt,name=role,proto3" json:"role,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *UserGrantRoleRequest) Reset() { + *x = UserGrantRoleRequest{} + mi := &file_auth_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *UserGrantRoleRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UserGrantRoleRequest) ProtoMessage() {} + +func (x *UserGrantRoleRequest) ProtoReflect() protoreflect.Message { + mi := &file_auth_proto_msgTypes[13] + 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 UserGrantRoleRequest.ProtoReflect.Descriptor instead. +func (*UserGrantRoleRequest) Descriptor() ([]byte, []int) { + return file_auth_proto_rawDescGZIP(), []int{13} +} + +func (x *UserGrantRoleRequest) GetUser() string { + if x != nil { + return x.User + } + return "" +} + +func (x *UserGrantRoleRequest) GetRole() string { + if x != nil { + return x.Role + } + return "" +} + +type UserGrantRoleResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *UserGrantRoleResponse) Reset() { + *x = UserGrantRoleResponse{} + mi := &file_auth_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *UserGrantRoleResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UserGrantRoleResponse) ProtoMessage() {} + +func (x *UserGrantRoleResponse) ProtoReflect() protoreflect.Message { + mi := &file_auth_proto_msgTypes[14] + 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 UserGrantRoleResponse.ProtoReflect.Descriptor instead. +func (*UserGrantRoleResponse) Descriptor() ([]byte, []int) { + return file_auth_proto_rawDescGZIP(), []int{14} +} + +func (x *UserGrantRoleResponse) GetHeader() *ResponseHeader { + if x != nil { + return x.Header + } + return nil +} + +type UserRevokeRoleRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + User string `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"` + Role string `protobuf:"bytes,2,opt,name=role,proto3" json:"role,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *UserRevokeRoleRequest) Reset() { + *x = UserRevokeRoleRequest{} + mi := &file_auth_proto_msgTypes[15] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *UserRevokeRoleRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UserRevokeRoleRequest) ProtoMessage() {} + +func (x *UserRevokeRoleRequest) ProtoReflect() protoreflect.Message { + mi := &file_auth_proto_msgTypes[15] + 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 UserRevokeRoleRequest.ProtoReflect.Descriptor instead. +func (*UserRevokeRoleRequest) Descriptor() ([]byte, []int) { + return file_auth_proto_rawDescGZIP(), []int{15} +} + +func (x *UserRevokeRoleRequest) GetUser() string { + if x != nil { + return x.User + } + return "" +} + +func (x *UserRevokeRoleRequest) GetRole() string { + if x != nil { + return x.Role + } + return "" +} + +type UserRevokeRoleResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *UserRevokeRoleResponse) Reset() { + *x = UserRevokeRoleResponse{} + mi := &file_auth_proto_msgTypes[16] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *UserRevokeRoleResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UserRevokeRoleResponse) ProtoMessage() {} + +func (x *UserRevokeRoleResponse) ProtoReflect() protoreflect.Message { + mi := &file_auth_proto_msgTypes[16] + 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 UserRevokeRoleResponse.ProtoReflect.Descriptor instead. +func (*UserRevokeRoleResponse) Descriptor() ([]byte, []int) { + return file_auth_proto_rawDescGZIP(), []int{16} +} + +func (x *UserRevokeRoleResponse) GetHeader() *ResponseHeader { + if x != nil { + return x.Header + } + return nil +} + +type RoleAddRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RoleAddRequest) Reset() { + *x = RoleAddRequest{} + mi := &file_auth_proto_msgTypes[17] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RoleAddRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RoleAddRequest) ProtoMessage() {} + +func (x *RoleAddRequest) ProtoReflect() protoreflect.Message { + mi := &file_auth_proto_msgTypes[17] + 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 RoleAddRequest.ProtoReflect.Descriptor instead. +func (*RoleAddRequest) Descriptor() ([]byte, []int) { + return file_auth_proto_rawDescGZIP(), []int{17} +} + +func (x *RoleAddRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +type RoleAddResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RoleAddResponse) Reset() { + *x = RoleAddResponse{} + mi := &file_auth_proto_msgTypes[18] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RoleAddResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RoleAddResponse) ProtoMessage() {} + +func (x *RoleAddResponse) ProtoReflect() protoreflect.Message { + mi := &file_auth_proto_msgTypes[18] + 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 RoleAddResponse.ProtoReflect.Descriptor instead. +func (*RoleAddResponse) Descriptor() ([]byte, []int) { + return file_auth_proto_rawDescGZIP(), []int{18} +} + +func (x *RoleAddResponse) GetHeader() *ResponseHeader { + if x != nil { + return x.Header + } + return nil +} + +type RoleDeleteRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RoleDeleteRequest) Reset() { + *x = RoleDeleteRequest{} + mi := &file_auth_proto_msgTypes[19] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RoleDeleteRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RoleDeleteRequest) ProtoMessage() {} + +func (x *RoleDeleteRequest) ProtoReflect() protoreflect.Message { + mi := &file_auth_proto_msgTypes[19] + 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 RoleDeleteRequest.ProtoReflect.Descriptor instead. +func (*RoleDeleteRequest) Descriptor() ([]byte, []int) { + return file_auth_proto_rawDescGZIP(), []int{19} +} + +func (x *RoleDeleteRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +type RoleDeleteResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RoleDeleteResponse) Reset() { + *x = RoleDeleteResponse{} + mi := &file_auth_proto_msgTypes[20] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RoleDeleteResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RoleDeleteResponse) ProtoMessage() {} + +func (x *RoleDeleteResponse) ProtoReflect() protoreflect.Message { + mi := &file_auth_proto_msgTypes[20] + 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 RoleDeleteResponse.ProtoReflect.Descriptor instead. +func (*RoleDeleteResponse) Descriptor() ([]byte, []int) { + return file_auth_proto_rawDescGZIP(), []int{20} +} + +func (x *RoleDeleteResponse) GetHeader() *ResponseHeader { + if x != nil { + return x.Header + } + return nil +} + +type RoleGetRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RoleGetRequest) Reset() { + *x = RoleGetRequest{} + mi := &file_auth_proto_msgTypes[21] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RoleGetRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RoleGetRequest) ProtoMessage() {} + +func (x *RoleGetRequest) ProtoReflect() protoreflect.Message { + mi := &file_auth_proto_msgTypes[21] + 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 RoleGetRequest.ProtoReflect.Descriptor instead. +func (*RoleGetRequest) Descriptor() ([]byte, []int) { + return file_auth_proto_rawDescGZIP(), []int{21} +} + +func (x *RoleGetRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +type RoleGetResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` + Role *AuthRole `protobuf:"bytes,2,opt,name=role,proto3" json:"role,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RoleGetResponse) Reset() { + *x = RoleGetResponse{} + mi := &file_auth_proto_msgTypes[22] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RoleGetResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RoleGetResponse) ProtoMessage() {} + +func (x *RoleGetResponse) ProtoReflect() protoreflect.Message { + mi := &file_auth_proto_msgTypes[22] + 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 RoleGetResponse.ProtoReflect.Descriptor instead. +func (*RoleGetResponse) Descriptor() ([]byte, []int) { + return file_auth_proto_rawDescGZIP(), []int{22} +} + +func (x *RoleGetResponse) GetHeader() *ResponseHeader { + if x != nil { + return x.Header + } + return nil +} + +func (x *RoleGetResponse) GetRole() *AuthRole { + if x != nil { + return x.Role + } + return nil +} + +type RoleListRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RoleListRequest) Reset() { + *x = RoleListRequest{} + mi := &file_auth_proto_msgTypes[23] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RoleListRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RoleListRequest) ProtoMessage() {} + +func (x *RoleListRequest) ProtoReflect() protoreflect.Message { + mi := &file_auth_proto_msgTypes[23] + 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 RoleListRequest.ProtoReflect.Descriptor instead. +func (*RoleListRequest) Descriptor() ([]byte, []int) { + return file_auth_proto_rawDescGZIP(), []int{23} +} + +type RoleListResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` + Roles []*AuthRole `protobuf:"bytes,2,rep,name=roles,proto3" json:"roles,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RoleListResponse) Reset() { + *x = RoleListResponse{} + mi := &file_auth_proto_msgTypes[24] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RoleListResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RoleListResponse) ProtoMessage() {} + +func (x *RoleListResponse) ProtoReflect() protoreflect.Message { + mi := &file_auth_proto_msgTypes[24] + 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 RoleListResponse.ProtoReflect.Descriptor instead. +func (*RoleListResponse) Descriptor() ([]byte, []int) { + return file_auth_proto_rawDescGZIP(), []int{24} +} + +func (x *RoleListResponse) GetHeader() *ResponseHeader { + if x != nil { + return x.Header + } + return nil +} + +func (x *RoleListResponse) GetRoles() []*AuthRole { + if x != nil { + return x.Roles + } + return nil +} + +type RoleGrantPermissionRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Role string `protobuf:"bytes,1,opt,name=role,proto3" json:"role,omitempty"` + Permission *Permission `protobuf:"bytes,2,opt,name=permission,proto3" json:"permission,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RoleGrantPermissionRequest) Reset() { + *x = RoleGrantPermissionRequest{} + mi := &file_auth_proto_msgTypes[25] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RoleGrantPermissionRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RoleGrantPermissionRequest) ProtoMessage() {} + +func (x *RoleGrantPermissionRequest) ProtoReflect() protoreflect.Message { + mi := &file_auth_proto_msgTypes[25] + 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 RoleGrantPermissionRequest.ProtoReflect.Descriptor instead. +func (*RoleGrantPermissionRequest) Descriptor() ([]byte, []int) { + return file_auth_proto_rawDescGZIP(), []int{25} +} + +func (x *RoleGrantPermissionRequest) GetRole() string { + if x != nil { + return x.Role + } + return "" +} + +func (x *RoleGrantPermissionRequest) GetPermission() *Permission { + if x != nil { + return x.Permission + } + return nil +} + +type RoleGrantPermissionResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RoleGrantPermissionResponse) Reset() { + *x = RoleGrantPermissionResponse{} + mi := &file_auth_proto_msgTypes[26] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RoleGrantPermissionResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RoleGrantPermissionResponse) ProtoMessage() {} + +func (x *RoleGrantPermissionResponse) ProtoReflect() protoreflect.Message { + mi := &file_auth_proto_msgTypes[26] + 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 RoleGrantPermissionResponse.ProtoReflect.Descriptor instead. +func (*RoleGrantPermissionResponse) Descriptor() ([]byte, []int) { + return file_auth_proto_rawDescGZIP(), []int{26} +} + +func (x *RoleGrantPermissionResponse) GetHeader() *ResponseHeader { + if x != nil { + return x.Header + } + return nil +} + +type RoleRevokePermissionRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Role string `protobuf:"bytes,1,opt,name=role,proto3" json:"role,omitempty"` + Permission *Permission `protobuf:"bytes,2,opt,name=permission,proto3" json:"permission,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RoleRevokePermissionRequest) Reset() { + *x = RoleRevokePermissionRequest{} + mi := &file_auth_proto_msgTypes[27] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RoleRevokePermissionRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RoleRevokePermissionRequest) ProtoMessage() {} + +func (x *RoleRevokePermissionRequest) ProtoReflect() protoreflect.Message { + mi := &file_auth_proto_msgTypes[27] + 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 RoleRevokePermissionRequest.ProtoReflect.Descriptor instead. +func (*RoleRevokePermissionRequest) Descriptor() ([]byte, []int) { + return file_auth_proto_rawDescGZIP(), []int{27} +} + +func (x *RoleRevokePermissionRequest) GetRole() string { + if x != nil { + return x.Role + } + return "" +} + +func (x *RoleRevokePermissionRequest) GetPermission() *Permission { + if x != nil { + return x.Permission + } + return nil +} + +type RoleRevokePermissionResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RoleRevokePermissionResponse) Reset() { + *x = RoleRevokePermissionResponse{} + mi := &file_auth_proto_msgTypes[28] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RoleRevokePermissionResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RoleRevokePermissionResponse) ProtoMessage() {} + +func (x *RoleRevokePermissionResponse) ProtoReflect() protoreflect.Message { + mi := &file_auth_proto_msgTypes[28] + 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 RoleRevokePermissionResponse.ProtoReflect.Descriptor instead. +func (*RoleRevokePermissionResponse) Descriptor() ([]byte, []int) { + return file_auth_proto_rawDescGZIP(), []int{28} +} + +func (x *RoleRevokePermissionResponse) GetHeader() *ResponseHeader { + if x != nil { + return x.Header + } + return nil +} + +type AuthenticateRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Password []byte `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *AuthenticateRequest) Reset() { + *x = AuthenticateRequest{} + mi := &file_auth_proto_msgTypes[29] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *AuthenticateRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AuthenticateRequest) ProtoMessage() {} + +func (x *AuthenticateRequest) ProtoReflect() protoreflect.Message { + mi := &file_auth_proto_msgTypes[29] + 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 AuthenticateRequest.ProtoReflect.Descriptor instead. +func (*AuthenticateRequest) Descriptor() ([]byte, []int) { + return file_auth_proto_rawDescGZIP(), []int{29} +} + +func (x *AuthenticateRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *AuthenticateRequest) GetPassword() []byte { + if x != nil { + return x.Password + } + return nil +} + +type AuthenticateResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` + Token string `protobuf:"bytes,2,opt,name=token,proto3" json:"token,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *AuthenticateResponse) Reset() { + *x = AuthenticateResponse{} + mi := &file_auth_proto_msgTypes[30] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *AuthenticateResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AuthenticateResponse) ProtoMessage() {} + +func (x *AuthenticateResponse) ProtoReflect() protoreflect.Message { + mi := &file_auth_proto_msgTypes[30] + 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 AuthenticateResponse.ProtoReflect.Descriptor instead. +func (*AuthenticateResponse) Descriptor() ([]byte, []int) { + return file_auth_proto_rawDescGZIP(), []int{30} +} + +func (x *AuthenticateResponse) GetHeader() *ResponseHeader { + if x != nil { + return x.Header + } + return nil +} + +func (x *AuthenticateResponse) GetToken() string { + if x != nil { + return x.Token + } + return "" +} + +type AuthEnableRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + RootPassword []byte `protobuf:"bytes,1,opt,name=root_password,json=rootPassword,proto3" json:"root_password,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *AuthEnableRequest) Reset() { + *x = AuthEnableRequest{} + mi := &file_auth_proto_msgTypes[31] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *AuthEnableRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AuthEnableRequest) ProtoMessage() {} + +func (x *AuthEnableRequest) ProtoReflect() protoreflect.Message { + mi := &file_auth_proto_msgTypes[31] + 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 AuthEnableRequest.ProtoReflect.Descriptor instead. +func (*AuthEnableRequest) Descriptor() ([]byte, []int) { + return file_auth_proto_rawDescGZIP(), []int{31} +} + +func (x *AuthEnableRequest) GetRootPassword() []byte { + if x != nil { + return x.RootPassword + } + return nil +} + +type AuthEnableResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *AuthEnableResponse) Reset() { + *x = AuthEnableResponse{} + mi := &file_auth_proto_msgTypes[32] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *AuthEnableResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AuthEnableResponse) ProtoMessage() {} + +func (x *AuthEnableResponse) ProtoReflect() protoreflect.Message { + mi := &file_auth_proto_msgTypes[32] + 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 AuthEnableResponse.ProtoReflect.Descriptor instead. +func (*AuthEnableResponse) Descriptor() ([]byte, []int) { + return file_auth_proto_rawDescGZIP(), []int{32} +} + +func (x *AuthEnableResponse) GetHeader() *ResponseHeader { + if x != nil { + return x.Header + } + return nil +} + +type AuthDisableRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *AuthDisableRequest) Reset() { + *x = AuthDisableRequest{} + mi := &file_auth_proto_msgTypes[33] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *AuthDisableRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AuthDisableRequest) ProtoMessage() {} + +func (x *AuthDisableRequest) ProtoReflect() protoreflect.Message { + mi := &file_auth_proto_msgTypes[33] + 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 AuthDisableRequest.ProtoReflect.Descriptor instead. +func (*AuthDisableRequest) Descriptor() ([]byte, []int) { + return file_auth_proto_rawDescGZIP(), []int{33} +} + +type AuthDisableResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *AuthDisableResponse) Reset() { + *x = AuthDisableResponse{} + mi := &file_auth_proto_msgTypes[34] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *AuthDisableResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AuthDisableResponse) ProtoMessage() {} + +func (x *AuthDisableResponse) ProtoReflect() protoreflect.Message { + mi := &file_auth_proto_msgTypes[34] + 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 AuthDisableResponse.ProtoReflect.Descriptor instead. +func (*AuthDisableResponse) Descriptor() ([]byte, []int) { + return file_auth_proto_rawDescGZIP(), []int{34} +} + +func (x *AuthDisableResponse) GetHeader() *ResponseHeader { + if x != nil { + return x.Header + } + return nil +} + +type AuthStatusRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *AuthStatusRequest) Reset() { + *x = AuthStatusRequest{} + mi := &file_auth_proto_msgTypes[35] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *AuthStatusRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AuthStatusRequest) ProtoMessage() {} + +func (x *AuthStatusRequest) ProtoReflect() protoreflect.Message { + mi := &file_auth_proto_msgTypes[35] + 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 AuthStatusRequest.ProtoReflect.Descriptor instead. +func (*AuthStatusRequest) Descriptor() ([]byte, []int) { + return file_auth_proto_rawDescGZIP(), []int{35} +} + +type AuthStatusResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` + Enabled bool `protobuf:"varint,2,opt,name=enabled,proto3" json:"enabled,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *AuthStatusResponse) Reset() { + *x = AuthStatusResponse{} + mi := &file_auth_proto_msgTypes[36] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *AuthStatusResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AuthStatusResponse) ProtoMessage() {} + +func (x *AuthStatusResponse) ProtoReflect() protoreflect.Message { + mi := &file_auth_proto_msgTypes[36] + 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 AuthStatusResponse.ProtoReflect.Descriptor instead. +func (*AuthStatusResponse) Descriptor() ([]byte, []int) { + return file_auth_proto_rawDescGZIP(), []int{36} +} + +func (x *AuthStatusResponse) GetHeader() *ResponseHeader { + if x != nil { + return x.Header + } + return nil +} + +func (x *AuthStatusResponse) GetEnabled() bool { + if x != nil { + return x.Enabled + } + return false +} + +var File_auth_proto protoreflect.FileDescriptor + +const file_auth_proto_rawDesc = "" + + "\n" + + "\n" + + "auth.proto\x12\x06aether\x1a\fcommon.proto\"p\n" + + "\n" + + "Permission\x123\n" + + "\tperm_type\x18\x01 \x01(\x0e2\x16.aether.PermissionTypeR\bpermType\x12\x10\n" + + "\x03key\x18\x02 \x01(\fR\x03key\x12\x1b\n" + + "\trange_end\x18\x03 \x01(\fR\brangeEnd\"N\n" + + "\bAuthUser\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12\x14\n" + + "\x05roles\x18\x02 \x03(\tR\x05roles\x12\x18\n" + + "\aenabled\x18\x03 \x01(\bR\aenabled\"T\n" + + "\bAuthRole\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x124\n" + + "\vpermissions\x18\x02 \x03(\v2\x12.aether.PermissionR\vpermissions\"@\n" + + "\x0eUserAddRequest\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12\x1a\n" + + "\bpassword\x18\x02 \x01(\fR\bpassword\"A\n" + + "\x0fUserAddResponse\x12.\n" + + "\x06header\x18\x01 \x01(\v2\x16.aether.ResponseHeaderR\x06header\"'\n" + + "\x11UserDeleteRequest\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\"D\n" + + "\x12UserDeleteResponse\x12.\n" + + "\x06header\x18\x01 \x01(\v2\x16.aether.ResponseHeaderR\x06header\"$\n" + + "\x0eUserGetRequest\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\"g\n" + + "\x0fUserGetResponse\x12.\n" + + "\x06header\x18\x01 \x01(\v2\x16.aether.ResponseHeaderR\x06header\x12$\n" + + "\x04user\x18\x02 \x01(\v2\x10.aether.AuthUserR\x04user\"\x11\n" + + "\x0fUserListRequest\"j\n" + + "\x10UserListResponse\x12.\n" + + "\x06header\x18\x01 \x01(\v2\x16.aether.ResponseHeaderR\x06header\x12&\n" + + "\x05users\x18\x02 \x03(\v2\x10.aether.AuthUserR\x05users\"K\n" + + "\x19UserChangePasswordRequest\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12\x1a\n" + + "\bpassword\x18\x02 \x01(\fR\bpassword\"L\n" + + "\x1aUserChangePasswordResponse\x12.\n" + + "\x06header\x18\x01 \x01(\v2\x16.aether.ResponseHeaderR\x06header\">\n" + + "\x14UserGrantRoleRequest\x12\x12\n" + + "\x04user\x18\x01 \x01(\tR\x04user\x12\x12\n" + + "\x04role\x18\x02 \x01(\tR\x04role\"G\n" + + "\x15UserGrantRoleResponse\x12.\n" + + "\x06header\x18\x01 \x01(\v2\x16.aether.ResponseHeaderR\x06header\"?\n" + + "\x15UserRevokeRoleRequest\x12\x12\n" + + "\x04user\x18\x01 \x01(\tR\x04user\x12\x12\n" + + "\x04role\x18\x02 \x01(\tR\x04role\"H\n" + + "\x16UserRevokeRoleResponse\x12.\n" + + "\x06header\x18\x01 \x01(\v2\x16.aether.ResponseHeaderR\x06header\"$\n" + + "\x0eRoleAddRequest\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\"A\n" + + "\x0fRoleAddResponse\x12.\n" + + "\x06header\x18\x01 \x01(\v2\x16.aether.ResponseHeaderR\x06header\"'\n" + + "\x11RoleDeleteRequest\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\"D\n" + + "\x12RoleDeleteResponse\x12.\n" + + "\x06header\x18\x01 \x01(\v2\x16.aether.ResponseHeaderR\x06header\"$\n" + + "\x0eRoleGetRequest\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\"g\n" + + "\x0fRoleGetResponse\x12.\n" + + "\x06header\x18\x01 \x01(\v2\x16.aether.ResponseHeaderR\x06header\x12$\n" + + "\x04role\x18\x02 \x01(\v2\x10.aether.AuthRoleR\x04role\"\x11\n" + + "\x0fRoleListRequest\"j\n" + + "\x10RoleListResponse\x12.\n" + + "\x06header\x18\x01 \x01(\v2\x16.aether.ResponseHeaderR\x06header\x12&\n" + + "\x05roles\x18\x02 \x03(\v2\x10.aether.AuthRoleR\x05roles\"d\n" + + "\x1aRoleGrantPermissionRequest\x12\x12\n" + + "\x04role\x18\x01 \x01(\tR\x04role\x122\n" + + "\n" + + "permission\x18\x02 \x01(\v2\x12.aether.PermissionR\n" + + "permission\"M\n" + + "\x1bRoleGrantPermissionResponse\x12.\n" + + "\x06header\x18\x01 \x01(\v2\x16.aether.ResponseHeaderR\x06header\"e\n" + + "\x1bRoleRevokePermissionRequest\x12\x12\n" + + "\x04role\x18\x01 \x01(\tR\x04role\x122\n" + + "\n" + + "permission\x18\x02 \x01(\v2\x12.aether.PermissionR\n" + + "permission\"N\n" + + "\x1cRoleRevokePermissionResponse\x12.\n" + + "\x06header\x18\x01 \x01(\v2\x16.aether.ResponseHeaderR\x06header\"E\n" + + "\x13AuthenticateRequest\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12\x1a\n" + + "\bpassword\x18\x02 \x01(\fR\bpassword\"\\\n" + + "\x14AuthenticateResponse\x12.\n" + + "\x06header\x18\x01 \x01(\v2\x16.aether.ResponseHeaderR\x06header\x12\x14\n" + + "\x05token\x18\x02 \x01(\tR\x05token\"8\n" + + "\x11AuthEnableRequest\x12#\n" + + "\rroot_password\x18\x01 \x01(\fR\frootPassword\"D\n" + + "\x12AuthEnableResponse\x12.\n" + + "\x06header\x18\x01 \x01(\v2\x16.aether.ResponseHeaderR\x06header\"\x14\n" + + "\x12AuthDisableRequest\"E\n" + + "\x13AuthDisableResponse\x12.\n" + + "\x06header\x18\x01 \x01(\v2\x16.aether.ResponseHeaderR\x06header\"\x13\n" + + "\x11AuthStatusRequest\"^\n" + + "\x12AuthStatusResponse\x12.\n" + + "\x06header\x18\x01 \x01(\v2\x16.aether.ResponseHeaderR\x06header\x12\x18\n" + + "\aenabled\x18\x02 \x01(\bR\aenabled*d\n" + + "\x0ePermissionType\x12\x18\n" + + "\x14PERMISSION_TYPE_READ\x10\x00\x12\x19\n" + + "\x15PERMISSION_TYPE_WRITE\x10\x01\x12\x1d\n" + + "\x19PERMISSION_TYPE_READWRITE\x10\x022\xe0\t\n" + + "\n" + + "AetherAuth\x12:\n" + + "\aUserAdd\x12\x16.aether.UserAddRequest\x1a\x17.aether.UserAddResponse\x12C\n" + + "\n" + + "UserDelete\x12\x19.aether.UserDeleteRequest\x1a\x1a.aether.UserDeleteResponse\x12:\n" + + "\aUserGet\x12\x16.aether.UserGetRequest\x1a\x17.aether.UserGetResponse\x12=\n" + + "\bUserList\x12\x17.aether.UserListRequest\x1a\x18.aether.UserListResponse\x12[\n" + + "\x12UserChangePassword\x12!.aether.UserChangePasswordRequest\x1a\".aether.UserChangePasswordResponse\x12L\n" + + "\rUserGrantRole\x12\x1c.aether.UserGrantRoleRequest\x1a\x1d.aether.UserGrantRoleResponse\x12O\n" + + "\x0eUserRevokeRole\x12\x1d.aether.UserRevokeRoleRequest\x1a\x1e.aether.UserRevokeRoleResponse\x12:\n" + + "\aRoleAdd\x12\x16.aether.RoleAddRequest\x1a\x17.aether.RoleAddResponse\x12C\n" + + "\n" + + "RoleDelete\x12\x19.aether.RoleDeleteRequest\x1a\x1a.aether.RoleDeleteResponse\x12:\n" + + "\aRoleGet\x12\x16.aether.RoleGetRequest\x1a\x17.aether.RoleGetResponse\x12=\n" + + "\bRoleList\x12\x17.aether.RoleListRequest\x1a\x18.aether.RoleListResponse\x12^\n" + + "\x13RoleGrantPermission\x12\".aether.RoleGrantPermissionRequest\x1a#.aether.RoleGrantPermissionResponse\x12a\n" + + "\x14RoleRevokePermission\x12#.aether.RoleRevokePermissionRequest\x1a$.aether.RoleRevokePermissionResponse\x12I\n" + + "\fAuthenticate\x12\x1b.aether.AuthenticateRequest\x1a\x1c.aether.AuthenticateResponse\x12C\n" + + "\n" + + "AuthEnable\x12\x19.aether.AuthEnableRequest\x1a\x1a.aether.AuthEnableResponse\x12F\n" + + "\vAuthDisable\x12\x1a.aether.AuthDisableRequest\x1a\x1b.aether.AuthDisableResponse\x12C\n" + + "\n" + + "AuthStatus\x12\x19.aether.AuthStatusRequest\x1a\x1a.aether.AuthStatusResponseB-Z+github.com/aether-io/aether/sdk/go/aetherpbb\x06proto3" + +var ( + file_auth_proto_rawDescOnce sync.Once + file_auth_proto_rawDescData []byte +) + +func file_auth_proto_rawDescGZIP() []byte { + file_auth_proto_rawDescOnce.Do(func() { + file_auth_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_auth_proto_rawDesc), len(file_auth_proto_rawDesc))) + }) + return file_auth_proto_rawDescData +} + +var file_auth_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_auth_proto_msgTypes = make([]protoimpl.MessageInfo, 37) +var file_auth_proto_goTypes = []any{ + (PermissionType)(0), // 0: aether.PermissionType + (*Permission)(nil), // 1: aether.Permission + (*AuthUser)(nil), // 2: aether.AuthUser + (*AuthRole)(nil), // 3: aether.AuthRole + (*UserAddRequest)(nil), // 4: aether.UserAddRequest + (*UserAddResponse)(nil), // 5: aether.UserAddResponse + (*UserDeleteRequest)(nil), // 6: aether.UserDeleteRequest + (*UserDeleteResponse)(nil), // 7: aether.UserDeleteResponse + (*UserGetRequest)(nil), // 8: aether.UserGetRequest + (*UserGetResponse)(nil), // 9: aether.UserGetResponse + (*UserListRequest)(nil), // 10: aether.UserListRequest + (*UserListResponse)(nil), // 11: aether.UserListResponse + (*UserChangePasswordRequest)(nil), // 12: aether.UserChangePasswordRequest + (*UserChangePasswordResponse)(nil), // 13: aether.UserChangePasswordResponse + (*UserGrantRoleRequest)(nil), // 14: aether.UserGrantRoleRequest + (*UserGrantRoleResponse)(nil), // 15: aether.UserGrantRoleResponse + (*UserRevokeRoleRequest)(nil), // 16: aether.UserRevokeRoleRequest + (*UserRevokeRoleResponse)(nil), // 17: aether.UserRevokeRoleResponse + (*RoleAddRequest)(nil), // 18: aether.RoleAddRequest + (*RoleAddResponse)(nil), // 19: aether.RoleAddResponse + (*RoleDeleteRequest)(nil), // 20: aether.RoleDeleteRequest + (*RoleDeleteResponse)(nil), // 21: aether.RoleDeleteResponse + (*RoleGetRequest)(nil), // 22: aether.RoleGetRequest + (*RoleGetResponse)(nil), // 23: aether.RoleGetResponse + (*RoleListRequest)(nil), // 24: aether.RoleListRequest + (*RoleListResponse)(nil), // 25: aether.RoleListResponse + (*RoleGrantPermissionRequest)(nil), // 26: aether.RoleGrantPermissionRequest + (*RoleGrantPermissionResponse)(nil), // 27: aether.RoleGrantPermissionResponse + (*RoleRevokePermissionRequest)(nil), // 28: aether.RoleRevokePermissionRequest + (*RoleRevokePermissionResponse)(nil), // 29: aether.RoleRevokePermissionResponse + (*AuthenticateRequest)(nil), // 30: aether.AuthenticateRequest + (*AuthenticateResponse)(nil), // 31: aether.AuthenticateResponse + (*AuthEnableRequest)(nil), // 32: aether.AuthEnableRequest + (*AuthEnableResponse)(nil), // 33: aether.AuthEnableResponse + (*AuthDisableRequest)(nil), // 34: aether.AuthDisableRequest + (*AuthDisableResponse)(nil), // 35: aether.AuthDisableResponse + (*AuthStatusRequest)(nil), // 36: aether.AuthStatusRequest + (*AuthStatusResponse)(nil), // 37: aether.AuthStatusResponse + (*ResponseHeader)(nil), // 38: aether.ResponseHeader +} +var file_auth_proto_depIdxs = []int32{ + 0, // 0: aether.Permission.perm_type:type_name -> aether.PermissionType + 1, // 1: aether.AuthRole.permissions:type_name -> aether.Permission + 38, // 2: aether.UserAddResponse.header:type_name -> aether.ResponseHeader + 38, // 3: aether.UserDeleteResponse.header:type_name -> aether.ResponseHeader + 38, // 4: aether.UserGetResponse.header:type_name -> aether.ResponseHeader + 2, // 5: aether.UserGetResponse.user:type_name -> aether.AuthUser + 38, // 6: aether.UserListResponse.header:type_name -> aether.ResponseHeader + 2, // 7: aether.UserListResponse.users:type_name -> aether.AuthUser + 38, // 8: aether.UserChangePasswordResponse.header:type_name -> aether.ResponseHeader + 38, // 9: aether.UserGrantRoleResponse.header:type_name -> aether.ResponseHeader + 38, // 10: aether.UserRevokeRoleResponse.header:type_name -> aether.ResponseHeader + 38, // 11: aether.RoleAddResponse.header:type_name -> aether.ResponseHeader + 38, // 12: aether.RoleDeleteResponse.header:type_name -> aether.ResponseHeader + 38, // 13: aether.RoleGetResponse.header:type_name -> aether.ResponseHeader + 3, // 14: aether.RoleGetResponse.role:type_name -> aether.AuthRole + 38, // 15: aether.RoleListResponse.header:type_name -> aether.ResponseHeader + 3, // 16: aether.RoleListResponse.roles:type_name -> aether.AuthRole + 1, // 17: aether.RoleGrantPermissionRequest.permission:type_name -> aether.Permission + 38, // 18: aether.RoleGrantPermissionResponse.header:type_name -> aether.ResponseHeader + 1, // 19: aether.RoleRevokePermissionRequest.permission:type_name -> aether.Permission + 38, // 20: aether.RoleRevokePermissionResponse.header:type_name -> aether.ResponseHeader + 38, // 21: aether.AuthenticateResponse.header:type_name -> aether.ResponseHeader + 38, // 22: aether.AuthEnableResponse.header:type_name -> aether.ResponseHeader + 38, // 23: aether.AuthDisableResponse.header:type_name -> aether.ResponseHeader + 38, // 24: aether.AuthStatusResponse.header:type_name -> aether.ResponseHeader + 4, // 25: aether.AetherAuth.UserAdd:input_type -> aether.UserAddRequest + 6, // 26: aether.AetherAuth.UserDelete:input_type -> aether.UserDeleteRequest + 8, // 27: aether.AetherAuth.UserGet:input_type -> aether.UserGetRequest + 10, // 28: aether.AetherAuth.UserList:input_type -> aether.UserListRequest + 12, // 29: aether.AetherAuth.UserChangePassword:input_type -> aether.UserChangePasswordRequest + 14, // 30: aether.AetherAuth.UserGrantRole:input_type -> aether.UserGrantRoleRequest + 16, // 31: aether.AetherAuth.UserRevokeRole:input_type -> aether.UserRevokeRoleRequest + 18, // 32: aether.AetherAuth.RoleAdd:input_type -> aether.RoleAddRequest + 20, // 33: aether.AetherAuth.RoleDelete:input_type -> aether.RoleDeleteRequest + 22, // 34: aether.AetherAuth.RoleGet:input_type -> aether.RoleGetRequest + 24, // 35: aether.AetherAuth.RoleList:input_type -> aether.RoleListRequest + 26, // 36: aether.AetherAuth.RoleGrantPermission:input_type -> aether.RoleGrantPermissionRequest + 28, // 37: aether.AetherAuth.RoleRevokePermission:input_type -> aether.RoleRevokePermissionRequest + 30, // 38: aether.AetherAuth.Authenticate:input_type -> aether.AuthenticateRequest + 32, // 39: aether.AetherAuth.AuthEnable:input_type -> aether.AuthEnableRequest + 34, // 40: aether.AetherAuth.AuthDisable:input_type -> aether.AuthDisableRequest + 36, // 41: aether.AetherAuth.AuthStatus:input_type -> aether.AuthStatusRequest + 5, // 42: aether.AetherAuth.UserAdd:output_type -> aether.UserAddResponse + 7, // 43: aether.AetherAuth.UserDelete:output_type -> aether.UserDeleteResponse + 9, // 44: aether.AetherAuth.UserGet:output_type -> aether.UserGetResponse + 11, // 45: aether.AetherAuth.UserList:output_type -> aether.UserListResponse + 13, // 46: aether.AetherAuth.UserChangePassword:output_type -> aether.UserChangePasswordResponse + 15, // 47: aether.AetherAuth.UserGrantRole:output_type -> aether.UserGrantRoleResponse + 17, // 48: aether.AetherAuth.UserRevokeRole:output_type -> aether.UserRevokeRoleResponse + 19, // 49: aether.AetherAuth.RoleAdd:output_type -> aether.RoleAddResponse + 21, // 50: aether.AetherAuth.RoleDelete:output_type -> aether.RoleDeleteResponse + 23, // 51: aether.AetherAuth.RoleGet:output_type -> aether.RoleGetResponse + 25, // 52: aether.AetherAuth.RoleList:output_type -> aether.RoleListResponse + 27, // 53: aether.AetherAuth.RoleGrantPermission:output_type -> aether.RoleGrantPermissionResponse + 29, // 54: aether.AetherAuth.RoleRevokePermission:output_type -> aether.RoleRevokePermissionResponse + 31, // 55: aether.AetherAuth.Authenticate:output_type -> aether.AuthenticateResponse + 33, // 56: aether.AetherAuth.AuthEnable:output_type -> aether.AuthEnableResponse + 35, // 57: aether.AetherAuth.AuthDisable:output_type -> aether.AuthDisableResponse + 37, // 58: aether.AetherAuth.AuthStatus:output_type -> aether.AuthStatusResponse + 42, // [42:59] is the sub-list for method output_type + 25, // [25:42] is the sub-list for method input_type + 25, // [25:25] is the sub-list for extension type_name + 25, // [25:25] is the sub-list for extension extendee + 0, // [0:25] is the sub-list for field type_name +} + +func init() { file_auth_proto_init() } +func file_auth_proto_init() { + if File_auth_proto != nil { + return + } + file_common_proto_init() + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_auth_proto_rawDesc), len(file_auth_proto_rawDesc)), + NumEnums: 1, + NumMessages: 37, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_auth_proto_goTypes, + DependencyIndexes: file_auth_proto_depIdxs, + EnumInfos: file_auth_proto_enumTypes, + MessageInfos: file_auth_proto_msgTypes, + }.Build() + File_auth_proto = out.File + file_auth_proto_goTypes = nil + file_auth_proto_depIdxs = nil +} diff --git a/sdk/go/aetherpb/auth_grpc.pb.go b/sdk/go/aetherpb/auth_grpc.pb.go new file mode 100644 index 0000000..cf858f8 --- /dev/null +++ b/sdk/go/aetherpb/auth_grpc.pb.go @@ -0,0 +1,731 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.5.1 +// - protoc v6.32.0 +// source: auth.proto + +package aetherpb + +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 ( + AetherAuth_UserAdd_FullMethodName = "/aether.AetherAuth/UserAdd" + AetherAuth_UserDelete_FullMethodName = "/aether.AetherAuth/UserDelete" + AetherAuth_UserGet_FullMethodName = "/aether.AetherAuth/UserGet" + AetherAuth_UserList_FullMethodName = "/aether.AetherAuth/UserList" + AetherAuth_UserChangePassword_FullMethodName = "/aether.AetherAuth/UserChangePassword" + AetherAuth_UserGrantRole_FullMethodName = "/aether.AetherAuth/UserGrantRole" + AetherAuth_UserRevokeRole_FullMethodName = "/aether.AetherAuth/UserRevokeRole" + AetherAuth_RoleAdd_FullMethodName = "/aether.AetherAuth/RoleAdd" + AetherAuth_RoleDelete_FullMethodName = "/aether.AetherAuth/RoleDelete" + AetherAuth_RoleGet_FullMethodName = "/aether.AetherAuth/RoleGet" + AetherAuth_RoleList_FullMethodName = "/aether.AetherAuth/RoleList" + AetherAuth_RoleGrantPermission_FullMethodName = "/aether.AetherAuth/RoleGrantPermission" + AetherAuth_RoleRevokePermission_FullMethodName = "/aether.AetherAuth/RoleRevokePermission" + AetherAuth_Authenticate_FullMethodName = "/aether.AetherAuth/Authenticate" + AetherAuth_AuthEnable_FullMethodName = "/aether.AetherAuth/AuthEnable" + AetherAuth_AuthDisable_FullMethodName = "/aether.AetherAuth/AuthDisable" + AetherAuth_AuthStatus_FullMethodName = "/aether.AetherAuth/AuthStatus" +) + +// AetherAuthClient is the client API for AetherAuth 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. +// +// AetherAuth provides authentication and authorization. +type AetherAuthClient interface { + UserAdd(ctx context.Context, in *UserAddRequest, opts ...grpc.CallOption) (*UserAddResponse, error) + UserDelete(ctx context.Context, in *UserDeleteRequest, opts ...grpc.CallOption) (*UserDeleteResponse, error) + UserGet(ctx context.Context, in *UserGetRequest, opts ...grpc.CallOption) (*UserGetResponse, error) + UserList(ctx context.Context, in *UserListRequest, opts ...grpc.CallOption) (*UserListResponse, error) + UserChangePassword(ctx context.Context, in *UserChangePasswordRequest, opts ...grpc.CallOption) (*UserChangePasswordResponse, error) + UserGrantRole(ctx context.Context, in *UserGrantRoleRequest, opts ...grpc.CallOption) (*UserGrantRoleResponse, error) + UserRevokeRole(ctx context.Context, in *UserRevokeRoleRequest, opts ...grpc.CallOption) (*UserRevokeRoleResponse, error) + RoleAdd(ctx context.Context, in *RoleAddRequest, opts ...grpc.CallOption) (*RoleAddResponse, error) + RoleDelete(ctx context.Context, in *RoleDeleteRequest, opts ...grpc.CallOption) (*RoleDeleteResponse, error) + RoleGet(ctx context.Context, in *RoleGetRequest, opts ...grpc.CallOption) (*RoleGetResponse, error) + RoleList(ctx context.Context, in *RoleListRequest, opts ...grpc.CallOption) (*RoleListResponse, error) + RoleGrantPermission(ctx context.Context, in *RoleGrantPermissionRequest, opts ...grpc.CallOption) (*RoleGrantPermissionResponse, error) + RoleRevokePermission(ctx context.Context, in *RoleRevokePermissionRequest, opts ...grpc.CallOption) (*RoleRevokePermissionResponse, error) + Authenticate(ctx context.Context, in *AuthenticateRequest, opts ...grpc.CallOption) (*AuthenticateResponse, error) + AuthEnable(ctx context.Context, in *AuthEnableRequest, opts ...grpc.CallOption) (*AuthEnableResponse, error) + AuthDisable(ctx context.Context, in *AuthDisableRequest, opts ...grpc.CallOption) (*AuthDisableResponse, error) + AuthStatus(ctx context.Context, in *AuthStatusRequest, opts ...grpc.CallOption) (*AuthStatusResponse, error) +} + +type aetherAuthClient struct { + cc grpc.ClientConnInterface +} + +func NewAetherAuthClient(cc grpc.ClientConnInterface) AetherAuthClient { + return &aetherAuthClient{cc} +} + +func (c *aetherAuthClient) UserAdd(ctx context.Context, in *UserAddRequest, opts ...grpc.CallOption) (*UserAddResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(UserAddResponse) + err := c.cc.Invoke(ctx, AetherAuth_UserAdd_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *aetherAuthClient) UserDelete(ctx context.Context, in *UserDeleteRequest, opts ...grpc.CallOption) (*UserDeleteResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(UserDeleteResponse) + err := c.cc.Invoke(ctx, AetherAuth_UserDelete_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *aetherAuthClient) UserGet(ctx context.Context, in *UserGetRequest, opts ...grpc.CallOption) (*UserGetResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(UserGetResponse) + err := c.cc.Invoke(ctx, AetherAuth_UserGet_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *aetherAuthClient) UserList(ctx context.Context, in *UserListRequest, opts ...grpc.CallOption) (*UserListResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(UserListResponse) + err := c.cc.Invoke(ctx, AetherAuth_UserList_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *aetherAuthClient) UserChangePassword(ctx context.Context, in *UserChangePasswordRequest, opts ...grpc.CallOption) (*UserChangePasswordResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(UserChangePasswordResponse) + err := c.cc.Invoke(ctx, AetherAuth_UserChangePassword_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *aetherAuthClient) UserGrantRole(ctx context.Context, in *UserGrantRoleRequest, opts ...grpc.CallOption) (*UserGrantRoleResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(UserGrantRoleResponse) + err := c.cc.Invoke(ctx, AetherAuth_UserGrantRole_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *aetherAuthClient) UserRevokeRole(ctx context.Context, in *UserRevokeRoleRequest, opts ...grpc.CallOption) (*UserRevokeRoleResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(UserRevokeRoleResponse) + err := c.cc.Invoke(ctx, AetherAuth_UserRevokeRole_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *aetherAuthClient) RoleAdd(ctx context.Context, in *RoleAddRequest, opts ...grpc.CallOption) (*RoleAddResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(RoleAddResponse) + err := c.cc.Invoke(ctx, AetherAuth_RoleAdd_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *aetherAuthClient) RoleDelete(ctx context.Context, in *RoleDeleteRequest, opts ...grpc.CallOption) (*RoleDeleteResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(RoleDeleteResponse) + err := c.cc.Invoke(ctx, AetherAuth_RoleDelete_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *aetherAuthClient) RoleGet(ctx context.Context, in *RoleGetRequest, opts ...grpc.CallOption) (*RoleGetResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(RoleGetResponse) + err := c.cc.Invoke(ctx, AetherAuth_RoleGet_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *aetherAuthClient) RoleList(ctx context.Context, in *RoleListRequest, opts ...grpc.CallOption) (*RoleListResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(RoleListResponse) + err := c.cc.Invoke(ctx, AetherAuth_RoleList_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *aetherAuthClient) RoleGrantPermission(ctx context.Context, in *RoleGrantPermissionRequest, opts ...grpc.CallOption) (*RoleGrantPermissionResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(RoleGrantPermissionResponse) + err := c.cc.Invoke(ctx, AetherAuth_RoleGrantPermission_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *aetherAuthClient) RoleRevokePermission(ctx context.Context, in *RoleRevokePermissionRequest, opts ...grpc.CallOption) (*RoleRevokePermissionResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(RoleRevokePermissionResponse) + err := c.cc.Invoke(ctx, AetherAuth_RoleRevokePermission_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *aetherAuthClient) Authenticate(ctx context.Context, in *AuthenticateRequest, opts ...grpc.CallOption) (*AuthenticateResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(AuthenticateResponse) + err := c.cc.Invoke(ctx, AetherAuth_Authenticate_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *aetherAuthClient) AuthEnable(ctx context.Context, in *AuthEnableRequest, opts ...grpc.CallOption) (*AuthEnableResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(AuthEnableResponse) + err := c.cc.Invoke(ctx, AetherAuth_AuthEnable_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *aetherAuthClient) AuthDisable(ctx context.Context, in *AuthDisableRequest, opts ...grpc.CallOption) (*AuthDisableResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(AuthDisableResponse) + err := c.cc.Invoke(ctx, AetherAuth_AuthDisable_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *aetherAuthClient) AuthStatus(ctx context.Context, in *AuthStatusRequest, opts ...grpc.CallOption) (*AuthStatusResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(AuthStatusResponse) + err := c.cc.Invoke(ctx, AetherAuth_AuthStatus_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +// AetherAuthServer is the server API for AetherAuth service. +// All implementations should embed UnimplementedAetherAuthServer +// for forward compatibility. +// +// AetherAuth provides authentication and authorization. +type AetherAuthServer interface { + UserAdd(context.Context, *UserAddRequest) (*UserAddResponse, error) + UserDelete(context.Context, *UserDeleteRequest) (*UserDeleteResponse, error) + UserGet(context.Context, *UserGetRequest) (*UserGetResponse, error) + UserList(context.Context, *UserListRequest) (*UserListResponse, error) + UserChangePassword(context.Context, *UserChangePasswordRequest) (*UserChangePasswordResponse, error) + UserGrantRole(context.Context, *UserGrantRoleRequest) (*UserGrantRoleResponse, error) + UserRevokeRole(context.Context, *UserRevokeRoleRequest) (*UserRevokeRoleResponse, error) + RoleAdd(context.Context, *RoleAddRequest) (*RoleAddResponse, error) + RoleDelete(context.Context, *RoleDeleteRequest) (*RoleDeleteResponse, error) + RoleGet(context.Context, *RoleGetRequest) (*RoleGetResponse, error) + RoleList(context.Context, *RoleListRequest) (*RoleListResponse, error) + RoleGrantPermission(context.Context, *RoleGrantPermissionRequest) (*RoleGrantPermissionResponse, error) + RoleRevokePermission(context.Context, *RoleRevokePermissionRequest) (*RoleRevokePermissionResponse, error) + Authenticate(context.Context, *AuthenticateRequest) (*AuthenticateResponse, error) + AuthEnable(context.Context, *AuthEnableRequest) (*AuthEnableResponse, error) + AuthDisable(context.Context, *AuthDisableRequest) (*AuthDisableResponse, error) + AuthStatus(context.Context, *AuthStatusRequest) (*AuthStatusResponse, error) +} + +// UnimplementedAetherAuthServer should 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 UnimplementedAetherAuthServer struct{} + +func (UnimplementedAetherAuthServer) UserAdd(context.Context, *UserAddRequest) (*UserAddResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UserAdd not implemented") +} +func (UnimplementedAetherAuthServer) UserDelete(context.Context, *UserDeleteRequest) (*UserDeleteResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UserDelete not implemented") +} +func (UnimplementedAetherAuthServer) UserGet(context.Context, *UserGetRequest) (*UserGetResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UserGet not implemented") +} +func (UnimplementedAetherAuthServer) UserList(context.Context, *UserListRequest) (*UserListResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UserList not implemented") +} +func (UnimplementedAetherAuthServer) UserChangePassword(context.Context, *UserChangePasswordRequest) (*UserChangePasswordResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UserChangePassword not implemented") +} +func (UnimplementedAetherAuthServer) UserGrantRole(context.Context, *UserGrantRoleRequest) (*UserGrantRoleResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UserGrantRole not implemented") +} +func (UnimplementedAetherAuthServer) UserRevokeRole(context.Context, *UserRevokeRoleRequest) (*UserRevokeRoleResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UserRevokeRole not implemented") +} +func (UnimplementedAetherAuthServer) RoleAdd(context.Context, *RoleAddRequest) (*RoleAddResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method RoleAdd not implemented") +} +func (UnimplementedAetherAuthServer) RoleDelete(context.Context, *RoleDeleteRequest) (*RoleDeleteResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method RoleDelete not implemented") +} +func (UnimplementedAetherAuthServer) RoleGet(context.Context, *RoleGetRequest) (*RoleGetResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method RoleGet not implemented") +} +func (UnimplementedAetherAuthServer) RoleList(context.Context, *RoleListRequest) (*RoleListResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method RoleList not implemented") +} +func (UnimplementedAetherAuthServer) RoleGrantPermission(context.Context, *RoleGrantPermissionRequest) (*RoleGrantPermissionResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method RoleGrantPermission not implemented") +} +func (UnimplementedAetherAuthServer) RoleRevokePermission(context.Context, *RoleRevokePermissionRequest) (*RoleRevokePermissionResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method RoleRevokePermission not implemented") +} +func (UnimplementedAetherAuthServer) Authenticate(context.Context, *AuthenticateRequest) (*AuthenticateResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Authenticate not implemented") +} +func (UnimplementedAetherAuthServer) AuthEnable(context.Context, *AuthEnableRequest) (*AuthEnableResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method AuthEnable not implemented") +} +func (UnimplementedAetherAuthServer) AuthDisable(context.Context, *AuthDisableRequest) (*AuthDisableResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method AuthDisable not implemented") +} +func (UnimplementedAetherAuthServer) AuthStatus(context.Context, *AuthStatusRequest) (*AuthStatusResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method AuthStatus not implemented") +} +func (UnimplementedAetherAuthServer) testEmbeddedByValue() {} + +// UnsafeAetherAuthServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to AetherAuthServer will +// result in compilation errors. +type UnsafeAetherAuthServer interface { + mustEmbedUnimplementedAetherAuthServer() +} + +func RegisterAetherAuthServer(s grpc.ServiceRegistrar, srv AetherAuthServer) { + // If the following call pancis, it indicates UnimplementedAetherAuthServer 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(&AetherAuth_ServiceDesc, srv) +} + +func _AetherAuth_UserAdd_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UserAddRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AetherAuthServer).UserAdd(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: AetherAuth_UserAdd_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AetherAuthServer).UserAdd(ctx, req.(*UserAddRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _AetherAuth_UserDelete_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UserDeleteRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AetherAuthServer).UserDelete(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: AetherAuth_UserDelete_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AetherAuthServer).UserDelete(ctx, req.(*UserDeleteRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _AetherAuth_UserGet_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UserGetRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AetherAuthServer).UserGet(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: AetherAuth_UserGet_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AetherAuthServer).UserGet(ctx, req.(*UserGetRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _AetherAuth_UserList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UserListRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AetherAuthServer).UserList(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: AetherAuth_UserList_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AetherAuthServer).UserList(ctx, req.(*UserListRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _AetherAuth_UserChangePassword_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UserChangePasswordRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AetherAuthServer).UserChangePassword(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: AetherAuth_UserChangePassword_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AetherAuthServer).UserChangePassword(ctx, req.(*UserChangePasswordRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _AetherAuth_UserGrantRole_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UserGrantRoleRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AetherAuthServer).UserGrantRole(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: AetherAuth_UserGrantRole_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AetherAuthServer).UserGrantRole(ctx, req.(*UserGrantRoleRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _AetherAuth_UserRevokeRole_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UserRevokeRoleRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AetherAuthServer).UserRevokeRole(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: AetherAuth_UserRevokeRole_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AetherAuthServer).UserRevokeRole(ctx, req.(*UserRevokeRoleRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _AetherAuth_RoleAdd_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(RoleAddRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AetherAuthServer).RoleAdd(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: AetherAuth_RoleAdd_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AetherAuthServer).RoleAdd(ctx, req.(*RoleAddRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _AetherAuth_RoleDelete_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(RoleDeleteRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AetherAuthServer).RoleDelete(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: AetherAuth_RoleDelete_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AetherAuthServer).RoleDelete(ctx, req.(*RoleDeleteRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _AetherAuth_RoleGet_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(RoleGetRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AetherAuthServer).RoleGet(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: AetherAuth_RoleGet_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AetherAuthServer).RoleGet(ctx, req.(*RoleGetRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _AetherAuth_RoleList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(RoleListRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AetherAuthServer).RoleList(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: AetherAuth_RoleList_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AetherAuthServer).RoleList(ctx, req.(*RoleListRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _AetherAuth_RoleGrantPermission_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(RoleGrantPermissionRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AetherAuthServer).RoleGrantPermission(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: AetherAuth_RoleGrantPermission_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AetherAuthServer).RoleGrantPermission(ctx, req.(*RoleGrantPermissionRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _AetherAuth_RoleRevokePermission_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(RoleRevokePermissionRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AetherAuthServer).RoleRevokePermission(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: AetherAuth_RoleRevokePermission_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AetherAuthServer).RoleRevokePermission(ctx, req.(*RoleRevokePermissionRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _AetherAuth_Authenticate_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(AuthenticateRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AetherAuthServer).Authenticate(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: AetherAuth_Authenticate_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AetherAuthServer).Authenticate(ctx, req.(*AuthenticateRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _AetherAuth_AuthEnable_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(AuthEnableRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AetherAuthServer).AuthEnable(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: AetherAuth_AuthEnable_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AetherAuthServer).AuthEnable(ctx, req.(*AuthEnableRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _AetherAuth_AuthDisable_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(AuthDisableRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AetherAuthServer).AuthDisable(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: AetherAuth_AuthDisable_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AetherAuthServer).AuthDisable(ctx, req.(*AuthDisableRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _AetherAuth_AuthStatus_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(AuthStatusRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AetherAuthServer).AuthStatus(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: AetherAuth_AuthStatus_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AetherAuthServer).AuthStatus(ctx, req.(*AuthStatusRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// AetherAuth_ServiceDesc is the grpc.ServiceDesc for AetherAuth service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var AetherAuth_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "aether.AetherAuth", + HandlerType: (*AetherAuthServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "UserAdd", + Handler: _AetherAuth_UserAdd_Handler, + }, + { + MethodName: "UserDelete", + Handler: _AetherAuth_UserDelete_Handler, + }, + { + MethodName: "UserGet", + Handler: _AetherAuth_UserGet_Handler, + }, + { + MethodName: "UserList", + Handler: _AetherAuth_UserList_Handler, + }, + { + MethodName: "UserChangePassword", + Handler: _AetherAuth_UserChangePassword_Handler, + }, + { + MethodName: "UserGrantRole", + Handler: _AetherAuth_UserGrantRole_Handler, + }, + { + MethodName: "UserRevokeRole", + Handler: _AetherAuth_UserRevokeRole_Handler, + }, + { + MethodName: "RoleAdd", + Handler: _AetherAuth_RoleAdd_Handler, + }, + { + MethodName: "RoleDelete", + Handler: _AetherAuth_RoleDelete_Handler, + }, + { + MethodName: "RoleGet", + Handler: _AetherAuth_RoleGet_Handler, + }, + { + MethodName: "RoleList", + Handler: _AetherAuth_RoleList_Handler, + }, + { + MethodName: "RoleGrantPermission", + Handler: _AetherAuth_RoleGrantPermission_Handler, + }, + { + MethodName: "RoleRevokePermission", + Handler: _AetherAuth_RoleRevokePermission_Handler, + }, + { + MethodName: "Authenticate", + Handler: _AetherAuth_Authenticate_Handler, + }, + { + MethodName: "AuthEnable", + Handler: _AetherAuth_AuthEnable_Handler, + }, + { + MethodName: "AuthDisable", + Handler: _AetherAuth_AuthDisable_Handler, + }, + { + MethodName: "AuthStatus", + Handler: _AetherAuth_AuthStatus_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "auth.proto", +} diff --git a/sdk/go/aetherpb/barrier.pb.go b/sdk/go/aetherpb/barrier.pb.go new file mode 100644 index 0000000..b0e52a8 --- /dev/null +++ b/sdk/go/aetherpb/barrier.pb.go @@ -0,0 +1,427 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.6 +// protoc v6.32.0 +// source: barrier.proto + +package aetherpb + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + 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 BarrierCreateRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // name is the barrier name. + Name []byte `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // lease_id is the lease to associate with the barrier. + // If 0, the barrier will not be associated with a lease + // and must be explicitly released. + LeaseId int64 `protobuf:"varint,2,opt,name=lease_id,json=leaseId,proto3" json:"lease_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *BarrierCreateRequest) Reset() { + *x = BarrierCreateRequest{} + mi := &file_barrier_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *BarrierCreateRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*BarrierCreateRequest) ProtoMessage() {} + +func (x *BarrierCreateRequest) ProtoReflect() protoreflect.Message { + mi := &file_barrier_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 BarrierCreateRequest.ProtoReflect.Descriptor instead. +func (*BarrierCreateRequest) Descriptor() ([]byte, []int) { + return file_barrier_proto_rawDescGZIP(), []int{0} +} + +func (x *BarrierCreateRequest) GetName() []byte { + if x != nil { + return x.Name + } + return nil +} + +func (x *BarrierCreateRequest) GetLeaseId() int64 { + if x != nil { + return x.LeaseId + } + return 0 +} + +type BarrierCreateResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` + // key is the key created for the barrier. + Key []byte `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *BarrierCreateResponse) Reset() { + *x = BarrierCreateResponse{} + mi := &file_barrier_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *BarrierCreateResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*BarrierCreateResponse) ProtoMessage() {} + +func (x *BarrierCreateResponse) ProtoReflect() protoreflect.Message { + mi := &file_barrier_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 BarrierCreateResponse.ProtoReflect.Descriptor instead. +func (*BarrierCreateResponse) Descriptor() ([]byte, []int) { + return file_barrier_proto_rawDescGZIP(), []int{1} +} + +func (x *BarrierCreateResponse) GetHeader() *ResponseHeader { + if x != nil { + return x.Header + } + return nil +} + +func (x *BarrierCreateResponse) GetKey() []byte { + if x != nil { + return x.Key + } + return nil +} + +type BarrierReleaseRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // name is the barrier name to release. + Name []byte `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *BarrierReleaseRequest) Reset() { + *x = BarrierReleaseRequest{} + mi := &file_barrier_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *BarrierReleaseRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*BarrierReleaseRequest) ProtoMessage() {} + +func (x *BarrierReleaseRequest) ProtoReflect() protoreflect.Message { + mi := &file_barrier_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 BarrierReleaseRequest.ProtoReflect.Descriptor instead. +func (*BarrierReleaseRequest) Descriptor() ([]byte, []int) { + return file_barrier_proto_rawDescGZIP(), []int{2} +} + +func (x *BarrierReleaseRequest) GetName() []byte { + if x != nil { + return x.Name + } + return nil +} + +type BarrierReleaseResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *BarrierReleaseResponse) Reset() { + *x = BarrierReleaseResponse{} + mi := &file_barrier_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *BarrierReleaseResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*BarrierReleaseResponse) ProtoMessage() {} + +func (x *BarrierReleaseResponse) ProtoReflect() protoreflect.Message { + mi := &file_barrier_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 BarrierReleaseResponse.ProtoReflect.Descriptor instead. +func (*BarrierReleaseResponse) Descriptor() ([]byte, []int) { + return file_barrier_proto_rawDescGZIP(), []int{3} +} + +func (x *BarrierReleaseResponse) GetHeader() *ResponseHeader { + if x != nil { + return x.Header + } + return nil +} + +type BarrierQueryRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // name is the barrier name to query. + Name []byte `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *BarrierQueryRequest) Reset() { + *x = BarrierQueryRequest{} + mi := &file_barrier_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *BarrierQueryRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*BarrierQueryRequest) ProtoMessage() {} + +func (x *BarrierQueryRequest) ProtoReflect() protoreflect.Message { + mi := &file_barrier_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 BarrierQueryRequest.ProtoReflect.Descriptor instead. +func (*BarrierQueryRequest) Descriptor() ([]byte, []int) { + return file_barrier_proto_rawDescGZIP(), []int{4} +} + +func (x *BarrierQueryRequest) GetName() []byte { + if x != nil { + return x.Name + } + return nil +} + +type BarrierQueryResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` + // held is true if the barrier is currently held. + Held bool `protobuf:"varint,2,opt,name=held,proto3" json:"held,omitempty"` + // key is the barrier key if held, empty otherwise. + Key []byte `protobuf:"bytes,3,opt,name=key,proto3" json:"key,omitempty"` + // lease_id is the lease associated with the barrier, 0 if none. + LeaseId int64 `protobuf:"varint,4,opt,name=lease_id,json=leaseId,proto3" json:"lease_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *BarrierQueryResponse) Reset() { + *x = BarrierQueryResponse{} + mi := &file_barrier_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *BarrierQueryResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*BarrierQueryResponse) ProtoMessage() {} + +func (x *BarrierQueryResponse) ProtoReflect() protoreflect.Message { + mi := &file_barrier_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 BarrierQueryResponse.ProtoReflect.Descriptor instead. +func (*BarrierQueryResponse) Descriptor() ([]byte, []int) { + return file_barrier_proto_rawDescGZIP(), []int{5} +} + +func (x *BarrierQueryResponse) GetHeader() *ResponseHeader { + if x != nil { + return x.Header + } + return nil +} + +func (x *BarrierQueryResponse) GetHeld() bool { + if x != nil { + return x.Held + } + return false +} + +func (x *BarrierQueryResponse) GetKey() []byte { + if x != nil { + return x.Key + } + return nil +} + +func (x *BarrierQueryResponse) GetLeaseId() int64 { + if x != nil { + return x.LeaseId + } + return 0 +} + +var File_barrier_proto protoreflect.FileDescriptor + +const file_barrier_proto_rawDesc = "" + + "\n" + + "\rbarrier.proto\x12\x06aether\x1a\fcommon.proto\"E\n" + + "\x14BarrierCreateRequest\x12\x12\n" + + "\x04name\x18\x01 \x01(\fR\x04name\x12\x19\n" + + "\blease_id\x18\x02 \x01(\x03R\aleaseId\"Y\n" + + "\x15BarrierCreateResponse\x12.\n" + + "\x06header\x18\x01 \x01(\v2\x16.aether.ResponseHeaderR\x06header\x12\x10\n" + + "\x03key\x18\x02 \x01(\fR\x03key\"+\n" + + "\x15BarrierReleaseRequest\x12\x12\n" + + "\x04name\x18\x01 \x01(\fR\x04name\"H\n" + + "\x16BarrierReleaseResponse\x12.\n" + + "\x06header\x18\x01 \x01(\v2\x16.aether.ResponseHeaderR\x06header\")\n" + + "\x13BarrierQueryRequest\x12\x12\n" + + "\x04name\x18\x01 \x01(\fR\x04name\"\x87\x01\n" + + "\x14BarrierQueryResponse\x12.\n" + + "\x06header\x18\x01 \x01(\v2\x16.aether.ResponseHeaderR\x06header\x12\x12\n" + + "\x04held\x18\x02 \x01(\bR\x04held\x12\x10\n" + + "\x03key\x18\x03 \x01(\fR\x03key\x12\x19\n" + + "\blease_id\x18\x04 \x01(\x03R\aleaseId2\xe4\x01\n" + + "\rAetherBarrier\x12E\n" + + "\x06Create\x12\x1c.aether.BarrierCreateRequest\x1a\x1d.aether.BarrierCreateResponse\x12H\n" + + "\aRelease\x12\x1d.aether.BarrierReleaseRequest\x1a\x1e.aether.BarrierReleaseResponse\x12B\n" + + "\x05Query\x12\x1b.aether.BarrierQueryRequest\x1a\x1c.aether.BarrierQueryResponseB-Z+github.com/aether-io/aether/sdk/go/aetherpbb\x06proto3" + +var ( + file_barrier_proto_rawDescOnce sync.Once + file_barrier_proto_rawDescData []byte +) + +func file_barrier_proto_rawDescGZIP() []byte { + file_barrier_proto_rawDescOnce.Do(func() { + file_barrier_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_barrier_proto_rawDesc), len(file_barrier_proto_rawDesc))) + }) + return file_barrier_proto_rawDescData +} + +var file_barrier_proto_msgTypes = make([]protoimpl.MessageInfo, 6) +var file_barrier_proto_goTypes = []any{ + (*BarrierCreateRequest)(nil), // 0: aether.BarrierCreateRequest + (*BarrierCreateResponse)(nil), // 1: aether.BarrierCreateResponse + (*BarrierReleaseRequest)(nil), // 2: aether.BarrierReleaseRequest + (*BarrierReleaseResponse)(nil), // 3: aether.BarrierReleaseResponse + (*BarrierQueryRequest)(nil), // 4: aether.BarrierQueryRequest + (*BarrierQueryResponse)(nil), // 5: aether.BarrierQueryResponse + (*ResponseHeader)(nil), // 6: aether.ResponseHeader +} +var file_barrier_proto_depIdxs = []int32{ + 6, // 0: aether.BarrierCreateResponse.header:type_name -> aether.ResponseHeader + 6, // 1: aether.BarrierReleaseResponse.header:type_name -> aether.ResponseHeader + 6, // 2: aether.BarrierQueryResponse.header:type_name -> aether.ResponseHeader + 0, // 3: aether.AetherBarrier.Create:input_type -> aether.BarrierCreateRequest + 2, // 4: aether.AetherBarrier.Release:input_type -> aether.BarrierReleaseRequest + 4, // 5: aether.AetherBarrier.Query:input_type -> aether.BarrierQueryRequest + 1, // 6: aether.AetherBarrier.Create:output_type -> aether.BarrierCreateResponse + 3, // 7: aether.AetherBarrier.Release:output_type -> aether.BarrierReleaseResponse + 5, // 8: aether.AetherBarrier.Query:output_type -> aether.BarrierQueryResponse + 6, // [6:9] is the sub-list for method output_type + 3, // [3:6] is the sub-list for method input_type + 3, // [3:3] is the sub-list for extension type_name + 3, // [3:3] is the sub-list for extension extendee + 0, // [0:3] is the sub-list for field type_name +} + +func init() { file_barrier_proto_init() } +func file_barrier_proto_init() { + if File_barrier_proto != nil { + return + } + file_common_proto_init() + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_barrier_proto_rawDesc), len(file_barrier_proto_rawDesc)), + NumEnums: 0, + NumMessages: 6, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_barrier_proto_goTypes, + DependencyIndexes: file_barrier_proto_depIdxs, + MessageInfos: file_barrier_proto_msgTypes, + }.Build() + File_barrier_proto = out.File + file_barrier_proto_goTypes = nil + file_barrier_proto_depIdxs = nil +} diff --git a/sdk/go/aetherpb/barrier_grpc.pb.go b/sdk/go/aetherpb/barrier_grpc.pb.go new file mode 100644 index 0000000..107e8cc --- /dev/null +++ b/sdk/go/aetherpb/barrier_grpc.pb.go @@ -0,0 +1,217 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.5.1 +// - protoc v6.32.0 +// source: barrier.proto + +package aetherpb + +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 ( + AetherBarrier_Create_FullMethodName = "/aether.AetherBarrier/Create" + AetherBarrier_Release_FullMethodName = "/aether.AetherBarrier/Release" + AetherBarrier_Query_FullMethodName = "/aether.AetherBarrier/Query" +) + +// AetherBarrierClient is the client API for AetherBarrier 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. +// +// AetherBarrier provides distributed barrier operations. +// A barrier is a synchronization primitive: while the barrier exists, +// other callers that try to enter it will block until the barrier +// is released or its lease expires. +type AetherBarrierClient interface { + // Create creates and holds a barrier with the given name. + // Other callers trying to enter will block until this barrier + // is released or its lease expires. + // Returns a barrier key that can be used to release or query. + Create(ctx context.Context, in *BarrierCreateRequest, opts ...grpc.CallOption) (*BarrierCreateResponse, error) + // Release releases the barrier, unblocking all waiters. + Release(ctx context.Context, in *BarrierReleaseRequest, opts ...grpc.CallOption) (*BarrierReleaseResponse, error) + // Query returns whether the barrier is currently held. + Query(ctx context.Context, in *BarrierQueryRequest, opts ...grpc.CallOption) (*BarrierQueryResponse, error) +} + +type aetherBarrierClient struct { + cc grpc.ClientConnInterface +} + +func NewAetherBarrierClient(cc grpc.ClientConnInterface) AetherBarrierClient { + return &aetherBarrierClient{cc} +} + +func (c *aetherBarrierClient) Create(ctx context.Context, in *BarrierCreateRequest, opts ...grpc.CallOption) (*BarrierCreateResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(BarrierCreateResponse) + err := c.cc.Invoke(ctx, AetherBarrier_Create_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *aetherBarrierClient) Release(ctx context.Context, in *BarrierReleaseRequest, opts ...grpc.CallOption) (*BarrierReleaseResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(BarrierReleaseResponse) + err := c.cc.Invoke(ctx, AetherBarrier_Release_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *aetherBarrierClient) Query(ctx context.Context, in *BarrierQueryRequest, opts ...grpc.CallOption) (*BarrierQueryResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(BarrierQueryResponse) + err := c.cc.Invoke(ctx, AetherBarrier_Query_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +// AetherBarrierServer is the server API for AetherBarrier service. +// All implementations should embed UnimplementedAetherBarrierServer +// for forward compatibility. +// +// AetherBarrier provides distributed barrier operations. +// A barrier is a synchronization primitive: while the barrier exists, +// other callers that try to enter it will block until the barrier +// is released or its lease expires. +type AetherBarrierServer interface { + // Create creates and holds a barrier with the given name. + // Other callers trying to enter will block until this barrier + // is released or its lease expires. + // Returns a barrier key that can be used to release or query. + Create(context.Context, *BarrierCreateRequest) (*BarrierCreateResponse, error) + // Release releases the barrier, unblocking all waiters. + Release(context.Context, *BarrierReleaseRequest) (*BarrierReleaseResponse, error) + // Query returns whether the barrier is currently held. + Query(context.Context, *BarrierQueryRequest) (*BarrierQueryResponse, error) +} + +// UnimplementedAetherBarrierServer should 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 UnimplementedAetherBarrierServer struct{} + +func (UnimplementedAetherBarrierServer) Create(context.Context, *BarrierCreateRequest) (*BarrierCreateResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Create not implemented") +} +func (UnimplementedAetherBarrierServer) Release(context.Context, *BarrierReleaseRequest) (*BarrierReleaseResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Release not implemented") +} +func (UnimplementedAetherBarrierServer) Query(context.Context, *BarrierQueryRequest) (*BarrierQueryResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Query not implemented") +} +func (UnimplementedAetherBarrierServer) testEmbeddedByValue() {} + +// UnsafeAetherBarrierServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to AetherBarrierServer will +// result in compilation errors. +type UnsafeAetherBarrierServer interface { + mustEmbedUnimplementedAetherBarrierServer() +} + +func RegisterAetherBarrierServer(s grpc.ServiceRegistrar, srv AetherBarrierServer) { + // If the following call pancis, it indicates UnimplementedAetherBarrierServer 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(&AetherBarrier_ServiceDesc, srv) +} + +func _AetherBarrier_Create_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(BarrierCreateRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AetherBarrierServer).Create(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: AetherBarrier_Create_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AetherBarrierServer).Create(ctx, req.(*BarrierCreateRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _AetherBarrier_Release_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(BarrierReleaseRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AetherBarrierServer).Release(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: AetherBarrier_Release_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AetherBarrierServer).Release(ctx, req.(*BarrierReleaseRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _AetherBarrier_Query_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(BarrierQueryRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AetherBarrierServer).Query(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: AetherBarrier_Query_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AetherBarrierServer).Query(ctx, req.(*BarrierQueryRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// AetherBarrier_ServiceDesc is the grpc.ServiceDesc for AetherBarrier service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var AetherBarrier_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "aether.AetherBarrier", + HandlerType: (*AetherBarrierServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Create", + Handler: _AetherBarrier_Create_Handler, + }, + { + MethodName: "Release", + Handler: _AetherBarrier_Release_Handler, + }, + { + MethodName: "Query", + Handler: _AetherBarrier_Query_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "barrier.proto", +} diff --git a/sdk/go/aetherpb/cluster.pb.go b/sdk/go/aetherpb/cluster.pb.go new file mode 100644 index 0000000..19ca195 --- /dev/null +++ b/sdk/go/aetherpb/cluster.pb.go @@ -0,0 +1,602 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.6 +// protoc v6.32.0 +// source: cluster.proto + +package aetherpb + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + 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) +) + +// Member represents a cluster member. +type Member struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + Addr string `protobuf:"bytes,2,opt,name=addr,proto3" json:"addr,omitempty"` + IsLearner bool `protobuf:"varint,3,opt,name=is_learner,json=isLearner,proto3" json:"is_learner,omitempty"` + Data string `protobuf:"bytes,4,opt,name=data,proto3" json:"data,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Member) Reset() { + *x = Member{} + mi := &file_cluster_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Member) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Member) ProtoMessage() {} + +func (x *Member) ProtoReflect() protoreflect.Message { + mi := &file_cluster_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 Member.ProtoReflect.Descriptor instead. +func (*Member) Descriptor() ([]byte, []int) { + return file_cluster_proto_rawDescGZIP(), []int{0} +} + +func (x *Member) GetId() uint64 { + if x != nil { + return x.Id + } + return 0 +} + +func (x *Member) GetAddr() string { + if x != nil { + return x.Addr + } + return "" +} + +func (x *Member) GetIsLearner() bool { + if x != nil { + return x.IsLearner + } + return false +} + +func (x *Member) GetData() string { + if x != nil { + return x.Data + } + return "" +} + +type MemberListRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *MemberListRequest) Reset() { + *x = MemberListRequest{} + mi := &file_cluster_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *MemberListRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MemberListRequest) ProtoMessage() {} + +func (x *MemberListRequest) ProtoReflect() protoreflect.Message { + mi := &file_cluster_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 MemberListRequest.ProtoReflect.Descriptor instead. +func (*MemberListRequest) Descriptor() ([]byte, []int) { + return file_cluster_proto_rawDescGZIP(), []int{1} +} + +type MemberListResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` + Members []*Member `protobuf:"bytes,2,rep,name=members,proto3" json:"members,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *MemberListResponse) Reset() { + *x = MemberListResponse{} + mi := &file_cluster_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *MemberListResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MemberListResponse) ProtoMessage() {} + +func (x *MemberListResponse) ProtoReflect() protoreflect.Message { + mi := &file_cluster_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 MemberListResponse.ProtoReflect.Descriptor instead. +func (*MemberListResponse) Descriptor() ([]byte, []int) { + return file_cluster_proto_rawDescGZIP(), []int{2} +} + +func (x *MemberListResponse) GetHeader() *ResponseHeader { + if x != nil { + return x.Header + } + return nil +} + +func (x *MemberListResponse) GetMembers() []*Member { + if x != nil { + return x.Members + } + return nil +} + +type MemberAddRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // addr is the address of the new member (host:port for Raft communication). + Addr string `protobuf:"bytes,1,opt,name=addr,proto3" json:"addr,omitempty"` + // is_learner adds the member as a non-voting learner if true. + IsLearner bool `protobuf:"varint,2,opt,name=is_learner,json=isLearner,proto3" json:"is_learner,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *MemberAddRequest) Reset() { + *x = MemberAddRequest{} + mi := &file_cluster_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *MemberAddRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MemberAddRequest) ProtoMessage() {} + +func (x *MemberAddRequest) ProtoReflect() protoreflect.Message { + mi := &file_cluster_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 MemberAddRequest.ProtoReflect.Descriptor instead. +func (*MemberAddRequest) Descriptor() ([]byte, []int) { + return file_cluster_proto_rawDescGZIP(), []int{3} +} + +func (x *MemberAddRequest) GetAddr() string { + if x != nil { + return x.Addr + } + return "" +} + +func (x *MemberAddRequest) GetIsLearner() bool { + if x != nil { + return x.IsLearner + } + return false +} + +type MemberAddResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` + Member *Member `protobuf:"bytes,2,opt,name=member,proto3" json:"member,omitempty"` + Members []*Member `protobuf:"bytes,3,rep,name=members,proto3" json:"members,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *MemberAddResponse) Reset() { + *x = MemberAddResponse{} + mi := &file_cluster_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *MemberAddResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MemberAddResponse) ProtoMessage() {} + +func (x *MemberAddResponse) ProtoReflect() protoreflect.Message { + mi := &file_cluster_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 MemberAddResponse.ProtoReflect.Descriptor instead. +func (*MemberAddResponse) Descriptor() ([]byte, []int) { + return file_cluster_proto_rawDescGZIP(), []int{4} +} + +func (x *MemberAddResponse) GetHeader() *ResponseHeader { + if x != nil { + return x.Header + } + return nil +} + +func (x *MemberAddResponse) GetMember() *Member { + if x != nil { + return x.Member + } + return nil +} + +func (x *MemberAddResponse) GetMembers() []*Member { + if x != nil { + return x.Members + } + return nil +} + +type MemberRemoveRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // id is the node ID of the member to remove. + Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *MemberRemoveRequest) Reset() { + *x = MemberRemoveRequest{} + mi := &file_cluster_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *MemberRemoveRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MemberRemoveRequest) ProtoMessage() {} + +func (x *MemberRemoveRequest) ProtoReflect() protoreflect.Message { + mi := &file_cluster_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 MemberRemoveRequest.ProtoReflect.Descriptor instead. +func (*MemberRemoveRequest) Descriptor() ([]byte, []int) { + return file_cluster_proto_rawDescGZIP(), []int{5} +} + +func (x *MemberRemoveRequest) GetId() uint64 { + if x != nil { + return x.Id + } + return 0 +} + +type MemberRemoveResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` + Members []*Member `protobuf:"bytes,2,rep,name=members,proto3" json:"members,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *MemberRemoveResponse) Reset() { + *x = MemberRemoveResponse{} + mi := &file_cluster_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *MemberRemoveResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MemberRemoveResponse) ProtoMessage() {} + +func (x *MemberRemoveResponse) ProtoReflect() protoreflect.Message { + mi := &file_cluster_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 MemberRemoveResponse.ProtoReflect.Descriptor instead. +func (*MemberRemoveResponse) Descriptor() ([]byte, []int) { + return file_cluster_proto_rawDescGZIP(), []int{6} +} + +func (x *MemberRemoveResponse) GetHeader() *ResponseHeader { + if x != nil { + return x.Header + } + return nil +} + +func (x *MemberRemoveResponse) GetMembers() []*Member { + if x != nil { + return x.Members + } + return nil +} + +type MemberPromoteRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // id is the node ID of the learner to promote to voter. + Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *MemberPromoteRequest) Reset() { + *x = MemberPromoteRequest{} + mi := &file_cluster_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *MemberPromoteRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MemberPromoteRequest) ProtoMessage() {} + +func (x *MemberPromoteRequest) ProtoReflect() protoreflect.Message { + mi := &file_cluster_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 MemberPromoteRequest.ProtoReflect.Descriptor instead. +func (*MemberPromoteRequest) Descriptor() ([]byte, []int) { + return file_cluster_proto_rawDescGZIP(), []int{7} +} + +func (x *MemberPromoteRequest) GetId() uint64 { + if x != nil { + return x.Id + } + return 0 +} + +type MemberPromoteResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` + Members []*Member `protobuf:"bytes,2,rep,name=members,proto3" json:"members,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *MemberPromoteResponse) Reset() { + *x = MemberPromoteResponse{} + mi := &file_cluster_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *MemberPromoteResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MemberPromoteResponse) ProtoMessage() {} + +func (x *MemberPromoteResponse) ProtoReflect() protoreflect.Message { + mi := &file_cluster_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 MemberPromoteResponse.ProtoReflect.Descriptor instead. +func (*MemberPromoteResponse) Descriptor() ([]byte, []int) { + return file_cluster_proto_rawDescGZIP(), []int{8} +} + +func (x *MemberPromoteResponse) GetHeader() *ResponseHeader { + if x != nil { + return x.Header + } + return nil +} + +func (x *MemberPromoteResponse) GetMembers() []*Member { + if x != nil { + return x.Members + } + return nil +} + +var File_cluster_proto protoreflect.FileDescriptor + +const file_cluster_proto_rawDesc = "" + + "\n" + + "\rcluster.proto\x12\x06aether\x1a\fcommon.proto\"_\n" + + "\x06Member\x12\x0e\n" + + "\x02id\x18\x01 \x01(\x04R\x02id\x12\x12\n" + + "\x04addr\x18\x02 \x01(\tR\x04addr\x12\x1d\n" + + "\n" + + "is_learner\x18\x03 \x01(\bR\tisLearner\x12\x12\n" + + "\x04data\x18\x04 \x01(\tR\x04data\"\x13\n" + + "\x11MemberListRequest\"n\n" + + "\x12MemberListResponse\x12.\n" + + "\x06header\x18\x01 \x01(\v2\x16.aether.ResponseHeaderR\x06header\x12(\n" + + "\amembers\x18\x02 \x03(\v2\x0e.aether.MemberR\amembers\"E\n" + + "\x10MemberAddRequest\x12\x12\n" + + "\x04addr\x18\x01 \x01(\tR\x04addr\x12\x1d\n" + + "\n" + + "is_learner\x18\x02 \x01(\bR\tisLearner\"\x95\x01\n" + + "\x11MemberAddResponse\x12.\n" + + "\x06header\x18\x01 \x01(\v2\x16.aether.ResponseHeaderR\x06header\x12&\n" + + "\x06member\x18\x02 \x01(\v2\x0e.aether.MemberR\x06member\x12(\n" + + "\amembers\x18\x03 \x03(\v2\x0e.aether.MemberR\amembers\"%\n" + + "\x13MemberRemoveRequest\x12\x0e\n" + + "\x02id\x18\x01 \x01(\x04R\x02id\"p\n" + + "\x14MemberRemoveResponse\x12.\n" + + "\x06header\x18\x01 \x01(\v2\x16.aether.ResponseHeaderR\x06header\x12(\n" + + "\amembers\x18\x02 \x03(\v2\x0e.aether.MemberR\amembers\"&\n" + + "\x14MemberPromoteRequest\x12\x0e\n" + + "\x02id\x18\x01 \x01(\x04R\x02id\"q\n" + + "\x15MemberPromoteResponse\x12.\n" + + "\x06header\x18\x01 \x01(\v2\x16.aether.ResponseHeaderR\x06header\x12(\n" + + "\amembers\x18\x02 \x03(\v2\x0e.aether.MemberR\amembers2\xaf\x02\n" + + "\rAetherCluster\x12C\n" + + "\n" + + "MemberList\x12\x19.aether.MemberListRequest\x1a\x1a.aether.MemberListResponse\x12@\n" + + "\tMemberAdd\x12\x18.aether.MemberAddRequest\x1a\x19.aether.MemberAddResponse\x12I\n" + + "\fMemberRemove\x12\x1b.aether.MemberRemoveRequest\x1a\x1c.aether.MemberRemoveResponse\x12L\n" + + "\rMemberPromote\x12\x1c.aether.MemberPromoteRequest\x1a\x1d.aether.MemberPromoteResponseB-Z+github.com/aether-io/aether/sdk/go/aetherpbb\x06proto3" + +var ( + file_cluster_proto_rawDescOnce sync.Once + file_cluster_proto_rawDescData []byte +) + +func file_cluster_proto_rawDescGZIP() []byte { + file_cluster_proto_rawDescOnce.Do(func() { + file_cluster_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_cluster_proto_rawDesc), len(file_cluster_proto_rawDesc))) + }) + return file_cluster_proto_rawDescData +} + +var file_cluster_proto_msgTypes = make([]protoimpl.MessageInfo, 9) +var file_cluster_proto_goTypes = []any{ + (*Member)(nil), // 0: aether.Member + (*MemberListRequest)(nil), // 1: aether.MemberListRequest + (*MemberListResponse)(nil), // 2: aether.MemberListResponse + (*MemberAddRequest)(nil), // 3: aether.MemberAddRequest + (*MemberAddResponse)(nil), // 4: aether.MemberAddResponse + (*MemberRemoveRequest)(nil), // 5: aether.MemberRemoveRequest + (*MemberRemoveResponse)(nil), // 6: aether.MemberRemoveResponse + (*MemberPromoteRequest)(nil), // 7: aether.MemberPromoteRequest + (*MemberPromoteResponse)(nil), // 8: aether.MemberPromoteResponse + (*ResponseHeader)(nil), // 9: aether.ResponseHeader +} +var file_cluster_proto_depIdxs = []int32{ + 9, // 0: aether.MemberListResponse.header:type_name -> aether.ResponseHeader + 0, // 1: aether.MemberListResponse.members:type_name -> aether.Member + 9, // 2: aether.MemberAddResponse.header:type_name -> aether.ResponseHeader + 0, // 3: aether.MemberAddResponse.member:type_name -> aether.Member + 0, // 4: aether.MemberAddResponse.members:type_name -> aether.Member + 9, // 5: aether.MemberRemoveResponse.header:type_name -> aether.ResponseHeader + 0, // 6: aether.MemberRemoveResponse.members:type_name -> aether.Member + 9, // 7: aether.MemberPromoteResponse.header:type_name -> aether.ResponseHeader + 0, // 8: aether.MemberPromoteResponse.members:type_name -> aether.Member + 1, // 9: aether.AetherCluster.MemberList:input_type -> aether.MemberListRequest + 3, // 10: aether.AetherCluster.MemberAdd:input_type -> aether.MemberAddRequest + 5, // 11: aether.AetherCluster.MemberRemove:input_type -> aether.MemberRemoveRequest + 7, // 12: aether.AetherCluster.MemberPromote:input_type -> aether.MemberPromoteRequest + 2, // 13: aether.AetherCluster.MemberList:output_type -> aether.MemberListResponse + 4, // 14: aether.AetherCluster.MemberAdd:output_type -> aether.MemberAddResponse + 6, // 15: aether.AetherCluster.MemberRemove:output_type -> aether.MemberRemoveResponse + 8, // 16: aether.AetherCluster.MemberPromote:output_type -> aether.MemberPromoteResponse + 13, // [13:17] is the sub-list for method output_type + 9, // [9:13] is the sub-list for method input_type + 9, // [9:9] is the sub-list for extension type_name + 9, // [9:9] is the sub-list for extension extendee + 0, // [0:9] is the sub-list for field type_name +} + +func init() { file_cluster_proto_init() } +func file_cluster_proto_init() { + if File_cluster_proto != nil { + return + } + file_common_proto_init() + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_cluster_proto_rawDesc), len(file_cluster_proto_rawDesc)), + NumEnums: 0, + NumMessages: 9, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_cluster_proto_goTypes, + DependencyIndexes: file_cluster_proto_depIdxs, + MessageInfos: file_cluster_proto_msgTypes, + }.Build() + File_cluster_proto = out.File + file_cluster_proto_goTypes = nil + file_cluster_proto_depIdxs = nil +} diff --git a/sdk/go/aetherpb/cluster_grpc.pb.go b/sdk/go/aetherpb/cluster_grpc.pb.go new file mode 100644 index 0000000..b4de1c4 --- /dev/null +++ b/sdk/go/aetherpb/cluster_grpc.pb.go @@ -0,0 +1,245 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.5.1 +// - protoc v6.32.0 +// source: cluster.proto + +package aetherpb + +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 ( + AetherCluster_MemberList_FullMethodName = "/aether.AetherCluster/MemberList" + AetherCluster_MemberAdd_FullMethodName = "/aether.AetherCluster/MemberAdd" + AetherCluster_MemberRemove_FullMethodName = "/aether.AetherCluster/MemberRemove" + AetherCluster_MemberPromote_FullMethodName = "/aether.AetherCluster/MemberPromote" +) + +// AetherClusterClient is the client API for AetherCluster 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. +// +// AetherCluster provides cluster membership management operations. +type AetherClusterClient interface { + // MemberList lists all current cluster members. + MemberList(ctx context.Context, in *MemberListRequest, opts ...grpc.CallOption) (*MemberListResponse, error) + // MemberAdd adds a new member to the cluster. + MemberAdd(ctx context.Context, in *MemberAddRequest, opts ...grpc.CallOption) (*MemberAddResponse, error) + // MemberRemove removes a member from the cluster. + MemberRemove(ctx context.Context, in *MemberRemoveRequest, opts ...grpc.CallOption) (*MemberRemoveResponse, error) + // MemberPromote promotes a learner member to a voting member. + MemberPromote(ctx context.Context, in *MemberPromoteRequest, opts ...grpc.CallOption) (*MemberPromoteResponse, error) +} + +type aetherClusterClient struct { + cc grpc.ClientConnInterface +} + +func NewAetherClusterClient(cc grpc.ClientConnInterface) AetherClusterClient { + return &aetherClusterClient{cc} +} + +func (c *aetherClusterClient) MemberList(ctx context.Context, in *MemberListRequest, opts ...grpc.CallOption) (*MemberListResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(MemberListResponse) + err := c.cc.Invoke(ctx, AetherCluster_MemberList_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *aetherClusterClient) MemberAdd(ctx context.Context, in *MemberAddRequest, opts ...grpc.CallOption) (*MemberAddResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(MemberAddResponse) + err := c.cc.Invoke(ctx, AetherCluster_MemberAdd_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *aetherClusterClient) MemberRemove(ctx context.Context, in *MemberRemoveRequest, opts ...grpc.CallOption) (*MemberRemoveResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(MemberRemoveResponse) + err := c.cc.Invoke(ctx, AetherCluster_MemberRemove_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *aetherClusterClient) MemberPromote(ctx context.Context, in *MemberPromoteRequest, opts ...grpc.CallOption) (*MemberPromoteResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(MemberPromoteResponse) + err := c.cc.Invoke(ctx, AetherCluster_MemberPromote_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +// AetherClusterServer is the server API for AetherCluster service. +// All implementations should embed UnimplementedAetherClusterServer +// for forward compatibility. +// +// AetherCluster provides cluster membership management operations. +type AetherClusterServer interface { + // MemberList lists all current cluster members. + MemberList(context.Context, *MemberListRequest) (*MemberListResponse, error) + // MemberAdd adds a new member to the cluster. + MemberAdd(context.Context, *MemberAddRequest) (*MemberAddResponse, error) + // MemberRemove removes a member from the cluster. + MemberRemove(context.Context, *MemberRemoveRequest) (*MemberRemoveResponse, error) + // MemberPromote promotes a learner member to a voting member. + MemberPromote(context.Context, *MemberPromoteRequest) (*MemberPromoteResponse, error) +} + +// UnimplementedAetherClusterServer should 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 UnimplementedAetherClusterServer struct{} + +func (UnimplementedAetherClusterServer) MemberList(context.Context, *MemberListRequest) (*MemberListResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method MemberList not implemented") +} +func (UnimplementedAetherClusterServer) MemberAdd(context.Context, *MemberAddRequest) (*MemberAddResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method MemberAdd not implemented") +} +func (UnimplementedAetherClusterServer) MemberRemove(context.Context, *MemberRemoveRequest) (*MemberRemoveResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method MemberRemove not implemented") +} +func (UnimplementedAetherClusterServer) MemberPromote(context.Context, *MemberPromoteRequest) (*MemberPromoteResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method MemberPromote not implemented") +} +func (UnimplementedAetherClusterServer) testEmbeddedByValue() {} + +// UnsafeAetherClusterServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to AetherClusterServer will +// result in compilation errors. +type UnsafeAetherClusterServer interface { + mustEmbedUnimplementedAetherClusterServer() +} + +func RegisterAetherClusterServer(s grpc.ServiceRegistrar, srv AetherClusterServer) { + // If the following call pancis, it indicates UnimplementedAetherClusterServer 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(&AetherCluster_ServiceDesc, srv) +} + +func _AetherCluster_MemberList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MemberListRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AetherClusterServer).MemberList(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: AetherCluster_MemberList_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AetherClusterServer).MemberList(ctx, req.(*MemberListRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _AetherCluster_MemberAdd_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MemberAddRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AetherClusterServer).MemberAdd(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: AetherCluster_MemberAdd_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AetherClusterServer).MemberAdd(ctx, req.(*MemberAddRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _AetherCluster_MemberRemove_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MemberRemoveRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AetherClusterServer).MemberRemove(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: AetherCluster_MemberRemove_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AetherClusterServer).MemberRemove(ctx, req.(*MemberRemoveRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _AetherCluster_MemberPromote_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MemberPromoteRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AetherClusterServer).MemberPromote(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: AetherCluster_MemberPromote_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AetherClusterServer).MemberPromote(ctx, req.(*MemberPromoteRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// AetherCluster_ServiceDesc is the grpc.ServiceDesc for AetherCluster service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var AetherCluster_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "aether.AetherCluster", + HandlerType: (*AetherClusterServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "MemberList", + Handler: _AetherCluster_MemberList_Handler, + }, + { + MethodName: "MemberAdd", + Handler: _AetherCluster_MemberAdd_Handler, + }, + { + MethodName: "MemberRemove", + Handler: _AetherCluster_MemberRemove_Handler, + }, + { + MethodName: "MemberPromote", + Handler: _AetherCluster_MemberPromote_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "cluster.proto", +} diff --git a/sdk/go/aetherpb/common.pb.go b/sdk/go/aetherpb/common.pb.go new file mode 100644 index 0000000..67784e0 --- /dev/null +++ b/sdk/go/aetherpb/common.pb.go @@ -0,0 +1,564 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.6 +// protoc v6.32.0 +// source: common.proto + +package aetherpb + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + 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) +) + +// SortOrder defines the sort order for Range results. +type SortOrder int32 + +const ( + SortOrder_SORT_ORDER_NONE SortOrder = 0 + SortOrder_SORT_ORDER_ASCEND SortOrder = 1 + SortOrder_SORT_ORDER_DESCEND SortOrder = 2 +) + +// Enum value maps for SortOrder. +var ( + SortOrder_name = map[int32]string{ + 0: "SORT_ORDER_NONE", + 1: "SORT_ORDER_ASCEND", + 2: "SORT_ORDER_DESCEND", + } + SortOrder_value = map[string]int32{ + "SORT_ORDER_NONE": 0, + "SORT_ORDER_ASCEND": 1, + "SORT_ORDER_DESCEND": 2, + } +) + +func (x SortOrder) Enum() *SortOrder { + p := new(SortOrder) + *p = x + return p +} + +func (x SortOrder) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (SortOrder) Descriptor() protoreflect.EnumDescriptor { + return file_common_proto_enumTypes[0].Descriptor() +} + +func (SortOrder) Type() protoreflect.EnumType { + return &file_common_proto_enumTypes[0] +} + +func (x SortOrder) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use SortOrder.Descriptor instead. +func (SortOrder) EnumDescriptor() ([]byte, []int) { + return file_common_proto_rawDescGZIP(), []int{0} +} + +// SortTarget defines the field to sort on. +type SortTarget int32 + +const ( + SortTarget_SORT_TARGET_KEY SortTarget = 0 + SortTarget_SORT_TARGET_VERSION SortTarget = 1 + SortTarget_SORT_TARGET_CREATE SortTarget = 2 + SortTarget_SORT_TARGET_MOD SortTarget = 3 + SortTarget_SORT_TARGET_VALUE SortTarget = 4 +) + +// Enum value maps for SortTarget. +var ( + SortTarget_name = map[int32]string{ + 0: "SORT_TARGET_KEY", + 1: "SORT_TARGET_VERSION", + 2: "SORT_TARGET_CREATE", + 3: "SORT_TARGET_MOD", + 4: "SORT_TARGET_VALUE", + } + SortTarget_value = map[string]int32{ + "SORT_TARGET_KEY": 0, + "SORT_TARGET_VERSION": 1, + "SORT_TARGET_CREATE": 2, + "SORT_TARGET_MOD": 3, + "SORT_TARGET_VALUE": 4, + } +) + +func (x SortTarget) Enum() *SortTarget { + p := new(SortTarget) + *p = x + return p +} + +func (x SortTarget) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (SortTarget) Descriptor() protoreflect.EnumDescriptor { + return file_common_proto_enumTypes[1].Descriptor() +} + +func (SortTarget) Type() protoreflect.EnumType { + return &file_common_proto_enumTypes[1] +} + +func (x SortTarget) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use SortTarget.Descriptor instead. +func (SortTarget) EnumDescriptor() ([]byte, []int) { + return file_common_proto_rawDescGZIP(), []int{1} +} + +// WatchEventType is the type of a watch event. +type WatchEventType int32 + +const ( + WatchEventType_WATCH_EVENT_TYPE_PUT WatchEventType = 0 + WatchEventType_WATCH_EVENT_TYPE_DELETE WatchEventType = 1 +) + +// Enum value maps for WatchEventType. +var ( + WatchEventType_name = map[int32]string{ + 0: "WATCH_EVENT_TYPE_PUT", + 1: "WATCH_EVENT_TYPE_DELETE", + } + WatchEventType_value = map[string]int32{ + "WATCH_EVENT_TYPE_PUT": 0, + "WATCH_EVENT_TYPE_DELETE": 1, + } +) + +func (x WatchEventType) Enum() *WatchEventType { + p := new(WatchEventType) + *p = x + return p +} + +func (x WatchEventType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (WatchEventType) Descriptor() protoreflect.EnumDescriptor { + return file_common_proto_enumTypes[2].Descriptor() +} + +func (WatchEventType) Type() protoreflect.EnumType { + return &file_common_proto_enumTypes[2] +} + +func (x WatchEventType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use WatchEventType.Descriptor instead. +func (WatchEventType) EnumDescriptor() ([]byte, []int) { + return file_common_proto_rawDescGZIP(), []int{2} +} + +// ResponseHeader is included in every response with cluster metadata. +type ResponseHeader struct { + state protoimpl.MessageState `protogen:"open.v1"` + ClusterId uint64 `protobuf:"varint,1,opt,name=cluster_id,json=clusterId,proto3" json:"cluster_id,omitempty"` + MemberId uint64 `protobuf:"varint,2,opt,name=member_id,json=memberId,proto3" json:"member_id,omitempty"` + // Current store revision when response was created. + Revision int64 `protobuf:"varint,3,opt,name=revision,proto3" json:"revision,omitempty"` + RaftTerm uint64 `protobuf:"varint,4,opt,name=raft_term,json=raftTerm,proto3" json:"raft_term,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ResponseHeader) Reset() { + *x = ResponseHeader{} + mi := &file_common_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ResponseHeader) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ResponseHeader) ProtoMessage() {} + +func (x *ResponseHeader) ProtoReflect() protoreflect.Message { + mi := &file_common_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 ResponseHeader.ProtoReflect.Descriptor instead. +func (*ResponseHeader) Descriptor() ([]byte, []int) { + return file_common_proto_rawDescGZIP(), []int{0} +} + +func (x *ResponseHeader) GetClusterId() uint64 { + if x != nil { + return x.ClusterId + } + return 0 +} + +func (x *ResponseHeader) GetMemberId() uint64 { + if x != nil { + return x.MemberId + } + return 0 +} + +func (x *ResponseHeader) GetRevision() int64 { + if x != nil { + return x.Revision + } + return 0 +} + +func (x *ResponseHeader) GetRaftTerm() uint64 { + if x != nil { + return x.RaftTerm + } + return 0 +} + +// KeyValue represents a key-value pair with metadata. +type KeyValue struct { + state protoimpl.MessageState `protogen:"open.v1"` + Key []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + Value []byte `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` + CreateRevision int64 `protobuf:"varint,3,opt,name=create_revision,json=createRevision,proto3" json:"create_revision,omitempty"` + ModRevision int64 `protobuf:"varint,4,opt,name=mod_revision,json=modRevision,proto3" json:"mod_revision,omitempty"` + Version int64 `protobuf:"varint,5,opt,name=version,proto3" json:"version,omitempty"` + Lease int64 `protobuf:"varint,6,opt,name=lease,proto3" json:"lease,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *KeyValue) Reset() { + *x = KeyValue{} + mi := &file_common_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *KeyValue) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*KeyValue) ProtoMessage() {} + +func (x *KeyValue) ProtoReflect() protoreflect.Message { + mi := &file_common_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 KeyValue.ProtoReflect.Descriptor instead. +func (*KeyValue) Descriptor() ([]byte, []int) { + return file_common_proto_rawDescGZIP(), []int{1} +} + +func (x *KeyValue) GetKey() []byte { + if x != nil { + return x.Key + } + return nil +} + +func (x *KeyValue) GetValue() []byte { + if x != nil { + return x.Value + } + return nil +} + +func (x *KeyValue) GetCreateRevision() int64 { + if x != nil { + return x.CreateRevision + } + return 0 +} + +func (x *KeyValue) GetModRevision() int64 { + if x != nil { + return x.ModRevision + } + return 0 +} + +func (x *KeyValue) GetVersion() int64 { + if x != nil { + return x.Version + } + return 0 +} + +func (x *KeyValue) GetLease() int64 { + if x != nil { + return x.Lease + } + return 0 +} + +// WatchEvent represents a single watch event. +type WatchEvent struct { + state protoimpl.MessageState `protogen:"open.v1"` + EventType WatchEventType `protobuf:"varint,1,opt,name=event_type,json=eventType,proto3,enum=aether.WatchEventType" json:"event_type,omitempty"` + Kv *KeyValue `protobuf:"bytes,2,opt,name=kv,proto3" json:"kv,omitempty"` + PrevKv *KeyValue `protobuf:"bytes,3,opt,name=prev_kv,json=prevKv,proto3" json:"prev_kv,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *WatchEvent) Reset() { + *x = WatchEvent{} + mi := &file_common_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *WatchEvent) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*WatchEvent) ProtoMessage() {} + +func (x *WatchEvent) ProtoReflect() protoreflect.Message { + mi := &file_common_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 WatchEvent.ProtoReflect.Descriptor instead. +func (*WatchEvent) Descriptor() ([]byte, []int) { + return file_common_proto_rawDescGZIP(), []int{2} +} + +func (x *WatchEvent) GetEventType() WatchEventType { + if x != nil { + return x.EventType + } + return WatchEventType_WATCH_EVENT_TYPE_PUT +} + +func (x *WatchEvent) GetKv() *KeyValue { + if x != nil { + return x.Kv + } + return nil +} + +func (x *WatchEvent) GetPrevKv() *KeyValue { + if x != nil { + return x.PrevKv + } + return nil +} + +// LeaseInfo contains lease metadata. +type LeaseInfo struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + Ttl int64 `protobuf:"varint,2,opt,name=ttl,proto3" json:"ttl,omitempty"` + GrantedTtl int64 `protobuf:"varint,3,opt,name=granted_ttl,json=grantedTtl,proto3" json:"granted_ttl,omitempty"` + Keys [][]byte `protobuf:"bytes,4,rep,name=keys,proto3" json:"keys,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *LeaseInfo) Reset() { + *x = LeaseInfo{} + mi := &file_common_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *LeaseInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LeaseInfo) ProtoMessage() {} + +func (x *LeaseInfo) ProtoReflect() protoreflect.Message { + mi := &file_common_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 LeaseInfo.ProtoReflect.Descriptor instead. +func (*LeaseInfo) Descriptor() ([]byte, []int) { + return file_common_proto_rawDescGZIP(), []int{3} +} + +func (x *LeaseInfo) GetId() int64 { + if x != nil { + return x.Id + } + return 0 +} + +func (x *LeaseInfo) GetTtl() int64 { + if x != nil { + return x.Ttl + } + return 0 +} + +func (x *LeaseInfo) GetGrantedTtl() int64 { + if x != nil { + return x.GrantedTtl + } + return 0 +} + +func (x *LeaseInfo) GetKeys() [][]byte { + if x != nil { + return x.Keys + } + return nil +} + +var File_common_proto protoreflect.FileDescriptor + +const file_common_proto_rawDesc = "" + + "\n" + + "\fcommon.proto\x12\x06aether\"\x85\x01\n" + + "\x0eResponseHeader\x12\x1d\n" + + "\n" + + "cluster_id\x18\x01 \x01(\x04R\tclusterId\x12\x1b\n" + + "\tmember_id\x18\x02 \x01(\x04R\bmemberId\x12\x1a\n" + + "\brevision\x18\x03 \x01(\x03R\brevision\x12\x1b\n" + + "\traft_term\x18\x04 \x01(\x04R\braftTerm\"\xae\x01\n" + + "\bKeyValue\x12\x10\n" + + "\x03key\x18\x01 \x01(\fR\x03key\x12\x14\n" + + "\x05value\x18\x02 \x01(\fR\x05value\x12'\n" + + "\x0fcreate_revision\x18\x03 \x01(\x03R\x0ecreateRevision\x12!\n" + + "\fmod_revision\x18\x04 \x01(\x03R\vmodRevision\x12\x18\n" + + "\aversion\x18\x05 \x01(\x03R\aversion\x12\x14\n" + + "\x05lease\x18\x06 \x01(\x03R\x05lease\"\x90\x01\n" + + "\n" + + "WatchEvent\x125\n" + + "\n" + + "event_type\x18\x01 \x01(\x0e2\x16.aether.WatchEventTypeR\teventType\x12 \n" + + "\x02kv\x18\x02 \x01(\v2\x10.aether.KeyValueR\x02kv\x12)\n" + + "\aprev_kv\x18\x03 \x01(\v2\x10.aether.KeyValueR\x06prevKv\"b\n" + + "\tLeaseInfo\x12\x0e\n" + + "\x02id\x18\x01 \x01(\x03R\x02id\x12\x10\n" + + "\x03ttl\x18\x02 \x01(\x03R\x03ttl\x12\x1f\n" + + "\vgranted_ttl\x18\x03 \x01(\x03R\n" + + "grantedTtl\x12\x12\n" + + "\x04keys\x18\x04 \x03(\fR\x04keys*O\n" + + "\tSortOrder\x12\x13\n" + + "\x0fSORT_ORDER_NONE\x10\x00\x12\x15\n" + + "\x11SORT_ORDER_ASCEND\x10\x01\x12\x16\n" + + "\x12SORT_ORDER_DESCEND\x10\x02*~\n" + + "\n" + + "SortTarget\x12\x13\n" + + "\x0fSORT_TARGET_KEY\x10\x00\x12\x17\n" + + "\x13SORT_TARGET_VERSION\x10\x01\x12\x16\n" + + "\x12SORT_TARGET_CREATE\x10\x02\x12\x13\n" + + "\x0fSORT_TARGET_MOD\x10\x03\x12\x15\n" + + "\x11SORT_TARGET_VALUE\x10\x04*G\n" + + "\x0eWatchEventType\x12\x18\n" + + "\x14WATCH_EVENT_TYPE_PUT\x10\x00\x12\x1b\n" + + "\x17WATCH_EVENT_TYPE_DELETE\x10\x01B-Z+github.com/aether-io/aether/sdk/go/aetherpbb\x06proto3" + +var ( + file_common_proto_rawDescOnce sync.Once + file_common_proto_rawDescData []byte +) + +func file_common_proto_rawDescGZIP() []byte { + file_common_proto_rawDescOnce.Do(func() { + file_common_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_common_proto_rawDesc), len(file_common_proto_rawDesc))) + }) + return file_common_proto_rawDescData +} + +var file_common_proto_enumTypes = make([]protoimpl.EnumInfo, 3) +var file_common_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_common_proto_goTypes = []any{ + (SortOrder)(0), // 0: aether.SortOrder + (SortTarget)(0), // 1: aether.SortTarget + (WatchEventType)(0), // 2: aether.WatchEventType + (*ResponseHeader)(nil), // 3: aether.ResponseHeader + (*KeyValue)(nil), // 4: aether.KeyValue + (*WatchEvent)(nil), // 5: aether.WatchEvent + (*LeaseInfo)(nil), // 6: aether.LeaseInfo +} +var file_common_proto_depIdxs = []int32{ + 2, // 0: aether.WatchEvent.event_type:type_name -> aether.WatchEventType + 4, // 1: aether.WatchEvent.kv:type_name -> aether.KeyValue + 4, // 2: aether.WatchEvent.prev_kv:type_name -> aether.KeyValue + 3, // [3:3] is the sub-list for method output_type + 3, // [3:3] is the sub-list for method input_type + 3, // [3:3] is the sub-list for extension type_name + 3, // [3:3] is the sub-list for extension extendee + 0, // [0:3] is the sub-list for field type_name +} + +func init() { file_common_proto_init() } +func file_common_proto_init() { + if File_common_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_common_proto_rawDesc), len(file_common_proto_rawDesc)), + NumEnums: 3, + NumMessages: 4, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_common_proto_goTypes, + DependencyIndexes: file_common_proto_depIdxs, + EnumInfos: file_common_proto_enumTypes, + MessageInfos: file_common_proto_msgTypes, + }.Build() + File_common_proto = out.File + file_common_proto_goTypes = nil + file_common_proto_depIdxs = nil +} diff --git a/sdk/go/aetherpb/election.pb.go b/sdk/go/aetherpb/election.pb.go new file mode 100644 index 0000000..f85db8a --- /dev/null +++ b/sdk/go/aetherpb/election.pb.go @@ -0,0 +1,532 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.6 +// protoc v6.32.0 +// source: election.proto + +package aetherpb + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + 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 CampaignRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // name is the election name to campaign for. + Name []byte `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // lease_id is the lease to associate with the campaign. + // The campaign is automatically revoked when the lease expires. + LeaseId int64 `protobuf:"varint,2,opt,name=lease_id,json=leaseId,proto3" json:"lease_id,omitempty"` + // value is the value to store with the campaign (typically the + // candidate's identity or proposal). + Value []byte `protobuf:"bytes,3,opt,name=value,proto3" json:"value,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CampaignRequest) Reset() { + *x = CampaignRequest{} + mi := &file_election_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CampaignRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CampaignRequest) ProtoMessage() {} + +func (x *CampaignRequest) ProtoReflect() protoreflect.Message { + mi := &file_election_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 CampaignRequest.ProtoReflect.Descriptor instead. +func (*CampaignRequest) Descriptor() ([]byte, []int) { + return file_election_proto_rawDescGZIP(), []int{0} +} + +func (x *CampaignRequest) GetName() []byte { + if x != nil { + return x.Name + } + return nil +} + +func (x *CampaignRequest) GetLeaseId() int64 { + if x != nil { + return x.LeaseId + } + return 0 +} + +func (x *CampaignRequest) GetValue() []byte { + if x != nil { + return x.Value + } + return nil +} + +type CampaignResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` + // leader_key is the key that identifies this campaign. It can be + // used to resign or query leadership. + LeaderKey []byte `protobuf:"bytes,2,opt,name=leader_key,json=leaderKey,proto3" json:"leader_key,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CampaignResponse) Reset() { + *x = CampaignResponse{} + mi := &file_election_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CampaignResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CampaignResponse) ProtoMessage() {} + +func (x *CampaignResponse) ProtoReflect() protoreflect.Message { + mi := &file_election_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 CampaignResponse.ProtoReflect.Descriptor instead. +func (*CampaignResponse) Descriptor() ([]byte, []int) { + return file_election_proto_rawDescGZIP(), []int{1} +} + +func (x *CampaignResponse) GetHeader() *ResponseHeader { + if x != nil { + return x.Header + } + return nil +} + +func (x *CampaignResponse) GetLeaderKey() []byte { + if x != nil { + return x.LeaderKey + } + return nil +} + +type LeaderRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // name is the election name. + Name []byte `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *LeaderRequest) Reset() { + *x = LeaderRequest{} + mi := &file_election_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *LeaderRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LeaderRequest) ProtoMessage() {} + +func (x *LeaderRequest) ProtoReflect() protoreflect.Message { + mi := &file_election_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 LeaderRequest.ProtoReflect.Descriptor instead. +func (*LeaderRequest) Descriptor() ([]byte, []int) { + return file_election_proto_rawDescGZIP(), []int{2} +} + +func (x *LeaderRequest) GetName() []byte { + if x != nil { + return x.Name + } + return nil +} + +type LeaderResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` + // kv is the current leader's key-value, empty if no leader. + Kv *KeyValue `protobuf:"bytes,2,opt,name=kv,proto3" json:"kv,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *LeaderResponse) Reset() { + *x = LeaderResponse{} + mi := &file_election_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *LeaderResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LeaderResponse) ProtoMessage() {} + +func (x *LeaderResponse) ProtoReflect() protoreflect.Message { + mi := &file_election_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 LeaderResponse.ProtoReflect.Descriptor instead. +func (*LeaderResponse) Descriptor() ([]byte, []int) { + return file_election_proto_rawDescGZIP(), []int{3} +} + +func (x *LeaderResponse) GetHeader() *ResponseHeader { + if x != nil { + return x.Header + } + return nil +} + +func (x *LeaderResponse) GetKv() *KeyValue { + if x != nil { + return x.Kv + } + return nil +} + +type ResignRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // leader_key is the key returned by Campaign. + LeaderKey []byte `protobuf:"bytes,1,opt,name=leader_key,json=leaderKey,proto3" json:"leader_key,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ResignRequest) Reset() { + *x = ResignRequest{} + mi := &file_election_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ResignRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ResignRequest) ProtoMessage() {} + +func (x *ResignRequest) ProtoReflect() protoreflect.Message { + mi := &file_election_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 ResignRequest.ProtoReflect.Descriptor instead. +func (*ResignRequest) Descriptor() ([]byte, []int) { + return file_election_proto_rawDescGZIP(), []int{4} +} + +func (x *ResignRequest) GetLeaderKey() []byte { + if x != nil { + return x.LeaderKey + } + return nil +} + +type ResignResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ResignResponse) Reset() { + *x = ResignResponse{} + mi := &file_election_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ResignResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ResignResponse) ProtoMessage() {} + +func (x *ResignResponse) ProtoReflect() protoreflect.Message { + mi := &file_election_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 ResignResponse.ProtoReflect.Descriptor instead. +func (*ResignResponse) Descriptor() ([]byte, []int) { + return file_election_proto_rawDescGZIP(), []int{5} +} + +func (x *ResignResponse) GetHeader() *ResponseHeader { + if x != nil { + return x.Header + } + return nil +} + +type ObserveRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // name is the election name to observe. + Name []byte `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ObserveRequest) Reset() { + *x = ObserveRequest{} + mi := &file_election_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ObserveRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ObserveRequest) ProtoMessage() {} + +func (x *ObserveRequest) ProtoReflect() protoreflect.Message { + mi := &file_election_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 ObserveRequest.ProtoReflect.Descriptor instead. +func (*ObserveRequest) Descriptor() ([]byte, []int) { + return file_election_proto_rawDescGZIP(), []int{6} +} + +func (x *ObserveRequest) GetName() []byte { + if x != nil { + return x.Name + } + return nil +} + +type ObserveResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` + // kv is the current leader's key-value. + Kv *KeyValue `protobuf:"bytes,2,opt,name=kv,proto3" json:"kv,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ObserveResponse) Reset() { + *x = ObserveResponse{} + mi := &file_election_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ObserveResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ObserveResponse) ProtoMessage() {} + +func (x *ObserveResponse) ProtoReflect() protoreflect.Message { + mi := &file_election_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 ObserveResponse.ProtoReflect.Descriptor instead. +func (*ObserveResponse) Descriptor() ([]byte, []int) { + return file_election_proto_rawDescGZIP(), []int{7} +} + +func (x *ObserveResponse) GetHeader() *ResponseHeader { + if x != nil { + return x.Header + } + return nil +} + +func (x *ObserveResponse) GetKv() *KeyValue { + if x != nil { + return x.Kv + } + return nil +} + +var File_election_proto protoreflect.FileDescriptor + +const file_election_proto_rawDesc = "" + + "\n" + + "\x0eelection.proto\x12\x06aether\x1a\fcommon.proto\"V\n" + + "\x0fCampaignRequest\x12\x12\n" + + "\x04name\x18\x01 \x01(\fR\x04name\x12\x19\n" + + "\blease_id\x18\x02 \x01(\x03R\aleaseId\x12\x14\n" + + "\x05value\x18\x03 \x01(\fR\x05value\"a\n" + + "\x10CampaignResponse\x12.\n" + + "\x06header\x18\x01 \x01(\v2\x16.aether.ResponseHeaderR\x06header\x12\x1d\n" + + "\n" + + "leader_key\x18\x02 \x01(\fR\tleaderKey\"#\n" + + "\rLeaderRequest\x12\x12\n" + + "\x04name\x18\x01 \x01(\fR\x04name\"b\n" + + "\x0eLeaderResponse\x12.\n" + + "\x06header\x18\x01 \x01(\v2\x16.aether.ResponseHeaderR\x06header\x12 \n" + + "\x02kv\x18\x02 \x01(\v2\x10.aether.KeyValueR\x02kv\".\n" + + "\rResignRequest\x12\x1d\n" + + "\n" + + "leader_key\x18\x01 \x01(\fR\tleaderKey\"@\n" + + "\x0eResignResponse\x12.\n" + + "\x06header\x18\x01 \x01(\v2\x16.aether.ResponseHeaderR\x06header\"$\n" + + "\x0eObserveRequest\x12\x12\n" + + "\x04name\x18\x01 \x01(\fR\x04name\"c\n" + + "\x0fObserveResponse\x12.\n" + + "\x06header\x18\x01 \x01(\v2\x16.aether.ResponseHeaderR\x06header\x12 \n" + + "\x02kv\x18\x02 \x01(\v2\x10.aether.KeyValueR\x02kv2\xff\x01\n" + + "\x0eAetherElection\x12=\n" + + "\bCampaign\x12\x17.aether.CampaignRequest\x1a\x18.aether.CampaignResponse\x127\n" + + "\x06Leader\x12\x15.aether.LeaderRequest\x1a\x16.aether.LeaderResponse\x127\n" + + "\x06Resign\x12\x15.aether.ResignRequest\x1a\x16.aether.ResignResponse\x12<\n" + + "\aObserve\x12\x16.aether.ObserveRequest\x1a\x17.aether.ObserveResponse0\x01B-Z+github.com/aether-io/aether/sdk/go/aetherpbb\x06proto3" + +var ( + file_election_proto_rawDescOnce sync.Once + file_election_proto_rawDescData []byte +) + +func file_election_proto_rawDescGZIP() []byte { + file_election_proto_rawDescOnce.Do(func() { + file_election_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_election_proto_rawDesc), len(file_election_proto_rawDesc))) + }) + return file_election_proto_rawDescData +} + +var file_election_proto_msgTypes = make([]protoimpl.MessageInfo, 8) +var file_election_proto_goTypes = []any{ + (*CampaignRequest)(nil), // 0: aether.CampaignRequest + (*CampaignResponse)(nil), // 1: aether.CampaignResponse + (*LeaderRequest)(nil), // 2: aether.LeaderRequest + (*LeaderResponse)(nil), // 3: aether.LeaderResponse + (*ResignRequest)(nil), // 4: aether.ResignRequest + (*ResignResponse)(nil), // 5: aether.ResignResponse + (*ObserveRequest)(nil), // 6: aether.ObserveRequest + (*ObserveResponse)(nil), // 7: aether.ObserveResponse + (*ResponseHeader)(nil), // 8: aether.ResponseHeader + (*KeyValue)(nil), // 9: aether.KeyValue +} +var file_election_proto_depIdxs = []int32{ + 8, // 0: aether.CampaignResponse.header:type_name -> aether.ResponseHeader + 8, // 1: aether.LeaderResponse.header:type_name -> aether.ResponseHeader + 9, // 2: aether.LeaderResponse.kv:type_name -> aether.KeyValue + 8, // 3: aether.ResignResponse.header:type_name -> aether.ResponseHeader + 8, // 4: aether.ObserveResponse.header:type_name -> aether.ResponseHeader + 9, // 5: aether.ObserveResponse.kv:type_name -> aether.KeyValue + 0, // 6: aether.AetherElection.Campaign:input_type -> aether.CampaignRequest + 2, // 7: aether.AetherElection.Leader:input_type -> aether.LeaderRequest + 4, // 8: aether.AetherElection.Resign:input_type -> aether.ResignRequest + 6, // 9: aether.AetherElection.Observe:input_type -> aether.ObserveRequest + 1, // 10: aether.AetherElection.Campaign:output_type -> aether.CampaignResponse + 3, // 11: aether.AetherElection.Leader:output_type -> aether.LeaderResponse + 5, // 12: aether.AetherElection.Resign:output_type -> aether.ResignResponse + 7, // 13: aether.AetherElection.Observe:output_type -> aether.ObserveResponse + 10, // [10:14] is the sub-list for method output_type + 6, // [6:10] is the sub-list for method input_type + 6, // [6:6] is the sub-list for extension type_name + 6, // [6:6] is the sub-list for extension extendee + 0, // [0:6] is the sub-list for field type_name +} + +func init() { file_election_proto_init() } +func file_election_proto_init() { + if File_election_proto != nil { + return + } + file_common_proto_init() + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_election_proto_rawDesc), len(file_election_proto_rawDesc)), + NumEnums: 0, + NumMessages: 8, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_election_proto_goTypes, + DependencyIndexes: file_election_proto_depIdxs, + MessageInfos: file_election_proto_msgTypes, + }.Build() + File_election_proto = out.File + file_election_proto_goTypes = nil + file_election_proto_depIdxs = nil +} diff --git a/sdk/go/aetherpb/election_grpc.pb.go b/sdk/go/aetherpb/election_grpc.pb.go new file mode 100644 index 0000000..6fa80d2 --- /dev/null +++ b/sdk/go/aetherpb/election_grpc.pb.go @@ -0,0 +1,257 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.5.1 +// - protoc v6.32.0 +// source: election.proto + +package aetherpb + +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 ( + AetherElection_Campaign_FullMethodName = "/aether.AetherElection/Campaign" + AetherElection_Leader_FullMethodName = "/aether.AetherElection/Leader" + AetherElection_Resign_FullMethodName = "/aether.AetherElection/Resign" + AetherElection_Observe_FullMethodName = "/aether.AetherElection/Observe" +) + +// AetherElectionClient is the client API for AetherElection 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. +// +// AetherElection provides distributed leader election operations. +// Elections are built on top of leases: a campaign creates a key with the +// given lease, ensuring automatic resignation when the lease expires. +type AetherElectionClient interface { + // Campaign waits to acquire leadership for the given election name. + // The caller becomes the leader and returns the leader key. Other + // callers block until the current leader resigns or their lease expires. + Campaign(ctx context.Context, in *CampaignRequest, opts ...grpc.CallOption) (*CampaignResponse, error) + // Leader returns the current leader of the given election. + Leader(ctx context.Context, in *LeaderRequest, opts ...grpc.CallOption) (*LeaderResponse, error) + // Resign voluntarily gives up leadership for the given leader key. + Resign(ctx context.Context, in *ResignRequest, opts ...grpc.CallOption) (*ResignResponse, error) + // Observe streams leadership changes for the given election name. + Observe(ctx context.Context, in *ObserveRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[ObserveResponse], error) +} + +type aetherElectionClient struct { + cc grpc.ClientConnInterface +} + +func NewAetherElectionClient(cc grpc.ClientConnInterface) AetherElectionClient { + return &aetherElectionClient{cc} +} + +func (c *aetherElectionClient) Campaign(ctx context.Context, in *CampaignRequest, opts ...grpc.CallOption) (*CampaignResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(CampaignResponse) + err := c.cc.Invoke(ctx, AetherElection_Campaign_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *aetherElectionClient) Leader(ctx context.Context, in *LeaderRequest, opts ...grpc.CallOption) (*LeaderResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(LeaderResponse) + err := c.cc.Invoke(ctx, AetherElection_Leader_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *aetherElectionClient) Resign(ctx context.Context, in *ResignRequest, opts ...grpc.CallOption) (*ResignResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(ResignResponse) + err := c.cc.Invoke(ctx, AetherElection_Resign_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *aetherElectionClient) Observe(ctx context.Context, in *ObserveRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[ObserveResponse], error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + stream, err := c.cc.NewStream(ctx, &AetherElection_ServiceDesc.Streams[0], AetherElection_Observe_FullMethodName, cOpts...) + if err != nil { + return nil, err + } + x := &grpc.GenericClientStream[ObserveRequest, ObserveResponse]{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 AetherElection_ObserveClient = grpc.ServerStreamingClient[ObserveResponse] + +// AetherElectionServer is the server API for AetherElection service. +// All implementations should embed UnimplementedAetherElectionServer +// for forward compatibility. +// +// AetherElection provides distributed leader election operations. +// Elections are built on top of leases: a campaign creates a key with the +// given lease, ensuring automatic resignation when the lease expires. +type AetherElectionServer interface { + // Campaign waits to acquire leadership for the given election name. + // The caller becomes the leader and returns the leader key. Other + // callers block until the current leader resigns or their lease expires. + Campaign(context.Context, *CampaignRequest) (*CampaignResponse, error) + // Leader returns the current leader of the given election. + Leader(context.Context, *LeaderRequest) (*LeaderResponse, error) + // Resign voluntarily gives up leadership for the given leader key. + Resign(context.Context, *ResignRequest) (*ResignResponse, error) + // Observe streams leadership changes for the given election name. + Observe(*ObserveRequest, grpc.ServerStreamingServer[ObserveResponse]) error +} + +// UnimplementedAetherElectionServer should 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 UnimplementedAetherElectionServer struct{} + +func (UnimplementedAetherElectionServer) Campaign(context.Context, *CampaignRequest) (*CampaignResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Campaign not implemented") +} +func (UnimplementedAetherElectionServer) Leader(context.Context, *LeaderRequest) (*LeaderResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Leader not implemented") +} +func (UnimplementedAetherElectionServer) Resign(context.Context, *ResignRequest) (*ResignResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Resign not implemented") +} +func (UnimplementedAetherElectionServer) Observe(*ObserveRequest, grpc.ServerStreamingServer[ObserveResponse]) error { + return status.Errorf(codes.Unimplemented, "method Observe not implemented") +} +func (UnimplementedAetherElectionServer) testEmbeddedByValue() {} + +// UnsafeAetherElectionServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to AetherElectionServer will +// result in compilation errors. +type UnsafeAetherElectionServer interface { + mustEmbedUnimplementedAetherElectionServer() +} + +func RegisterAetherElectionServer(s grpc.ServiceRegistrar, srv AetherElectionServer) { + // If the following call pancis, it indicates UnimplementedAetherElectionServer 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(&AetherElection_ServiceDesc, srv) +} + +func _AetherElection_Campaign_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CampaignRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AetherElectionServer).Campaign(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: AetherElection_Campaign_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AetherElectionServer).Campaign(ctx, req.(*CampaignRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _AetherElection_Leader_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(LeaderRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AetherElectionServer).Leader(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: AetherElection_Leader_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AetherElectionServer).Leader(ctx, req.(*LeaderRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _AetherElection_Resign_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ResignRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AetherElectionServer).Resign(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: AetherElection_Resign_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AetherElectionServer).Resign(ctx, req.(*ResignRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _AetherElection_Observe_Handler(srv interface{}, stream grpc.ServerStream) error { + m := new(ObserveRequest) + if err := stream.RecvMsg(m); err != nil { + return err + } + return srv.(AetherElectionServer).Observe(m, &grpc.GenericServerStream[ObserveRequest, ObserveResponse]{ServerStream: stream}) +} + +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type AetherElection_ObserveServer = grpc.ServerStreamingServer[ObserveResponse] + +// AetherElection_ServiceDesc is the grpc.ServiceDesc for AetherElection service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var AetherElection_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "aether.AetherElection", + HandlerType: (*AetherElectionServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Campaign", + Handler: _AetherElection_Campaign_Handler, + }, + { + MethodName: "Leader", + Handler: _AetherElection_Leader_Handler, + }, + { + MethodName: "Resign", + Handler: _AetherElection_Resign_Handler, + }, + }, + Streams: []grpc.StreamDesc{ + { + StreamName: "Observe", + Handler: _AetherElection_Observe_Handler, + ServerStreams: true, + }, + }, + Metadata: "election.proto", +} diff --git a/sdk/go/aetherpb/kv.pb.go b/sdk/go/aetherpb/kv.pb.go new file mode 100644 index 0000000..234729e --- /dev/null +++ b/sdk/go/aetherpb/kv.pb.go @@ -0,0 +1,1473 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.6 +// protoc v6.32.0 +// source: kv.proto + +package aetherpb + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + 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) +) + +// CompareResult defines the comparison result. +type CompareResult int32 + +const ( + CompareResult_COMPARE_RESULT_EQUAL CompareResult = 0 + CompareResult_COMPARE_RESULT_GREATER CompareResult = 1 + CompareResult_COMPARE_RESULT_LESS CompareResult = 2 + CompareResult_COMPARE_RESULT_NOT_EQUAL CompareResult = 3 +) + +// Enum value maps for CompareResult. +var ( + CompareResult_name = map[int32]string{ + 0: "COMPARE_RESULT_EQUAL", + 1: "COMPARE_RESULT_GREATER", + 2: "COMPARE_RESULT_LESS", + 3: "COMPARE_RESULT_NOT_EQUAL", + } + CompareResult_value = map[string]int32{ + "COMPARE_RESULT_EQUAL": 0, + "COMPARE_RESULT_GREATER": 1, + "COMPARE_RESULT_LESS": 2, + "COMPARE_RESULT_NOT_EQUAL": 3, + } +) + +func (x CompareResult) Enum() *CompareResult { + p := new(CompareResult) + *p = x + return p +} + +func (x CompareResult) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (CompareResult) Descriptor() protoreflect.EnumDescriptor { + return file_kv_proto_enumTypes[0].Descriptor() +} + +func (CompareResult) Type() protoreflect.EnumType { + return &file_kv_proto_enumTypes[0] +} + +func (x CompareResult) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use CompareResult.Descriptor instead. +func (CompareResult) EnumDescriptor() ([]byte, []int) { + return file_kv_proto_rawDescGZIP(), []int{0} +} + +// CompareTarget defines what to compare. +type CompareTarget int32 + +const ( + CompareTarget_COMPARE_TARGET_VERSION CompareTarget = 0 + CompareTarget_COMPARE_TARGET_CREATE CompareTarget = 1 + CompareTarget_COMPARE_TARGET_MOD CompareTarget = 2 + CompareTarget_COMPARE_TARGET_VALUE CompareTarget = 3 + CompareTarget_COMPARE_TARGET_LEASE CompareTarget = 4 +) + +// Enum value maps for CompareTarget. +var ( + CompareTarget_name = map[int32]string{ + 0: "COMPARE_TARGET_VERSION", + 1: "COMPARE_TARGET_CREATE", + 2: "COMPARE_TARGET_MOD", + 3: "COMPARE_TARGET_VALUE", + 4: "COMPARE_TARGET_LEASE", + } + CompareTarget_value = map[string]int32{ + "COMPARE_TARGET_VERSION": 0, + "COMPARE_TARGET_CREATE": 1, + "COMPARE_TARGET_MOD": 2, + "COMPARE_TARGET_VALUE": 3, + "COMPARE_TARGET_LEASE": 4, + } +) + +func (x CompareTarget) Enum() *CompareTarget { + p := new(CompareTarget) + *p = x + return p +} + +func (x CompareTarget) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (CompareTarget) Descriptor() protoreflect.EnumDescriptor { + return file_kv_proto_enumTypes[1].Descriptor() +} + +func (CompareTarget) Type() protoreflect.EnumType { + return &file_kv_proto_enumTypes[1] +} + +func (x CompareTarget) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use CompareTarget.Descriptor instead. +func (CompareTarget) EnumDescriptor() ([]byte, []int) { + return file_kv_proto_rawDescGZIP(), []int{1} +} + +type PutRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Key []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + Value []byte `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` + // lease is the lease ID to attach to the key, 0 = no lease. + Lease int64 `protobuf:"varint,3,opt,name=lease,proto3" json:"lease,omitempty"` + // prev_kv returns the previous key-value pair if true. + PrevKv bool `protobuf:"varint,4,opt,name=prev_kv,json=prevKv,proto3" json:"prev_kv,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *PutRequest) Reset() { + *x = PutRequest{} + mi := &file_kv_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *PutRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PutRequest) ProtoMessage() {} + +func (x *PutRequest) ProtoReflect() protoreflect.Message { + mi := &file_kv_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 PutRequest.ProtoReflect.Descriptor instead. +func (*PutRequest) Descriptor() ([]byte, []int) { + return file_kv_proto_rawDescGZIP(), []int{0} +} + +func (x *PutRequest) GetKey() []byte { + if x != nil { + return x.Key + } + return nil +} + +func (x *PutRequest) GetValue() []byte { + if x != nil { + return x.Value + } + return nil +} + +func (x *PutRequest) GetLease() int64 { + if x != nil { + return x.Lease + } + return 0 +} + +func (x *PutRequest) GetPrevKv() bool { + if x != nil { + return x.PrevKv + } + return false +} + +type PutResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` + // prev_kv is the previous key-value pair, set only if prev_kv was true. + PrevKv *KeyValue `protobuf:"bytes,2,opt,name=prev_kv,json=prevKv,proto3" json:"prev_kv,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *PutResponse) Reset() { + *x = PutResponse{} + mi := &file_kv_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *PutResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PutResponse) ProtoMessage() {} + +func (x *PutResponse) ProtoReflect() protoreflect.Message { + mi := &file_kv_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 PutResponse.ProtoReflect.Descriptor instead. +func (*PutResponse) Descriptor() ([]byte, []int) { + return file_kv_proto_rawDescGZIP(), []int{1} +} + +func (x *PutResponse) GetHeader() *ResponseHeader { + if x != nil { + return x.Header + } + return nil +} + +func (x *PutResponse) GetPrevKv() *KeyValue { + if x != nil { + return x.PrevKv + } + return nil +} + +type GetRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Key []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + // range_end is the upper bound of the range [key, range_end). + // Empty means single key lookup. + RangeEnd []byte `protobuf:"bytes,2,opt,name=range_end,json=rangeEnd,proto3" json:"range_end,omitempty"` + // limit is the maximum number of keys to return, 0 = no limit. + Limit int64 `protobuf:"varint,3,opt,name=limit,proto3" json:"limit,omitempty"` + // revision is the point-in-time revision to read, 0 = latest. + Revision int64 `protobuf:"varint,4,opt,name=revision,proto3" json:"revision,omitempty"` + // serializable enables serializable reads (may read stale data). + Serializable bool `protobuf:"varint,5,opt,name=serializable,proto3" json:"serializable,omitempty"` + SortOrder SortOrder `protobuf:"varint,6,opt,name=sort_order,json=sortOrder,proto3,enum=aether.SortOrder" json:"sort_order,omitempty"` + SortTarget SortTarget `protobuf:"varint,7,opt,name=sort_target,json=sortTarget,proto3,enum=aether.SortTarget" json:"sort_target,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetRequest) Reset() { + *x = GetRequest{} + mi := &file_kv_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetRequest) ProtoMessage() {} + +func (x *GetRequest) ProtoReflect() protoreflect.Message { + mi := &file_kv_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 GetRequest.ProtoReflect.Descriptor instead. +func (*GetRequest) Descriptor() ([]byte, []int) { + return file_kv_proto_rawDescGZIP(), []int{2} +} + +func (x *GetRequest) GetKey() []byte { + if x != nil { + return x.Key + } + return nil +} + +func (x *GetRequest) GetRangeEnd() []byte { + if x != nil { + return x.RangeEnd + } + return nil +} + +func (x *GetRequest) GetLimit() int64 { + if x != nil { + return x.Limit + } + return 0 +} + +func (x *GetRequest) GetRevision() int64 { + if x != nil { + return x.Revision + } + return 0 +} + +func (x *GetRequest) GetSerializable() bool { + if x != nil { + return x.Serializable + } + return false +} + +func (x *GetRequest) GetSortOrder() SortOrder { + if x != nil { + return x.SortOrder + } + return SortOrder_SORT_ORDER_NONE +} + +func (x *GetRequest) GetSortTarget() SortTarget { + if x != nil { + return x.SortTarget + } + return SortTarget_SORT_TARGET_KEY +} + +type GetResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` + Kvs []*KeyValue `protobuf:"bytes,2,rep,name=kvs,proto3" json:"kvs,omitempty"` + // count is the total number of keys in the range. + Count int64 `protobuf:"varint,3,opt,name=count,proto3" json:"count,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetResponse) Reset() { + *x = GetResponse{} + mi := &file_kv_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetResponse) ProtoMessage() {} + +func (x *GetResponse) ProtoReflect() protoreflect.Message { + mi := &file_kv_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 GetResponse.ProtoReflect.Descriptor instead. +func (*GetResponse) Descriptor() ([]byte, []int) { + return file_kv_proto_rawDescGZIP(), []int{3} +} + +func (x *GetResponse) GetHeader() *ResponseHeader { + if x != nil { + return x.Header + } + return nil +} + +func (x *GetResponse) GetKvs() []*KeyValue { + if x != nil { + return x.Kvs + } + return nil +} + +func (x *GetResponse) GetCount() int64 { + if x != nil { + return x.Count + } + return 0 +} + +type DeleteRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Key []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + // range_end is the upper bound of the range [key, range_end). + // Empty means single key delete. + RangeEnd []byte `protobuf:"bytes,2,opt,name=range_end,json=rangeEnd,proto3" json:"range_end,omitempty"` + // prev_kv returns the deleted key-value pairs if true. + PrevKv bool `protobuf:"varint,3,opt,name=prev_kv,json=prevKv,proto3" json:"prev_kv,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DeleteRequest) Reset() { + *x = DeleteRequest{} + mi := &file_kv_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DeleteRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteRequest) ProtoMessage() {} + +func (x *DeleteRequest) ProtoReflect() protoreflect.Message { + mi := &file_kv_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 DeleteRequest.ProtoReflect.Descriptor instead. +func (*DeleteRequest) Descriptor() ([]byte, []int) { + return file_kv_proto_rawDescGZIP(), []int{4} +} + +func (x *DeleteRequest) GetKey() []byte { + if x != nil { + return x.Key + } + return nil +} + +func (x *DeleteRequest) GetRangeEnd() []byte { + if x != nil { + return x.RangeEnd + } + return nil +} + +func (x *DeleteRequest) GetPrevKv() bool { + if x != nil { + return x.PrevKv + } + return false +} + +type DeleteResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` + // deleted is the number of keys deleted. + Deleted int64 `protobuf:"varint,2,opt,name=deleted,proto3" json:"deleted,omitempty"` + // prev_kvs contains the deleted key-value pairs, set only if prev_kv was true. + PrevKvs []*KeyValue `protobuf:"bytes,3,rep,name=prev_kvs,json=prevKvs,proto3" json:"prev_kvs,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DeleteResponse) Reset() { + *x = DeleteResponse{} + mi := &file_kv_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DeleteResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteResponse) ProtoMessage() {} + +func (x *DeleteResponse) ProtoReflect() protoreflect.Message { + mi := &file_kv_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 DeleteResponse.ProtoReflect.Descriptor instead. +func (*DeleteResponse) Descriptor() ([]byte, []int) { + return file_kv_proto_rawDescGZIP(), []int{5} +} + +func (x *DeleteResponse) GetHeader() *ResponseHeader { + if x != nil { + return x.Header + } + return nil +} + +func (x *DeleteResponse) GetDeleted() int64 { + if x != nil { + return x.Deleted + } + return 0 +} + +func (x *DeleteResponse) GetPrevKvs() []*KeyValue { + if x != nil { + return x.PrevKvs + } + return nil +} + +// RangeRequest gets the keys in the range [key, range_end). +type RangeRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Key []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + // range_end is the upper bound of the range [key, range_end). + // If range_end is "\0", it returns all keys from key to end of keyspace. + // If range_end is empty, it returns only the key. + RangeEnd []byte `protobuf:"bytes,2,opt,name=range_end,json=rangeEnd,proto3" json:"range_end,omitempty"` + // limit is the maximum number of keys to return, 0 = no limit. + Limit int64 `protobuf:"varint,3,opt,name=limit,proto3" json:"limit,omitempty"` + // revision is the point-in-time revision to read, 0 = latest. + Revision int64 `protobuf:"varint,4,opt,name=revision,proto3" json:"revision,omitempty"` + SortOrder SortOrder `protobuf:"varint,5,opt,name=sort_order,json=sortOrder,proto3,enum=aether.SortOrder" json:"sort_order,omitempty"` + SortTarget SortTarget `protobuf:"varint,6,opt,name=sort_target,json=sortTarget,proto3,enum=aether.SortTarget" json:"sort_target,omitempty"` + // serializable enables serializable reads (may read stale data). + Serializable bool `protobuf:"varint,7,opt,name=serializable,proto3" json:"serializable,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RangeRequest) Reset() { + *x = RangeRequest{} + mi := &file_kv_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RangeRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RangeRequest) ProtoMessage() {} + +func (x *RangeRequest) ProtoReflect() protoreflect.Message { + mi := &file_kv_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 RangeRequest.ProtoReflect.Descriptor instead. +func (*RangeRequest) Descriptor() ([]byte, []int) { + return file_kv_proto_rawDescGZIP(), []int{6} +} + +func (x *RangeRequest) GetKey() []byte { + if x != nil { + return x.Key + } + return nil +} + +func (x *RangeRequest) GetRangeEnd() []byte { + if x != nil { + return x.RangeEnd + } + return nil +} + +func (x *RangeRequest) GetLimit() int64 { + if x != nil { + return x.Limit + } + return 0 +} + +func (x *RangeRequest) GetRevision() int64 { + if x != nil { + return x.Revision + } + return 0 +} + +func (x *RangeRequest) GetSortOrder() SortOrder { + if x != nil { + return x.SortOrder + } + return SortOrder_SORT_ORDER_NONE +} + +func (x *RangeRequest) GetSortTarget() SortTarget { + if x != nil { + return x.SortTarget + } + return SortTarget_SORT_TARGET_KEY +} + +func (x *RangeRequest) GetSerializable() bool { + if x != nil { + return x.Serializable + } + return false +} + +type RangeResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` + Kvs []*KeyValue `protobuf:"bytes,2,rep,name=kvs,proto3" json:"kvs,omitempty"` + // count is the total number of keys in the range. + Count int64 `protobuf:"varint,3,opt,name=count,proto3" json:"count,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RangeResponse) Reset() { + *x = RangeResponse{} + mi := &file_kv_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RangeResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RangeResponse) ProtoMessage() {} + +func (x *RangeResponse) ProtoReflect() protoreflect.Message { + mi := &file_kv_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 RangeResponse.ProtoReflect.Descriptor instead. +func (*RangeResponse) Descriptor() ([]byte, []int) { + return file_kv_proto_rawDescGZIP(), []int{7} +} + +func (x *RangeResponse) GetHeader() *ResponseHeader { + if x != nil { + return x.Header + } + return nil +} + +func (x *RangeResponse) GetKvs() []*KeyValue { + if x != nil { + return x.Kvs + } + return nil +} + +func (x *RangeResponse) GetCount() int64 { + if x != nil { + return x.Count + } + return 0 +} + +// Compare defines a comparison condition for a transaction. +type Compare struct { + state protoimpl.MessageState `protogen:"open.v1"` + Result CompareResult `protobuf:"varint,1,opt,name=result,proto3,enum=aether.CompareResult" json:"result,omitempty"` + Target CompareTarget `protobuf:"varint,2,opt,name=target,proto3,enum=aether.CompareTarget" json:"target,omitempty"` + Key []byte `protobuf:"bytes,3,opt,name=key,proto3" json:"key,omitempty"` + // Types that are valid to be assigned to TargetUnion: + // + // *Compare_Version + // *Compare_CreateRevision + // *Compare_ModRevision + // *Compare_Value + // *Compare_Lease + TargetUnion isCompare_TargetUnion `protobuf_oneof:"target_union"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Compare) Reset() { + *x = Compare{} + mi := &file_kv_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Compare) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Compare) ProtoMessage() {} + +func (x *Compare) ProtoReflect() protoreflect.Message { + mi := &file_kv_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 Compare.ProtoReflect.Descriptor instead. +func (*Compare) Descriptor() ([]byte, []int) { + return file_kv_proto_rawDescGZIP(), []int{8} +} + +func (x *Compare) GetResult() CompareResult { + if x != nil { + return x.Result + } + return CompareResult_COMPARE_RESULT_EQUAL +} + +func (x *Compare) GetTarget() CompareTarget { + if x != nil { + return x.Target + } + return CompareTarget_COMPARE_TARGET_VERSION +} + +func (x *Compare) GetKey() []byte { + if x != nil { + return x.Key + } + return nil +} + +func (x *Compare) GetTargetUnion() isCompare_TargetUnion { + if x != nil { + return x.TargetUnion + } + return nil +} + +func (x *Compare) GetVersion() int64 { + if x != nil { + if x, ok := x.TargetUnion.(*Compare_Version); ok { + return x.Version + } + } + return 0 +} + +func (x *Compare) GetCreateRevision() int64 { + if x != nil { + if x, ok := x.TargetUnion.(*Compare_CreateRevision); ok { + return x.CreateRevision + } + } + return 0 +} + +func (x *Compare) GetModRevision() int64 { + if x != nil { + if x, ok := x.TargetUnion.(*Compare_ModRevision); ok { + return x.ModRevision + } + } + return 0 +} + +func (x *Compare) GetValue() []byte { + if x != nil { + if x, ok := x.TargetUnion.(*Compare_Value); ok { + return x.Value + } + } + return nil +} + +func (x *Compare) GetLease() int64 { + if x != nil { + if x, ok := x.TargetUnion.(*Compare_Lease); ok { + return x.Lease + } + } + return 0 +} + +type isCompare_TargetUnion interface { + isCompare_TargetUnion() +} + +type Compare_Version struct { + Version int64 `protobuf:"varint,4,opt,name=version,proto3,oneof"` +} + +type Compare_CreateRevision struct { + CreateRevision int64 `protobuf:"varint,5,opt,name=create_revision,json=createRevision,proto3,oneof"` +} + +type Compare_ModRevision struct { + ModRevision int64 `protobuf:"varint,6,opt,name=mod_revision,json=modRevision,proto3,oneof"` +} + +type Compare_Value struct { + Value []byte `protobuf:"bytes,7,opt,name=value,proto3,oneof"` +} + +type Compare_Lease struct { + Lease int64 `protobuf:"varint,8,opt,name=lease,proto3,oneof"` +} + +func (*Compare_Version) isCompare_TargetUnion() {} + +func (*Compare_CreateRevision) isCompare_TargetUnion() {} + +func (*Compare_ModRevision) isCompare_TargetUnion() {} + +func (*Compare_Value) isCompare_TargetUnion() {} + +func (*Compare_Lease) isCompare_TargetUnion() {} + +// RequestOp is a single operation within a transaction. +type RequestOp struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Types that are valid to be assigned to Request: + // + // *RequestOp_Put + // *RequestOp_Get + // *RequestOp_Delete + // *RequestOp_Range + // *RequestOp_Txn + Request isRequestOp_Request `protobuf_oneof:"request"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RequestOp) Reset() { + *x = RequestOp{} + mi := &file_kv_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RequestOp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RequestOp) ProtoMessage() {} + +func (x *RequestOp) ProtoReflect() protoreflect.Message { + mi := &file_kv_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 RequestOp.ProtoReflect.Descriptor instead. +func (*RequestOp) Descriptor() ([]byte, []int) { + return file_kv_proto_rawDescGZIP(), []int{9} +} + +func (x *RequestOp) GetRequest() isRequestOp_Request { + if x != nil { + return x.Request + } + return nil +} + +func (x *RequestOp) GetPut() *PutRequest { + if x != nil { + if x, ok := x.Request.(*RequestOp_Put); ok { + return x.Put + } + } + return nil +} + +func (x *RequestOp) GetGet() *GetRequest { + if x != nil { + if x, ok := x.Request.(*RequestOp_Get); ok { + return x.Get + } + } + return nil +} + +func (x *RequestOp) GetDelete() *DeleteRequest { + if x != nil { + if x, ok := x.Request.(*RequestOp_Delete); ok { + return x.Delete + } + } + return nil +} + +func (x *RequestOp) GetRange() *RangeRequest { + if x != nil { + if x, ok := x.Request.(*RequestOp_Range); ok { + return x.Range + } + } + return nil +} + +func (x *RequestOp) GetTxn() *TxnRequest { + if x != nil { + if x, ok := x.Request.(*RequestOp_Txn); ok { + return x.Txn + } + } + return nil +} + +type isRequestOp_Request interface { + isRequestOp_Request() +} + +type RequestOp_Put struct { + Put *PutRequest `protobuf:"bytes,1,opt,name=put,proto3,oneof"` +} + +type RequestOp_Get struct { + Get *GetRequest `protobuf:"bytes,2,opt,name=get,proto3,oneof"` +} + +type RequestOp_Delete struct { + Delete *DeleteRequest `protobuf:"bytes,3,opt,name=delete,proto3,oneof"` +} + +type RequestOp_Range struct { + Range *RangeRequest `protobuf:"bytes,4,opt,name=range,proto3,oneof"` +} + +type RequestOp_Txn struct { + Txn *TxnRequest `protobuf:"bytes,5,opt,name=txn,proto3,oneof"` +} + +func (*RequestOp_Put) isRequestOp_Request() {} + +func (*RequestOp_Get) isRequestOp_Request() {} + +func (*RequestOp_Delete) isRequestOp_Request() {} + +func (*RequestOp_Range) isRequestOp_Request() {} + +func (*RequestOp_Txn) isRequestOp_Request() {} + +// ResponseOp is the response for a single operation within a transaction. +type ResponseOp struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Types that are valid to be assigned to Response: + // + // *ResponseOp_Put + // *ResponseOp_Get + // *ResponseOp_Delete + // *ResponseOp_Range + // *ResponseOp_Txn + Response isResponseOp_Response `protobuf_oneof:"response"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ResponseOp) Reset() { + *x = ResponseOp{} + mi := &file_kv_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ResponseOp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ResponseOp) ProtoMessage() {} + +func (x *ResponseOp) ProtoReflect() protoreflect.Message { + mi := &file_kv_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 ResponseOp.ProtoReflect.Descriptor instead. +func (*ResponseOp) Descriptor() ([]byte, []int) { + return file_kv_proto_rawDescGZIP(), []int{10} +} + +func (x *ResponseOp) GetResponse() isResponseOp_Response { + if x != nil { + return x.Response + } + return nil +} + +func (x *ResponseOp) GetPut() *PutResponse { + if x != nil { + if x, ok := x.Response.(*ResponseOp_Put); ok { + return x.Put + } + } + return nil +} + +func (x *ResponseOp) GetGet() *GetResponse { + if x != nil { + if x, ok := x.Response.(*ResponseOp_Get); ok { + return x.Get + } + } + return nil +} + +func (x *ResponseOp) GetDelete() *DeleteResponse { + if x != nil { + if x, ok := x.Response.(*ResponseOp_Delete); ok { + return x.Delete + } + } + return nil +} + +func (x *ResponseOp) GetRange() *RangeResponse { + if x != nil { + if x, ok := x.Response.(*ResponseOp_Range); ok { + return x.Range + } + } + return nil +} + +func (x *ResponseOp) GetTxn() *TxnResponse { + if x != nil { + if x, ok := x.Response.(*ResponseOp_Txn); ok { + return x.Txn + } + } + return nil +} + +type isResponseOp_Response interface { + isResponseOp_Response() +} + +type ResponseOp_Put struct { + Put *PutResponse `protobuf:"bytes,1,opt,name=put,proto3,oneof"` +} + +type ResponseOp_Get struct { + Get *GetResponse `protobuf:"bytes,2,opt,name=get,proto3,oneof"` +} + +type ResponseOp_Delete struct { + Delete *DeleteResponse `protobuf:"bytes,3,opt,name=delete,proto3,oneof"` +} + +type ResponseOp_Range struct { + Range *RangeResponse `protobuf:"bytes,4,opt,name=range,proto3,oneof"` +} + +type ResponseOp_Txn struct { + Txn *TxnResponse `protobuf:"bytes,5,opt,name=txn,proto3,oneof"` +} + +func (*ResponseOp_Put) isResponseOp_Response() {} + +func (*ResponseOp_Get) isResponseOp_Response() {} + +func (*ResponseOp_Delete) isResponseOp_Response() {} + +func (*ResponseOp_Range) isResponseOp_Response() {} + +func (*ResponseOp_Txn) isResponseOp_Response() {} + +// TxnRequest processes multiple operations in a single transaction. +type TxnRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // compare is the list of conditions that must all be true for success. + Compare []*Compare `protobuf:"bytes,1,rep,name=compare,proto3" json:"compare,omitempty"` + // success is the list of operations to execute if all compares succeed. + Success []*RequestOp `protobuf:"bytes,2,rep,name=success,proto3" json:"success,omitempty"` + // failure is the list of operations to execute if any compare fails. + Failure []*RequestOp `protobuf:"bytes,3,rep,name=failure,proto3" json:"failure,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *TxnRequest) Reset() { + *x = TxnRequest{} + mi := &file_kv_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *TxnRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TxnRequest) ProtoMessage() {} + +func (x *TxnRequest) ProtoReflect() protoreflect.Message { + mi := &file_kv_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 TxnRequest.ProtoReflect.Descriptor instead. +func (*TxnRequest) Descriptor() ([]byte, []int) { + return file_kv_proto_rawDescGZIP(), []int{11} +} + +func (x *TxnRequest) GetCompare() []*Compare { + if x != nil { + return x.Compare + } + return nil +} + +func (x *TxnRequest) GetSuccess() []*RequestOp { + if x != nil { + return x.Success + } + return nil +} + +func (x *TxnRequest) GetFailure() []*RequestOp { + if x != nil { + return x.Failure + } + return nil +} + +type TxnResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` + // succeeded is true if all compares succeeded. + Succeeded bool `protobuf:"varint,2,opt,name=succeeded,proto3" json:"succeeded,omitempty"` + // responses contains the results of the executed operations. + Responses []*ResponseOp `protobuf:"bytes,3,rep,name=responses,proto3" json:"responses,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *TxnResponse) Reset() { + *x = TxnResponse{} + mi := &file_kv_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *TxnResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TxnResponse) ProtoMessage() {} + +func (x *TxnResponse) ProtoReflect() protoreflect.Message { + mi := &file_kv_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 TxnResponse.ProtoReflect.Descriptor instead. +func (*TxnResponse) Descriptor() ([]byte, []int) { + return file_kv_proto_rawDescGZIP(), []int{12} +} + +func (x *TxnResponse) GetHeader() *ResponseHeader { + if x != nil { + return x.Header + } + return nil +} + +func (x *TxnResponse) GetSucceeded() bool { + if x != nil { + return x.Succeeded + } + return false +} + +func (x *TxnResponse) GetResponses() []*ResponseOp { + if x != nil { + return x.Responses + } + return nil +} + +var File_kv_proto protoreflect.FileDescriptor + +const file_kv_proto_rawDesc = "" + + "\n" + + "\bkv.proto\x12\x06aether\x1a\fcommon.proto\"c\n" + + "\n" + + "PutRequest\x12\x10\n" + + "\x03key\x18\x01 \x01(\fR\x03key\x12\x14\n" + + "\x05value\x18\x02 \x01(\fR\x05value\x12\x14\n" + + "\x05lease\x18\x03 \x01(\x03R\x05lease\x12\x17\n" + + "\aprev_kv\x18\x04 \x01(\bR\x06prevKv\"h\n" + + "\vPutResponse\x12.\n" + + "\x06header\x18\x01 \x01(\v2\x16.aether.ResponseHeaderR\x06header\x12)\n" + + "\aprev_kv\x18\x02 \x01(\v2\x10.aether.KeyValueR\x06prevKv\"\xf8\x01\n" + + "\n" + + "GetRequest\x12\x10\n" + + "\x03key\x18\x01 \x01(\fR\x03key\x12\x1b\n" + + "\trange_end\x18\x02 \x01(\fR\brangeEnd\x12\x14\n" + + "\x05limit\x18\x03 \x01(\x03R\x05limit\x12\x1a\n" + + "\brevision\x18\x04 \x01(\x03R\brevision\x12\"\n" + + "\fserializable\x18\x05 \x01(\bR\fserializable\x120\n" + + "\n" + + "sort_order\x18\x06 \x01(\x0e2\x11.aether.SortOrderR\tsortOrder\x123\n" + + "\vsort_target\x18\a \x01(\x0e2\x12.aether.SortTargetR\n" + + "sortTarget\"w\n" + + "\vGetResponse\x12.\n" + + "\x06header\x18\x01 \x01(\v2\x16.aether.ResponseHeaderR\x06header\x12\"\n" + + "\x03kvs\x18\x02 \x03(\v2\x10.aether.KeyValueR\x03kvs\x12\x14\n" + + "\x05count\x18\x03 \x01(\x03R\x05count\"W\n" + + "\rDeleteRequest\x12\x10\n" + + "\x03key\x18\x01 \x01(\fR\x03key\x12\x1b\n" + + "\trange_end\x18\x02 \x01(\fR\brangeEnd\x12\x17\n" + + "\aprev_kv\x18\x03 \x01(\bR\x06prevKv\"\x87\x01\n" + + "\x0eDeleteResponse\x12.\n" + + "\x06header\x18\x01 \x01(\v2\x16.aether.ResponseHeaderR\x06header\x12\x18\n" + + "\adeleted\x18\x02 \x01(\x03R\adeleted\x12+\n" + + "\bprev_kvs\x18\x03 \x03(\v2\x10.aether.KeyValueR\aprevKvs\"\xfa\x01\n" + + "\fRangeRequest\x12\x10\n" + + "\x03key\x18\x01 \x01(\fR\x03key\x12\x1b\n" + + "\trange_end\x18\x02 \x01(\fR\brangeEnd\x12\x14\n" + + "\x05limit\x18\x03 \x01(\x03R\x05limit\x12\x1a\n" + + "\brevision\x18\x04 \x01(\x03R\brevision\x120\n" + + "\n" + + "sort_order\x18\x05 \x01(\x0e2\x11.aether.SortOrderR\tsortOrder\x123\n" + + "\vsort_target\x18\x06 \x01(\x0e2\x12.aether.SortTargetR\n" + + "sortTarget\x12\"\n" + + "\fserializable\x18\a \x01(\bR\fserializable\"y\n" + + "\rRangeResponse\x12.\n" + + "\x06header\x18\x01 \x01(\v2\x16.aether.ResponseHeaderR\x06header\x12\"\n" + + "\x03kvs\x18\x02 \x03(\v2\x10.aether.KeyValueR\x03kvs\x12\x14\n" + + "\x05count\x18\x03 \x01(\x03R\x05count\"\xa5\x02\n" + + "\aCompare\x12-\n" + + "\x06result\x18\x01 \x01(\x0e2\x15.aether.CompareResultR\x06result\x12-\n" + + "\x06target\x18\x02 \x01(\x0e2\x15.aether.CompareTargetR\x06target\x12\x10\n" + + "\x03key\x18\x03 \x01(\fR\x03key\x12\x1a\n" + + "\aversion\x18\x04 \x01(\x03H\x00R\aversion\x12)\n" + + "\x0fcreate_revision\x18\x05 \x01(\x03H\x00R\x0ecreateRevision\x12#\n" + + "\fmod_revision\x18\x06 \x01(\x03H\x00R\vmodRevision\x12\x16\n" + + "\x05value\x18\a \x01(\fH\x00R\x05value\x12\x16\n" + + "\x05lease\x18\b \x01(\x03H\x00R\x05leaseB\x0e\n" + + "\ftarget_union\"\xed\x01\n" + + "\tRequestOp\x12&\n" + + "\x03put\x18\x01 \x01(\v2\x12.aether.PutRequestH\x00R\x03put\x12&\n" + + "\x03get\x18\x02 \x01(\v2\x12.aether.GetRequestH\x00R\x03get\x12/\n" + + "\x06delete\x18\x03 \x01(\v2\x15.aether.DeleteRequestH\x00R\x06delete\x12,\n" + + "\x05range\x18\x04 \x01(\v2\x14.aether.RangeRequestH\x00R\x05range\x12&\n" + + "\x03txn\x18\x05 \x01(\v2\x12.aether.TxnRequestH\x00R\x03txnB\t\n" + + "\arequest\"\xf4\x01\n" + + "\n" + + "ResponseOp\x12'\n" + + "\x03put\x18\x01 \x01(\v2\x13.aether.PutResponseH\x00R\x03put\x12'\n" + + "\x03get\x18\x02 \x01(\v2\x13.aether.GetResponseH\x00R\x03get\x120\n" + + "\x06delete\x18\x03 \x01(\v2\x16.aether.DeleteResponseH\x00R\x06delete\x12-\n" + + "\x05range\x18\x04 \x01(\v2\x15.aether.RangeResponseH\x00R\x05range\x12'\n" + + "\x03txn\x18\x05 \x01(\v2\x13.aether.TxnResponseH\x00R\x03txnB\n" + + "\n" + + "\bresponse\"\x91\x01\n" + + "\n" + + "TxnRequest\x12)\n" + + "\acompare\x18\x01 \x03(\v2\x0f.aether.CompareR\acompare\x12+\n" + + "\asuccess\x18\x02 \x03(\v2\x11.aether.RequestOpR\asuccess\x12+\n" + + "\afailure\x18\x03 \x03(\v2\x11.aether.RequestOpR\afailure\"\x8d\x01\n" + + "\vTxnResponse\x12.\n" + + "\x06header\x18\x01 \x01(\v2\x16.aether.ResponseHeaderR\x06header\x12\x1c\n" + + "\tsucceeded\x18\x02 \x01(\bR\tsucceeded\x120\n" + + "\tresponses\x18\x03 \x03(\v2\x12.aether.ResponseOpR\tresponses*|\n" + + "\rCompareResult\x12\x18\n" + + "\x14COMPARE_RESULT_EQUAL\x10\x00\x12\x1a\n" + + "\x16COMPARE_RESULT_GREATER\x10\x01\x12\x17\n" + + "\x13COMPARE_RESULT_LESS\x10\x02\x12\x1c\n" + + "\x18COMPARE_RESULT_NOT_EQUAL\x10\x03*\x92\x01\n" + + "\rCompareTarget\x12\x1a\n" + + "\x16COMPARE_TARGET_VERSION\x10\x00\x12\x19\n" + + "\x15COMPARE_TARGET_CREATE\x10\x01\x12\x16\n" + + "\x12COMPARE_TARGET_MOD\x10\x02\x12\x18\n" + + "\x14COMPARE_TARGET_VALUE\x10\x03\x12\x18\n" + + "\x14COMPARE_TARGET_LEASE\x10\x042\x89\x02\n" + + "\bAetherKV\x12.\n" + + "\x03Put\x12\x12.aether.PutRequest\x1a\x13.aether.PutResponse\x12.\n" + + "\x03Get\x12\x12.aether.GetRequest\x1a\x13.aether.GetResponse\x127\n" + + "\x06Delete\x12\x15.aether.DeleteRequest\x1a\x16.aether.DeleteResponse\x124\n" + + "\x05Range\x12\x14.aether.RangeRequest\x1a\x15.aether.RangeResponse\x12.\n" + + "\x03Txn\x12\x12.aether.TxnRequest\x1a\x13.aether.TxnResponseB-Z+github.com/aether-io/aether/sdk/go/aetherpbb\x06proto3" + +var ( + file_kv_proto_rawDescOnce sync.Once + file_kv_proto_rawDescData []byte +) + +func file_kv_proto_rawDescGZIP() []byte { + file_kv_proto_rawDescOnce.Do(func() { + file_kv_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_kv_proto_rawDesc), len(file_kv_proto_rawDesc))) + }) + return file_kv_proto_rawDescData +} + +var file_kv_proto_enumTypes = make([]protoimpl.EnumInfo, 2) +var file_kv_proto_msgTypes = make([]protoimpl.MessageInfo, 13) +var file_kv_proto_goTypes = []any{ + (CompareResult)(0), // 0: aether.CompareResult + (CompareTarget)(0), // 1: aether.CompareTarget + (*PutRequest)(nil), // 2: aether.PutRequest + (*PutResponse)(nil), // 3: aether.PutResponse + (*GetRequest)(nil), // 4: aether.GetRequest + (*GetResponse)(nil), // 5: aether.GetResponse + (*DeleteRequest)(nil), // 6: aether.DeleteRequest + (*DeleteResponse)(nil), // 7: aether.DeleteResponse + (*RangeRequest)(nil), // 8: aether.RangeRequest + (*RangeResponse)(nil), // 9: aether.RangeResponse + (*Compare)(nil), // 10: aether.Compare + (*RequestOp)(nil), // 11: aether.RequestOp + (*ResponseOp)(nil), // 12: aether.ResponseOp + (*TxnRequest)(nil), // 13: aether.TxnRequest + (*TxnResponse)(nil), // 14: aether.TxnResponse + (*ResponseHeader)(nil), // 15: aether.ResponseHeader + (*KeyValue)(nil), // 16: aether.KeyValue + (SortOrder)(0), // 17: aether.SortOrder + (SortTarget)(0), // 18: aether.SortTarget +} +var file_kv_proto_depIdxs = []int32{ + 15, // 0: aether.PutResponse.header:type_name -> aether.ResponseHeader + 16, // 1: aether.PutResponse.prev_kv:type_name -> aether.KeyValue + 17, // 2: aether.GetRequest.sort_order:type_name -> aether.SortOrder + 18, // 3: aether.GetRequest.sort_target:type_name -> aether.SortTarget + 15, // 4: aether.GetResponse.header:type_name -> aether.ResponseHeader + 16, // 5: aether.GetResponse.kvs:type_name -> aether.KeyValue + 15, // 6: aether.DeleteResponse.header:type_name -> aether.ResponseHeader + 16, // 7: aether.DeleteResponse.prev_kvs:type_name -> aether.KeyValue + 17, // 8: aether.RangeRequest.sort_order:type_name -> aether.SortOrder + 18, // 9: aether.RangeRequest.sort_target:type_name -> aether.SortTarget + 15, // 10: aether.RangeResponse.header:type_name -> aether.ResponseHeader + 16, // 11: aether.RangeResponse.kvs:type_name -> aether.KeyValue + 0, // 12: aether.Compare.result:type_name -> aether.CompareResult + 1, // 13: aether.Compare.target:type_name -> aether.CompareTarget + 2, // 14: aether.RequestOp.put:type_name -> aether.PutRequest + 4, // 15: aether.RequestOp.get:type_name -> aether.GetRequest + 6, // 16: aether.RequestOp.delete:type_name -> aether.DeleteRequest + 8, // 17: aether.RequestOp.range:type_name -> aether.RangeRequest + 13, // 18: aether.RequestOp.txn:type_name -> aether.TxnRequest + 3, // 19: aether.ResponseOp.put:type_name -> aether.PutResponse + 5, // 20: aether.ResponseOp.get:type_name -> aether.GetResponse + 7, // 21: aether.ResponseOp.delete:type_name -> aether.DeleteResponse + 9, // 22: aether.ResponseOp.range:type_name -> aether.RangeResponse + 14, // 23: aether.ResponseOp.txn:type_name -> aether.TxnResponse + 10, // 24: aether.TxnRequest.compare:type_name -> aether.Compare + 11, // 25: aether.TxnRequest.success:type_name -> aether.RequestOp + 11, // 26: aether.TxnRequest.failure:type_name -> aether.RequestOp + 15, // 27: aether.TxnResponse.header:type_name -> aether.ResponseHeader + 12, // 28: aether.TxnResponse.responses:type_name -> aether.ResponseOp + 2, // 29: aether.AetherKV.Put:input_type -> aether.PutRequest + 4, // 30: aether.AetherKV.Get:input_type -> aether.GetRequest + 6, // 31: aether.AetherKV.Delete:input_type -> aether.DeleteRequest + 8, // 32: aether.AetherKV.Range:input_type -> aether.RangeRequest + 13, // 33: aether.AetherKV.Txn:input_type -> aether.TxnRequest + 3, // 34: aether.AetherKV.Put:output_type -> aether.PutResponse + 5, // 35: aether.AetherKV.Get:output_type -> aether.GetResponse + 7, // 36: aether.AetherKV.Delete:output_type -> aether.DeleteResponse + 9, // 37: aether.AetherKV.Range:output_type -> aether.RangeResponse + 14, // 38: aether.AetherKV.Txn:output_type -> aether.TxnResponse + 34, // [34:39] is the sub-list for method output_type + 29, // [29:34] is the sub-list for method input_type + 29, // [29:29] is the sub-list for extension type_name + 29, // [29:29] is the sub-list for extension extendee + 0, // [0:29] is the sub-list for field type_name +} + +func init() { file_kv_proto_init() } +func file_kv_proto_init() { + if File_kv_proto != nil { + return + } + file_common_proto_init() + file_kv_proto_msgTypes[8].OneofWrappers = []any{ + (*Compare_Version)(nil), + (*Compare_CreateRevision)(nil), + (*Compare_ModRevision)(nil), + (*Compare_Value)(nil), + (*Compare_Lease)(nil), + } + file_kv_proto_msgTypes[9].OneofWrappers = []any{ + (*RequestOp_Put)(nil), + (*RequestOp_Get)(nil), + (*RequestOp_Delete)(nil), + (*RequestOp_Range)(nil), + (*RequestOp_Txn)(nil), + } + file_kv_proto_msgTypes[10].OneofWrappers = []any{ + (*ResponseOp_Put)(nil), + (*ResponseOp_Get)(nil), + (*ResponseOp_Delete)(nil), + (*ResponseOp_Range)(nil), + (*ResponseOp_Txn)(nil), + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_kv_proto_rawDesc), len(file_kv_proto_rawDesc)), + NumEnums: 2, + NumMessages: 13, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_kv_proto_goTypes, + DependencyIndexes: file_kv_proto_depIdxs, + EnumInfos: file_kv_proto_enumTypes, + MessageInfos: file_kv_proto_msgTypes, + }.Build() + File_kv_proto = out.File + file_kv_proto_goTypes = nil + file_kv_proto_depIdxs = nil +} diff --git a/sdk/go/aetherpb/kv_grpc.pb.go b/sdk/go/aetherpb/kv_grpc.pb.go new file mode 100644 index 0000000..4404a1a --- /dev/null +++ b/sdk/go/aetherpb/kv_grpc.pb.go @@ -0,0 +1,285 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.5.1 +// - protoc v6.32.0 +// source: kv.proto + +package aetherpb + +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 ( + AetherKV_Put_FullMethodName = "/aether.AetherKV/Put" + AetherKV_Get_FullMethodName = "/aether.AetherKV/Get" + AetherKV_Delete_FullMethodName = "/aether.AetherKV/Delete" + AetherKV_Range_FullMethodName = "/aether.AetherKV/Range" + AetherKV_Txn_FullMethodName = "/aether.AetherKV/Txn" +) + +// AetherKVClient is the client API for AetherKV 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. +// +// AetherKV provides key-value operations. +type AetherKVClient interface { + // Put puts the given key into the store. + Put(ctx context.Context, in *PutRequest, opts ...grpc.CallOption) (*PutResponse, error) + // Get gets the key or a range of keys from the store. + Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (*GetResponse, error) + // Delete deletes the given key or range of keys from the store. + Delete(ctx context.Context, in *DeleteRequest, opts ...grpc.CallOption) (*DeleteResponse, error) + // Range gets the keys in the range [key, range_end). + Range(ctx context.Context, in *RangeRequest, opts ...grpc.CallOption) (*RangeResponse, error) + // Txn processes multiple operations in a single transaction. + Txn(ctx context.Context, in *TxnRequest, opts ...grpc.CallOption) (*TxnResponse, error) +} + +type aetherKVClient struct { + cc grpc.ClientConnInterface +} + +func NewAetherKVClient(cc grpc.ClientConnInterface) AetherKVClient { + return &aetherKVClient{cc} +} + +func (c *aetherKVClient) Put(ctx context.Context, in *PutRequest, opts ...grpc.CallOption) (*PutResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(PutResponse) + err := c.cc.Invoke(ctx, AetherKV_Put_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *aetherKVClient) Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (*GetResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(GetResponse) + err := c.cc.Invoke(ctx, AetherKV_Get_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *aetherKVClient) Delete(ctx context.Context, in *DeleteRequest, opts ...grpc.CallOption) (*DeleteResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(DeleteResponse) + err := c.cc.Invoke(ctx, AetherKV_Delete_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *aetherKVClient) Range(ctx context.Context, in *RangeRequest, opts ...grpc.CallOption) (*RangeResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(RangeResponse) + err := c.cc.Invoke(ctx, AetherKV_Range_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *aetherKVClient) Txn(ctx context.Context, in *TxnRequest, opts ...grpc.CallOption) (*TxnResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(TxnResponse) + err := c.cc.Invoke(ctx, AetherKV_Txn_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +// AetherKVServer is the server API for AetherKV service. +// All implementations should embed UnimplementedAetherKVServer +// for forward compatibility. +// +// AetherKV provides key-value operations. +type AetherKVServer interface { + // Put puts the given key into the store. + Put(context.Context, *PutRequest) (*PutResponse, error) + // Get gets the key or a range of keys from the store. + Get(context.Context, *GetRequest) (*GetResponse, error) + // Delete deletes the given key or range of keys from the store. + Delete(context.Context, *DeleteRequest) (*DeleteResponse, error) + // Range gets the keys in the range [key, range_end). + Range(context.Context, *RangeRequest) (*RangeResponse, error) + // Txn processes multiple operations in a single transaction. + Txn(context.Context, *TxnRequest) (*TxnResponse, error) +} + +// UnimplementedAetherKVServer should 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 UnimplementedAetherKVServer struct{} + +func (UnimplementedAetherKVServer) Put(context.Context, *PutRequest) (*PutResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Put not implemented") +} +func (UnimplementedAetherKVServer) Get(context.Context, *GetRequest) (*GetResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Get not implemented") +} +func (UnimplementedAetherKVServer) Delete(context.Context, *DeleteRequest) (*DeleteResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Delete not implemented") +} +func (UnimplementedAetherKVServer) Range(context.Context, *RangeRequest) (*RangeResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Range not implemented") +} +func (UnimplementedAetherKVServer) Txn(context.Context, *TxnRequest) (*TxnResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Txn not implemented") +} +func (UnimplementedAetherKVServer) testEmbeddedByValue() {} + +// UnsafeAetherKVServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to AetherKVServer will +// result in compilation errors. +type UnsafeAetherKVServer interface { + mustEmbedUnimplementedAetherKVServer() +} + +func RegisterAetherKVServer(s grpc.ServiceRegistrar, srv AetherKVServer) { + // If the following call pancis, it indicates UnimplementedAetherKVServer 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(&AetherKV_ServiceDesc, srv) +} + +func _AetherKV_Put_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(PutRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AetherKVServer).Put(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: AetherKV_Put_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AetherKVServer).Put(ctx, req.(*PutRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _AetherKV_Get_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AetherKVServer).Get(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: AetherKV_Get_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AetherKVServer).Get(ctx, req.(*GetRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _AetherKV_Delete_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeleteRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AetherKVServer).Delete(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: AetherKV_Delete_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AetherKVServer).Delete(ctx, req.(*DeleteRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _AetherKV_Range_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(RangeRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AetherKVServer).Range(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: AetherKV_Range_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AetherKVServer).Range(ctx, req.(*RangeRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _AetherKV_Txn_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(TxnRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AetherKVServer).Txn(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: AetherKV_Txn_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AetherKVServer).Txn(ctx, req.(*TxnRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// AetherKV_ServiceDesc is the grpc.ServiceDesc for AetherKV service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var AetherKV_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "aether.AetherKV", + HandlerType: (*AetherKVServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Put", + Handler: _AetherKV_Put_Handler, + }, + { + MethodName: "Get", + Handler: _AetherKV_Get_Handler, + }, + { + MethodName: "Delete", + Handler: _AetherKV_Delete_Handler, + }, + { + MethodName: "Range", + Handler: _AetherKV_Range_Handler, + }, + { + MethodName: "Txn", + Handler: _AetherKV_Txn_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "kv.proto", +} diff --git a/sdk/go/aetherpb/lease.pb.go b/sdk/go/aetherpb/lease.pb.go new file mode 100644 index 0000000..bc9ee98 --- /dev/null +++ b/sdk/go/aetherpb/lease.pb.go @@ -0,0 +1,699 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.6 +// protoc v6.32.0 +// source: lease.proto + +package aetherpb + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + 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 LeaseGrantRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Ttl int64 `protobuf:"varint,1,opt,name=ttl,proto3" json:"ttl,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *LeaseGrantRequest) Reset() { + *x = LeaseGrantRequest{} + mi := &file_lease_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *LeaseGrantRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LeaseGrantRequest) ProtoMessage() {} + +func (x *LeaseGrantRequest) ProtoReflect() protoreflect.Message { + mi := &file_lease_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 LeaseGrantRequest.ProtoReflect.Descriptor instead. +func (*LeaseGrantRequest) Descriptor() ([]byte, []int) { + return file_lease_proto_rawDescGZIP(), []int{0} +} + +func (x *LeaseGrantRequest) GetTtl() int64 { + if x != nil { + return x.Ttl + } + return 0 +} + +type LeaseGrantResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` + Id int64 `protobuf:"varint,2,opt,name=id,proto3" json:"id,omitempty"` + Ttl int64 `protobuf:"varint,3,opt,name=ttl,proto3" json:"ttl,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *LeaseGrantResponse) Reset() { + *x = LeaseGrantResponse{} + mi := &file_lease_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *LeaseGrantResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LeaseGrantResponse) ProtoMessage() {} + +func (x *LeaseGrantResponse) ProtoReflect() protoreflect.Message { + mi := &file_lease_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 LeaseGrantResponse.ProtoReflect.Descriptor instead. +func (*LeaseGrantResponse) Descriptor() ([]byte, []int) { + return file_lease_proto_rawDescGZIP(), []int{1} +} + +func (x *LeaseGrantResponse) GetHeader() *ResponseHeader { + if x != nil { + return x.Header + } + return nil +} + +func (x *LeaseGrantResponse) GetId() int64 { + if x != nil { + return x.Id + } + return 0 +} + +func (x *LeaseGrantResponse) GetTtl() int64 { + if x != nil { + return x.Ttl + } + return 0 +} + +type LeaseRevokeRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *LeaseRevokeRequest) Reset() { + *x = LeaseRevokeRequest{} + mi := &file_lease_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *LeaseRevokeRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LeaseRevokeRequest) ProtoMessage() {} + +func (x *LeaseRevokeRequest) ProtoReflect() protoreflect.Message { + mi := &file_lease_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 LeaseRevokeRequest.ProtoReflect.Descriptor instead. +func (*LeaseRevokeRequest) Descriptor() ([]byte, []int) { + return file_lease_proto_rawDescGZIP(), []int{2} +} + +func (x *LeaseRevokeRequest) GetId() int64 { + if x != nil { + return x.Id + } + return 0 +} + +type LeaseRevokeResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *LeaseRevokeResponse) Reset() { + *x = LeaseRevokeResponse{} + mi := &file_lease_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *LeaseRevokeResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LeaseRevokeResponse) ProtoMessage() {} + +func (x *LeaseRevokeResponse) ProtoReflect() protoreflect.Message { + mi := &file_lease_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 LeaseRevokeResponse.ProtoReflect.Descriptor instead. +func (*LeaseRevokeResponse) Descriptor() ([]byte, []int) { + return file_lease_proto_rawDescGZIP(), []int{3} +} + +func (x *LeaseRevokeResponse) GetHeader() *ResponseHeader { + if x != nil { + return x.Header + } + return nil +} + +type LeaseKeepAliveRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *LeaseKeepAliveRequest) Reset() { + *x = LeaseKeepAliveRequest{} + mi := &file_lease_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *LeaseKeepAliveRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LeaseKeepAliveRequest) ProtoMessage() {} + +func (x *LeaseKeepAliveRequest) ProtoReflect() protoreflect.Message { + mi := &file_lease_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 LeaseKeepAliveRequest.ProtoReflect.Descriptor instead. +func (*LeaseKeepAliveRequest) Descriptor() ([]byte, []int) { + return file_lease_proto_rawDescGZIP(), []int{4} +} + +func (x *LeaseKeepAliveRequest) GetId() int64 { + if x != nil { + return x.Id + } + return 0 +} + +type LeaseKeepAliveResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` + Id int64 `protobuf:"varint,2,opt,name=id,proto3" json:"id,omitempty"` + Ttl int64 `protobuf:"varint,3,opt,name=ttl,proto3" json:"ttl,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *LeaseKeepAliveResponse) Reset() { + *x = LeaseKeepAliveResponse{} + mi := &file_lease_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *LeaseKeepAliveResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LeaseKeepAliveResponse) ProtoMessage() {} + +func (x *LeaseKeepAliveResponse) ProtoReflect() protoreflect.Message { + mi := &file_lease_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 LeaseKeepAliveResponse.ProtoReflect.Descriptor instead. +func (*LeaseKeepAliveResponse) Descriptor() ([]byte, []int) { + return file_lease_proto_rawDescGZIP(), []int{5} +} + +func (x *LeaseKeepAliveResponse) GetHeader() *ResponseHeader { + if x != nil { + return x.Header + } + return nil +} + +func (x *LeaseKeepAliveResponse) GetId() int64 { + if x != nil { + return x.Id + } + return 0 +} + +func (x *LeaseKeepAliveResponse) GetTtl() int64 { + if x != nil { + return x.Ttl + } + return 0 +} + +type LeaseTimeToLiveRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + Keys bool `protobuf:"varint,2,opt,name=keys,proto3" json:"keys,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *LeaseTimeToLiveRequest) Reset() { + *x = LeaseTimeToLiveRequest{} + mi := &file_lease_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *LeaseTimeToLiveRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LeaseTimeToLiveRequest) ProtoMessage() {} + +func (x *LeaseTimeToLiveRequest) ProtoReflect() protoreflect.Message { + mi := &file_lease_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 LeaseTimeToLiveRequest.ProtoReflect.Descriptor instead. +func (*LeaseTimeToLiveRequest) Descriptor() ([]byte, []int) { + return file_lease_proto_rawDescGZIP(), []int{6} +} + +func (x *LeaseTimeToLiveRequest) GetId() int64 { + if x != nil { + return x.Id + } + return 0 +} + +func (x *LeaseTimeToLiveRequest) GetKeys() bool { + if x != nil { + return x.Keys + } + return false +} + +type LeaseTimeToLiveResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` + Id int64 `protobuf:"varint,2,opt,name=id,proto3" json:"id,omitempty"` + Ttl int64 `protobuf:"varint,3,opt,name=ttl,proto3" json:"ttl,omitempty"` + GrantedTtl int64 `protobuf:"varint,4,opt,name=granted_ttl,json=grantedTtl,proto3" json:"granted_ttl,omitempty"` + Keys [][]byte `protobuf:"bytes,5,rep,name=keys,proto3" json:"keys,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *LeaseTimeToLiveResponse) Reset() { + *x = LeaseTimeToLiveResponse{} + mi := &file_lease_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *LeaseTimeToLiveResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LeaseTimeToLiveResponse) ProtoMessage() {} + +func (x *LeaseTimeToLiveResponse) ProtoReflect() protoreflect.Message { + mi := &file_lease_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 LeaseTimeToLiveResponse.ProtoReflect.Descriptor instead. +func (*LeaseTimeToLiveResponse) Descriptor() ([]byte, []int) { + return file_lease_proto_rawDescGZIP(), []int{7} +} + +func (x *LeaseTimeToLiveResponse) GetHeader() *ResponseHeader { + if x != nil { + return x.Header + } + return nil +} + +func (x *LeaseTimeToLiveResponse) GetId() int64 { + if x != nil { + return x.Id + } + return 0 +} + +func (x *LeaseTimeToLiveResponse) GetTtl() int64 { + if x != nil { + return x.Ttl + } + return 0 +} + +func (x *LeaseTimeToLiveResponse) GetGrantedTtl() int64 { + if x != nil { + return x.GrantedTtl + } + return 0 +} + +func (x *LeaseTimeToLiveResponse) GetKeys() [][]byte { + if x != nil { + return x.Keys + } + return nil +} + +type LeaseLeasesRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *LeaseLeasesRequest) Reset() { + *x = LeaseLeasesRequest{} + mi := &file_lease_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *LeaseLeasesRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LeaseLeasesRequest) ProtoMessage() {} + +func (x *LeaseLeasesRequest) ProtoReflect() protoreflect.Message { + mi := &file_lease_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 LeaseLeasesRequest.ProtoReflect.Descriptor instead. +func (*LeaseLeasesRequest) Descriptor() ([]byte, []int) { + return file_lease_proto_rawDescGZIP(), []int{8} +} + +type LeaseLeasesResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` + Leases []*LeaseStatus `protobuf:"bytes,2,rep,name=leases,proto3" json:"leases,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *LeaseLeasesResponse) Reset() { + *x = LeaseLeasesResponse{} + mi := &file_lease_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *LeaseLeasesResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LeaseLeasesResponse) ProtoMessage() {} + +func (x *LeaseLeasesResponse) ProtoReflect() protoreflect.Message { + mi := &file_lease_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 LeaseLeasesResponse.ProtoReflect.Descriptor instead. +func (*LeaseLeasesResponse) Descriptor() ([]byte, []int) { + return file_lease_proto_rawDescGZIP(), []int{9} +} + +func (x *LeaseLeasesResponse) GetHeader() *ResponseHeader { + if x != nil { + return x.Header + } + return nil +} + +func (x *LeaseLeasesResponse) GetLeases() []*LeaseStatus { + if x != nil { + return x.Leases + } + return nil +} + +type LeaseStatus struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *LeaseStatus) Reset() { + *x = LeaseStatus{} + mi := &file_lease_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *LeaseStatus) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LeaseStatus) ProtoMessage() {} + +func (x *LeaseStatus) ProtoReflect() protoreflect.Message { + mi := &file_lease_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 LeaseStatus.ProtoReflect.Descriptor instead. +func (*LeaseStatus) Descriptor() ([]byte, []int) { + return file_lease_proto_rawDescGZIP(), []int{10} +} + +func (x *LeaseStatus) GetId() int64 { + if x != nil { + return x.Id + } + return 0 +} + +var File_lease_proto protoreflect.FileDescriptor + +const file_lease_proto_rawDesc = "" + + "\n" + + "\vlease.proto\x12\x06aether\x1a\fcommon.proto\"+\n" + + "\x11LeaseGrantRequest\x12\x10\n" + + "\x03ttl\x18\x01 \x01(\x03R\x03ttlJ\x04\b\x02\x10\x03\"f\n" + + "\x12LeaseGrantResponse\x12.\n" + + "\x06header\x18\x01 \x01(\v2\x16.aether.ResponseHeaderR\x06header\x12\x0e\n" + + "\x02id\x18\x02 \x01(\x03R\x02id\x12\x10\n" + + "\x03ttl\x18\x03 \x01(\x03R\x03ttl\"$\n" + + "\x12LeaseRevokeRequest\x12\x0e\n" + + "\x02id\x18\x01 \x01(\x03R\x02id\"E\n" + + "\x13LeaseRevokeResponse\x12.\n" + + "\x06header\x18\x01 \x01(\v2\x16.aether.ResponseHeaderR\x06header\"'\n" + + "\x15LeaseKeepAliveRequest\x12\x0e\n" + + "\x02id\x18\x01 \x01(\x03R\x02id\"j\n" + + "\x16LeaseKeepAliveResponse\x12.\n" + + "\x06header\x18\x01 \x01(\v2\x16.aether.ResponseHeaderR\x06header\x12\x0e\n" + + "\x02id\x18\x02 \x01(\x03R\x02id\x12\x10\n" + + "\x03ttl\x18\x03 \x01(\x03R\x03ttl\"<\n" + + "\x16LeaseTimeToLiveRequest\x12\x0e\n" + + "\x02id\x18\x01 \x01(\x03R\x02id\x12\x12\n" + + "\x04keys\x18\x02 \x01(\bR\x04keys\"\xa0\x01\n" + + "\x17LeaseTimeToLiveResponse\x12.\n" + + "\x06header\x18\x01 \x01(\v2\x16.aether.ResponseHeaderR\x06header\x12\x0e\n" + + "\x02id\x18\x02 \x01(\x03R\x02id\x12\x10\n" + + "\x03ttl\x18\x03 \x01(\x03R\x03ttl\x12\x1f\n" + + "\vgranted_ttl\x18\x04 \x01(\x03R\n" + + "grantedTtl\x12\x12\n" + + "\x04keys\x18\x05 \x03(\fR\x04keys\"\x14\n" + + "\x12LeaseLeasesRequest\"r\n" + + "\x13LeaseLeasesResponse\x12.\n" + + "\x06header\x18\x01 \x01(\v2\x16.aether.ResponseHeaderR\x06header\x12+\n" + + "\x06leases\x18\x02 \x03(\v2\x13.aether.LeaseStatusR\x06leases\"\x1d\n" + + "\vLeaseStatus\x12\x0e\n" + + "\x02id\x18\x01 \x01(\x03R\x02id2\x8b\x03\n" + + "\vAetherLease\x12C\n" + + "\n" + + "LeaseGrant\x12\x19.aether.LeaseGrantRequest\x1a\x1a.aether.LeaseGrantResponse\x12F\n" + + "\vLeaseRevoke\x12\x1a.aether.LeaseRevokeRequest\x1a\x1b.aether.LeaseRevokeResponse\x12S\n" + + "\x0eLeaseKeepAlive\x12\x1d.aether.LeaseKeepAliveRequest\x1a\x1e.aether.LeaseKeepAliveResponse(\x010\x01\x12R\n" + + "\x0fLeaseTimeToLive\x12\x1e.aether.LeaseTimeToLiveRequest\x1a\x1f.aether.LeaseTimeToLiveResponse\x12F\n" + + "\vLeaseLeases\x12\x1a.aether.LeaseLeasesRequest\x1a\x1b.aether.LeaseLeasesResponseB-Z+github.com/aether-io/aether/sdk/go/aetherpbb\x06proto3" + +var ( + file_lease_proto_rawDescOnce sync.Once + file_lease_proto_rawDescData []byte +) + +func file_lease_proto_rawDescGZIP() []byte { + file_lease_proto_rawDescOnce.Do(func() { + file_lease_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_lease_proto_rawDesc), len(file_lease_proto_rawDesc))) + }) + return file_lease_proto_rawDescData +} + +var file_lease_proto_msgTypes = make([]protoimpl.MessageInfo, 11) +var file_lease_proto_goTypes = []any{ + (*LeaseGrantRequest)(nil), // 0: aether.LeaseGrantRequest + (*LeaseGrantResponse)(nil), // 1: aether.LeaseGrantResponse + (*LeaseRevokeRequest)(nil), // 2: aether.LeaseRevokeRequest + (*LeaseRevokeResponse)(nil), // 3: aether.LeaseRevokeResponse + (*LeaseKeepAliveRequest)(nil), // 4: aether.LeaseKeepAliveRequest + (*LeaseKeepAliveResponse)(nil), // 5: aether.LeaseKeepAliveResponse + (*LeaseTimeToLiveRequest)(nil), // 6: aether.LeaseTimeToLiveRequest + (*LeaseTimeToLiveResponse)(nil), // 7: aether.LeaseTimeToLiveResponse + (*LeaseLeasesRequest)(nil), // 8: aether.LeaseLeasesRequest + (*LeaseLeasesResponse)(nil), // 9: aether.LeaseLeasesResponse + (*LeaseStatus)(nil), // 10: aether.LeaseStatus + (*ResponseHeader)(nil), // 11: aether.ResponseHeader +} +var file_lease_proto_depIdxs = []int32{ + 11, // 0: aether.LeaseGrantResponse.header:type_name -> aether.ResponseHeader + 11, // 1: aether.LeaseRevokeResponse.header:type_name -> aether.ResponseHeader + 11, // 2: aether.LeaseKeepAliveResponse.header:type_name -> aether.ResponseHeader + 11, // 3: aether.LeaseTimeToLiveResponse.header:type_name -> aether.ResponseHeader + 11, // 4: aether.LeaseLeasesResponse.header:type_name -> aether.ResponseHeader + 10, // 5: aether.LeaseLeasesResponse.leases:type_name -> aether.LeaseStatus + 0, // 6: aether.AetherLease.LeaseGrant:input_type -> aether.LeaseGrantRequest + 2, // 7: aether.AetherLease.LeaseRevoke:input_type -> aether.LeaseRevokeRequest + 4, // 8: aether.AetherLease.LeaseKeepAlive:input_type -> aether.LeaseKeepAliveRequest + 6, // 9: aether.AetherLease.LeaseTimeToLive:input_type -> aether.LeaseTimeToLiveRequest + 8, // 10: aether.AetherLease.LeaseLeases:input_type -> aether.LeaseLeasesRequest + 1, // 11: aether.AetherLease.LeaseGrant:output_type -> aether.LeaseGrantResponse + 3, // 12: aether.AetherLease.LeaseRevoke:output_type -> aether.LeaseRevokeResponse + 5, // 13: aether.AetherLease.LeaseKeepAlive:output_type -> aether.LeaseKeepAliveResponse + 7, // 14: aether.AetherLease.LeaseTimeToLive:output_type -> aether.LeaseTimeToLiveResponse + 9, // 15: aether.AetherLease.LeaseLeases:output_type -> aether.LeaseLeasesResponse + 11, // [11:16] is the sub-list for method output_type + 6, // [6:11] is the sub-list for method input_type + 6, // [6:6] is the sub-list for extension type_name + 6, // [6:6] is the sub-list for extension extendee + 0, // [0:6] is the sub-list for field type_name +} + +func init() { file_lease_proto_init() } +func file_lease_proto_init() { + if File_lease_proto != nil { + return + } + file_common_proto_init() + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_lease_proto_rawDesc), len(file_lease_proto_rawDesc)), + NumEnums: 0, + NumMessages: 11, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_lease_proto_goTypes, + DependencyIndexes: file_lease_proto_depIdxs, + MessageInfos: file_lease_proto_msgTypes, + }.Build() + File_lease_proto = out.File + file_lease_proto_goTypes = nil + file_lease_proto_depIdxs = nil +} diff --git a/sdk/go/aetherpb/lease_grpc.pb.go b/sdk/go/aetherpb/lease_grpc.pb.go new file mode 100644 index 0000000..58dd2f5 --- /dev/null +++ b/sdk/go/aetherpb/lease_grpc.pb.go @@ -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.0 +// source: lease.proto + +package aetherpb + +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 ( + AetherLease_LeaseGrant_FullMethodName = "/aether.AetherLease/LeaseGrant" + AetherLease_LeaseRevoke_FullMethodName = "/aether.AetherLease/LeaseRevoke" + AetherLease_LeaseKeepAlive_FullMethodName = "/aether.AetherLease/LeaseKeepAlive" + AetherLease_LeaseTimeToLive_FullMethodName = "/aether.AetherLease/LeaseTimeToLive" + AetherLease_LeaseLeases_FullMethodName = "/aether.AetherLease/LeaseLeases" +) + +// AetherLeaseClient is the client API for AetherLease 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. +// +// AetherLease provides lease management operations. +type AetherLeaseClient interface { + // LeaseGrant creates a new lease with a TTL. + LeaseGrant(ctx context.Context, in *LeaseGrantRequest, opts ...grpc.CallOption) (*LeaseGrantResponse, error) + // LeaseRevoke revokes a lease and deletes all attached keys. + LeaseRevoke(ctx context.Context, in *LeaseRevokeRequest, opts ...grpc.CallOption) (*LeaseRevokeResponse, error) + // LeaseKeepAlive keeps a lease alive by resetting its TTL. + LeaseKeepAlive(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[LeaseKeepAliveRequest, LeaseKeepAliveResponse], error) + // LeaseTimeToLive returns the remaining TTL of a lease. + LeaseTimeToLive(ctx context.Context, in *LeaseTimeToLiveRequest, opts ...grpc.CallOption) (*LeaseTimeToLiveResponse, error) + // LeaseLeases lists all active leases. + LeaseLeases(ctx context.Context, in *LeaseLeasesRequest, opts ...grpc.CallOption) (*LeaseLeasesResponse, error) +} + +type aetherLeaseClient struct { + cc grpc.ClientConnInterface +} + +func NewAetherLeaseClient(cc grpc.ClientConnInterface) AetherLeaseClient { + return &aetherLeaseClient{cc} +} + +func (c *aetherLeaseClient) LeaseGrant(ctx context.Context, in *LeaseGrantRequest, opts ...grpc.CallOption) (*LeaseGrantResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(LeaseGrantResponse) + err := c.cc.Invoke(ctx, AetherLease_LeaseGrant_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *aetherLeaseClient) LeaseRevoke(ctx context.Context, in *LeaseRevokeRequest, opts ...grpc.CallOption) (*LeaseRevokeResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(LeaseRevokeResponse) + err := c.cc.Invoke(ctx, AetherLease_LeaseRevoke_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *aetherLeaseClient) LeaseKeepAlive(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[LeaseKeepAliveRequest, LeaseKeepAliveResponse], error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + stream, err := c.cc.NewStream(ctx, &AetherLease_ServiceDesc.Streams[0], AetherLease_LeaseKeepAlive_FullMethodName, cOpts...) + if err != nil { + return nil, err + } + x := &grpc.GenericClientStream[LeaseKeepAliveRequest, LeaseKeepAliveResponse]{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 AetherLease_LeaseKeepAliveClient = grpc.BidiStreamingClient[LeaseKeepAliveRequest, LeaseKeepAliveResponse] + +func (c *aetherLeaseClient) LeaseTimeToLive(ctx context.Context, in *LeaseTimeToLiveRequest, opts ...grpc.CallOption) (*LeaseTimeToLiveResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(LeaseTimeToLiveResponse) + err := c.cc.Invoke(ctx, AetherLease_LeaseTimeToLive_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *aetherLeaseClient) LeaseLeases(ctx context.Context, in *LeaseLeasesRequest, opts ...grpc.CallOption) (*LeaseLeasesResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(LeaseLeasesResponse) + err := c.cc.Invoke(ctx, AetherLease_LeaseLeases_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +// AetherLeaseServer is the server API for AetherLease service. +// All implementations should embed UnimplementedAetherLeaseServer +// for forward compatibility. +// +// AetherLease provides lease management operations. +type AetherLeaseServer interface { + // LeaseGrant creates a new lease with a TTL. + LeaseGrant(context.Context, *LeaseGrantRequest) (*LeaseGrantResponse, error) + // LeaseRevoke revokes a lease and deletes all attached keys. + LeaseRevoke(context.Context, *LeaseRevokeRequest) (*LeaseRevokeResponse, error) + // LeaseKeepAlive keeps a lease alive by resetting its TTL. + LeaseKeepAlive(grpc.BidiStreamingServer[LeaseKeepAliveRequest, LeaseKeepAliveResponse]) error + // LeaseTimeToLive returns the remaining TTL of a lease. + LeaseTimeToLive(context.Context, *LeaseTimeToLiveRequest) (*LeaseTimeToLiveResponse, error) + // LeaseLeases lists all active leases. + LeaseLeases(context.Context, *LeaseLeasesRequest) (*LeaseLeasesResponse, error) +} + +// UnimplementedAetherLeaseServer should 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 UnimplementedAetherLeaseServer struct{} + +func (UnimplementedAetherLeaseServer) LeaseGrant(context.Context, *LeaseGrantRequest) (*LeaseGrantResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method LeaseGrant not implemented") +} +func (UnimplementedAetherLeaseServer) LeaseRevoke(context.Context, *LeaseRevokeRequest) (*LeaseRevokeResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method LeaseRevoke not implemented") +} +func (UnimplementedAetherLeaseServer) LeaseKeepAlive(grpc.BidiStreamingServer[LeaseKeepAliveRequest, LeaseKeepAliveResponse]) error { + return status.Errorf(codes.Unimplemented, "method LeaseKeepAlive not implemented") +} +func (UnimplementedAetherLeaseServer) LeaseTimeToLive(context.Context, *LeaseTimeToLiveRequest) (*LeaseTimeToLiveResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method LeaseTimeToLive not implemented") +} +func (UnimplementedAetherLeaseServer) LeaseLeases(context.Context, *LeaseLeasesRequest) (*LeaseLeasesResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method LeaseLeases not implemented") +} +func (UnimplementedAetherLeaseServer) testEmbeddedByValue() {} + +// UnsafeAetherLeaseServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to AetherLeaseServer will +// result in compilation errors. +type UnsafeAetherLeaseServer interface { + mustEmbedUnimplementedAetherLeaseServer() +} + +func RegisterAetherLeaseServer(s grpc.ServiceRegistrar, srv AetherLeaseServer) { + // If the following call pancis, it indicates UnimplementedAetherLeaseServer 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(&AetherLease_ServiceDesc, srv) +} + +func _AetherLease_LeaseGrant_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(LeaseGrantRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AetherLeaseServer).LeaseGrant(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: AetherLease_LeaseGrant_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AetherLeaseServer).LeaseGrant(ctx, req.(*LeaseGrantRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _AetherLease_LeaseRevoke_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(LeaseRevokeRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AetherLeaseServer).LeaseRevoke(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: AetherLease_LeaseRevoke_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AetherLeaseServer).LeaseRevoke(ctx, req.(*LeaseRevokeRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _AetherLease_LeaseKeepAlive_Handler(srv interface{}, stream grpc.ServerStream) error { + return srv.(AetherLeaseServer).LeaseKeepAlive(&grpc.GenericServerStream[LeaseKeepAliveRequest, LeaseKeepAliveResponse]{ServerStream: stream}) +} + +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type AetherLease_LeaseKeepAliveServer = grpc.BidiStreamingServer[LeaseKeepAliveRequest, LeaseKeepAliveResponse] + +func _AetherLease_LeaseTimeToLive_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(LeaseTimeToLiveRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AetherLeaseServer).LeaseTimeToLive(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: AetherLease_LeaseTimeToLive_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AetherLeaseServer).LeaseTimeToLive(ctx, req.(*LeaseTimeToLiveRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _AetherLease_LeaseLeases_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(LeaseLeasesRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AetherLeaseServer).LeaseLeases(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: AetherLease_LeaseLeases_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AetherLeaseServer).LeaseLeases(ctx, req.(*LeaseLeasesRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// AetherLease_ServiceDesc is the grpc.ServiceDesc for AetherLease service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var AetherLease_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "aether.AetherLease", + HandlerType: (*AetherLeaseServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "LeaseGrant", + Handler: _AetherLease_LeaseGrant_Handler, + }, + { + MethodName: "LeaseRevoke", + Handler: _AetherLease_LeaseRevoke_Handler, + }, + { + MethodName: "LeaseTimeToLive", + Handler: _AetherLease_LeaseTimeToLive_Handler, + }, + { + MethodName: "LeaseLeases", + Handler: _AetherLease_LeaseLeases_Handler, + }, + }, + Streams: []grpc.StreamDesc{ + { + StreamName: "LeaseKeepAlive", + Handler: _AetherLease_LeaseKeepAlive_Handler, + ServerStreams: true, + ClientStreams: true, + }, + }, + Metadata: "lease.proto", +} diff --git a/sdk/go/aetherpb/lock.pb.go b/sdk/go/aetherpb/lock.pb.go new file mode 100644 index 0000000..560561a --- /dev/null +++ b/sdk/go/aetherpb/lock.pb.go @@ -0,0 +1,420 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.6 +// protoc v6.32.0 +// source: lock.proto + +package aetherpb + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + 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 LockRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // name is the name of the lock to acquire. + Name []byte `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // lease_id is the lease to associate with the lock. + // If 0, the lock will not be associated with a lease + // and must be explicitly unlocked. + LeaseId int64 `protobuf:"varint,2,opt,name=lease_id,json=leaseId,proto3" json:"lease_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *LockRequest) Reset() { + *x = LockRequest{} + mi := &file_lock_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *LockRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LockRequest) ProtoMessage() {} + +func (x *LockRequest) ProtoReflect() protoreflect.Message { + mi := &file_lock_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 LockRequest.ProtoReflect.Descriptor instead. +func (*LockRequest) Descriptor() ([]byte, []int) { + return file_lock_proto_rawDescGZIP(), []int{0} +} + +func (x *LockRequest) GetName() []byte { + if x != nil { + return x.Name + } + return nil +} + +func (x *LockRequest) GetLeaseId() int64 { + if x != nil { + return x.LeaseId + } + return 0 +} + +type LockResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` + // key is the key that was created for the lock. + // This can be used to unlock or query the lock. + Key []byte `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *LockResponse) Reset() { + *x = LockResponse{} + mi := &file_lock_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *LockResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LockResponse) ProtoMessage() {} + +func (x *LockResponse) ProtoReflect() protoreflect.Message { + mi := &file_lock_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 LockResponse.ProtoReflect.Descriptor instead. +func (*LockResponse) Descriptor() ([]byte, []int) { + return file_lock_proto_rawDescGZIP(), []int{1} +} + +func (x *LockResponse) GetHeader() *ResponseHeader { + if x != nil { + return x.Header + } + return nil +} + +func (x *LockResponse) GetKey() []byte { + if x != nil { + return x.Key + } + return nil +} + +type UnlockRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // key is the key returned by Lock. + Key []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *UnlockRequest) Reset() { + *x = UnlockRequest{} + mi := &file_lock_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *UnlockRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UnlockRequest) ProtoMessage() {} + +func (x *UnlockRequest) ProtoReflect() protoreflect.Message { + mi := &file_lock_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 UnlockRequest.ProtoReflect.Descriptor instead. +func (*UnlockRequest) Descriptor() ([]byte, []int) { + return file_lock_proto_rawDescGZIP(), []int{2} +} + +func (x *UnlockRequest) GetKey() []byte { + if x != nil { + return x.Key + } + return nil +} + +type UnlockResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *UnlockResponse) Reset() { + *x = UnlockResponse{} + mi := &file_lock_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *UnlockResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UnlockResponse) ProtoMessage() {} + +func (x *UnlockResponse) ProtoReflect() protoreflect.Message { + mi := &file_lock_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 UnlockResponse.ProtoReflect.Descriptor instead. +func (*UnlockResponse) Descriptor() ([]byte, []int) { + return file_lock_proto_rawDescGZIP(), []int{3} +} + +func (x *UnlockResponse) GetHeader() *ResponseHeader { + if x != nil { + return x.Header + } + return nil +} + +type LockQueryRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // name is the name of the lock to query. + Name []byte `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *LockQueryRequest) Reset() { + *x = LockQueryRequest{} + mi := &file_lock_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *LockQueryRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LockQueryRequest) ProtoMessage() {} + +func (x *LockQueryRequest) ProtoReflect() protoreflect.Message { + mi := &file_lock_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 LockQueryRequest.ProtoReflect.Descriptor instead. +func (*LockQueryRequest) Descriptor() ([]byte, []int) { + return file_lock_proto_rawDescGZIP(), []int{4} +} + +func (x *LockQueryRequest) GetName() []byte { + if x != nil { + return x.Name + } + return nil +} + +type LockQueryResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` + // owner is the key that currently holds the lock, empty if unlocked. + Owner []byte `protobuf:"bytes,2,opt,name=owner,proto3" json:"owner,omitempty"` + // lease_id is the lease associated with the lock, 0 if none. + LeaseId int64 `protobuf:"varint,3,opt,name=lease_id,json=leaseId,proto3" json:"lease_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *LockQueryResponse) Reset() { + *x = LockQueryResponse{} + mi := &file_lock_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *LockQueryResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LockQueryResponse) ProtoMessage() {} + +func (x *LockQueryResponse) ProtoReflect() protoreflect.Message { + mi := &file_lock_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 LockQueryResponse.ProtoReflect.Descriptor instead. +func (*LockQueryResponse) Descriptor() ([]byte, []int) { + return file_lock_proto_rawDescGZIP(), []int{5} +} + +func (x *LockQueryResponse) GetHeader() *ResponseHeader { + if x != nil { + return x.Header + } + return nil +} + +func (x *LockQueryResponse) GetOwner() []byte { + if x != nil { + return x.Owner + } + return nil +} + +func (x *LockQueryResponse) GetLeaseId() int64 { + if x != nil { + return x.LeaseId + } + return 0 +} + +var File_lock_proto protoreflect.FileDescriptor + +const file_lock_proto_rawDesc = "" + + "\n" + + "\n" + + "lock.proto\x12\x06aether\x1a\fcommon.proto\"<\n" + + "\vLockRequest\x12\x12\n" + + "\x04name\x18\x01 \x01(\fR\x04name\x12\x19\n" + + "\blease_id\x18\x02 \x01(\x03R\aleaseId\"P\n" + + "\fLockResponse\x12.\n" + + "\x06header\x18\x01 \x01(\v2\x16.aether.ResponseHeaderR\x06header\x12\x10\n" + + "\x03key\x18\x02 \x01(\fR\x03key\"!\n" + + "\rUnlockRequest\x12\x10\n" + + "\x03key\x18\x01 \x01(\fR\x03key\"@\n" + + "\x0eUnlockResponse\x12.\n" + + "\x06header\x18\x01 \x01(\v2\x16.aether.ResponseHeaderR\x06header\"&\n" + + "\x10LockQueryRequest\x12\x12\n" + + "\x04name\x18\x01 \x01(\fR\x04name\"t\n" + + "\x11LockQueryResponse\x12.\n" + + "\x06header\x18\x01 \x01(\v2\x16.aether.ResponseHeaderR\x06header\x12\x14\n" + + "\x05owner\x18\x02 \x01(\fR\x05owner\x12\x19\n" + + "\blease_id\x18\x03 \x01(\x03R\aleaseId2\xba\x01\n" + + "\n" + + "AetherLock\x121\n" + + "\x04Lock\x12\x13.aether.LockRequest\x1a\x14.aether.LockResponse\x127\n" + + "\x06Unlock\x12\x15.aether.UnlockRequest\x1a\x16.aether.UnlockResponse\x12@\n" + + "\tLockQuery\x12\x18.aether.LockQueryRequest\x1a\x19.aether.LockQueryResponseB-Z+github.com/aether-io/aether/sdk/go/aetherpbb\x06proto3" + +var ( + file_lock_proto_rawDescOnce sync.Once + file_lock_proto_rawDescData []byte +) + +func file_lock_proto_rawDescGZIP() []byte { + file_lock_proto_rawDescOnce.Do(func() { + file_lock_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_lock_proto_rawDesc), len(file_lock_proto_rawDesc))) + }) + return file_lock_proto_rawDescData +} + +var file_lock_proto_msgTypes = make([]protoimpl.MessageInfo, 6) +var file_lock_proto_goTypes = []any{ + (*LockRequest)(nil), // 0: aether.LockRequest + (*LockResponse)(nil), // 1: aether.LockResponse + (*UnlockRequest)(nil), // 2: aether.UnlockRequest + (*UnlockResponse)(nil), // 3: aether.UnlockResponse + (*LockQueryRequest)(nil), // 4: aether.LockQueryRequest + (*LockQueryResponse)(nil), // 5: aether.LockQueryResponse + (*ResponseHeader)(nil), // 6: aether.ResponseHeader +} +var file_lock_proto_depIdxs = []int32{ + 6, // 0: aether.LockResponse.header:type_name -> aether.ResponseHeader + 6, // 1: aether.UnlockResponse.header:type_name -> aether.ResponseHeader + 6, // 2: aether.LockQueryResponse.header:type_name -> aether.ResponseHeader + 0, // 3: aether.AetherLock.Lock:input_type -> aether.LockRequest + 2, // 4: aether.AetherLock.Unlock:input_type -> aether.UnlockRequest + 4, // 5: aether.AetherLock.LockQuery:input_type -> aether.LockQueryRequest + 1, // 6: aether.AetherLock.Lock:output_type -> aether.LockResponse + 3, // 7: aether.AetherLock.Unlock:output_type -> aether.UnlockResponse + 5, // 8: aether.AetherLock.LockQuery:output_type -> aether.LockQueryResponse + 6, // [6:9] is the sub-list for method output_type + 3, // [3:6] is the sub-list for method input_type + 3, // [3:3] is the sub-list for extension type_name + 3, // [3:3] is the sub-list for extension extendee + 0, // [0:3] is the sub-list for field type_name +} + +func init() { file_lock_proto_init() } +func file_lock_proto_init() { + if File_lock_proto != nil { + return + } + file_common_proto_init() + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_lock_proto_rawDesc), len(file_lock_proto_rawDesc)), + NumEnums: 0, + NumMessages: 6, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_lock_proto_goTypes, + DependencyIndexes: file_lock_proto_depIdxs, + MessageInfos: file_lock_proto_msgTypes, + }.Build() + File_lock_proto = out.File + file_lock_proto_goTypes = nil + file_lock_proto_depIdxs = nil +} diff --git a/sdk/go/aetherpb/lock_grpc.pb.go b/sdk/go/aetherpb/lock_grpc.pb.go new file mode 100644 index 0000000..478be74 --- /dev/null +++ b/sdk/go/aetherpb/lock_grpc.pb.go @@ -0,0 +1,215 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.5.1 +// - protoc v6.32.0 +// source: lock.proto + +package aetherpb + +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 ( + AetherLock_Lock_FullMethodName = "/aether.AetherLock/Lock" + AetherLock_Unlock_FullMethodName = "/aether.AetherLock/Unlock" + AetherLock_LockQuery_FullMethodName = "/aether.AetherLock/LockQuery" +) + +// AetherLockClient is the client API for AetherLock 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. +// +// AetherLock provides distributed lock operations. +// Locks are implemented using leases: a lock creates a key with the given +// lease, ensuring automatic release when the lease expires. +type AetherLockClient interface { + // Lock acquires a distributed lock with the given name. + // The lock is associated with the provided lease_id and will be + // automatically released when the lease expires. + // Returns a lock header with the key that was locked. + Lock(ctx context.Context, in *LockRequest, opts ...grpc.CallOption) (*LockResponse, error) + // Unlock releases a distributed lock. + Unlock(ctx context.Context, in *UnlockRequest, opts ...grpc.CallOption) (*UnlockResponse, error) + // LockQuery returns information about a lock. + LockQuery(ctx context.Context, in *LockQueryRequest, opts ...grpc.CallOption) (*LockQueryResponse, error) +} + +type aetherLockClient struct { + cc grpc.ClientConnInterface +} + +func NewAetherLockClient(cc grpc.ClientConnInterface) AetherLockClient { + return &aetherLockClient{cc} +} + +func (c *aetherLockClient) Lock(ctx context.Context, in *LockRequest, opts ...grpc.CallOption) (*LockResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(LockResponse) + err := c.cc.Invoke(ctx, AetherLock_Lock_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *aetherLockClient) Unlock(ctx context.Context, in *UnlockRequest, opts ...grpc.CallOption) (*UnlockResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(UnlockResponse) + err := c.cc.Invoke(ctx, AetherLock_Unlock_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *aetherLockClient) LockQuery(ctx context.Context, in *LockQueryRequest, opts ...grpc.CallOption) (*LockQueryResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(LockQueryResponse) + err := c.cc.Invoke(ctx, AetherLock_LockQuery_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +// AetherLockServer is the server API for AetherLock service. +// All implementations should embed UnimplementedAetherLockServer +// for forward compatibility. +// +// AetherLock provides distributed lock operations. +// Locks are implemented using leases: a lock creates a key with the given +// lease, ensuring automatic release when the lease expires. +type AetherLockServer interface { + // Lock acquires a distributed lock with the given name. + // The lock is associated with the provided lease_id and will be + // automatically released when the lease expires. + // Returns a lock header with the key that was locked. + Lock(context.Context, *LockRequest) (*LockResponse, error) + // Unlock releases a distributed lock. + Unlock(context.Context, *UnlockRequest) (*UnlockResponse, error) + // LockQuery returns information about a lock. + LockQuery(context.Context, *LockQueryRequest) (*LockQueryResponse, error) +} + +// UnimplementedAetherLockServer should 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 UnimplementedAetherLockServer struct{} + +func (UnimplementedAetherLockServer) Lock(context.Context, *LockRequest) (*LockResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Lock not implemented") +} +func (UnimplementedAetherLockServer) Unlock(context.Context, *UnlockRequest) (*UnlockResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Unlock not implemented") +} +func (UnimplementedAetherLockServer) LockQuery(context.Context, *LockQueryRequest) (*LockQueryResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method LockQuery not implemented") +} +func (UnimplementedAetherLockServer) testEmbeddedByValue() {} + +// UnsafeAetherLockServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to AetherLockServer will +// result in compilation errors. +type UnsafeAetherLockServer interface { + mustEmbedUnimplementedAetherLockServer() +} + +func RegisterAetherLockServer(s grpc.ServiceRegistrar, srv AetherLockServer) { + // If the following call pancis, it indicates UnimplementedAetherLockServer 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(&AetherLock_ServiceDesc, srv) +} + +func _AetherLock_Lock_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(LockRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AetherLockServer).Lock(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: AetherLock_Lock_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AetherLockServer).Lock(ctx, req.(*LockRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _AetherLock_Unlock_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UnlockRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AetherLockServer).Unlock(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: AetherLock_Unlock_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AetherLockServer).Unlock(ctx, req.(*UnlockRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _AetherLock_LockQuery_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(LockQueryRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AetherLockServer).LockQuery(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: AetherLock_LockQuery_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AetherLockServer).LockQuery(ctx, req.(*LockQueryRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// AetherLock_ServiceDesc is the grpc.ServiceDesc for AetherLock service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var AetherLock_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "aether.AetherLock", + HandlerType: (*AetherLockServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Lock", + Handler: _AetherLock_Lock_Handler, + }, + { + MethodName: "Unlock", + Handler: _AetherLock_Unlock_Handler, + }, + { + MethodName: "LockQuery", + Handler: _AetherLock_LockQuery_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "lock.proto", +} diff --git a/sdk/go/aetherpb/maintenance.pb.go b/sdk/go/aetherpb/maintenance.pb.go new file mode 100644 index 0000000..05016fa --- /dev/null +++ b/sdk/go/aetherpb/maintenance.pb.go @@ -0,0 +1,644 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.6 +// protoc v6.32.0 +// source: maintenance.proto + +package aetherpb + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + 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) +) + +// AlarmType identifies the type of alarm. +type AlarmType int32 + +const ( + AlarmType_ALARM_TYPE_NONE AlarmType = 0 + // Space quota has been exceeded. + AlarmType_ALARM_TYPE_NOSPACE AlarmType = 1 + // Storage corruption detected. + AlarmType_ALARM_TYPE_CORRUPT AlarmType = 2 +) + +// Enum value maps for AlarmType. +var ( + AlarmType_name = map[int32]string{ + 0: "ALARM_TYPE_NONE", + 1: "ALARM_TYPE_NOSPACE", + 2: "ALARM_TYPE_CORRUPT", + } + AlarmType_value = map[string]int32{ + "ALARM_TYPE_NONE": 0, + "ALARM_TYPE_NOSPACE": 1, + "ALARM_TYPE_CORRUPT": 2, + } +) + +func (x AlarmType) Enum() *AlarmType { + p := new(AlarmType) + *p = x + return p +} + +func (x AlarmType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (AlarmType) Descriptor() protoreflect.EnumDescriptor { + return file_maintenance_proto_enumTypes[0].Descriptor() +} + +func (AlarmType) Type() protoreflect.EnumType { + return &file_maintenance_proto_enumTypes[0] +} + +func (x AlarmType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use AlarmType.Descriptor instead. +func (AlarmType) EnumDescriptor() ([]byte, []int) { + return file_maintenance_proto_rawDescGZIP(), []int{0} +} + +// AlarmAction defines the operation to perform on alarms. +type AlarmAction int32 + +const ( + AlarmAction_ALARM_ACTION_GET AlarmAction = 0 + AlarmAction_ALARM_ACTION_ACTIVATE AlarmAction = 1 + AlarmAction_ALARM_ACTION_ACKNOWLEDGE AlarmAction = 2 +) + +// Enum value maps for AlarmAction. +var ( + AlarmAction_name = map[int32]string{ + 0: "ALARM_ACTION_GET", + 1: "ALARM_ACTION_ACTIVATE", + 2: "ALARM_ACTION_ACKNOWLEDGE", + } + AlarmAction_value = map[string]int32{ + "ALARM_ACTION_GET": 0, + "ALARM_ACTION_ACTIVATE": 1, + "ALARM_ACTION_ACKNOWLEDGE": 2, + } +) + +func (x AlarmAction) Enum() *AlarmAction { + p := new(AlarmAction) + *p = x + return p +} + +func (x AlarmAction) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (AlarmAction) Descriptor() protoreflect.EnumDescriptor { + return file_maintenance_proto_enumTypes[1].Descriptor() +} + +func (AlarmAction) Type() protoreflect.EnumType { + return &file_maintenance_proto_enumTypes[1] +} + +func (x AlarmAction) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use AlarmAction.Descriptor instead. +func (AlarmAction) EnumDescriptor() ([]byte, []int) { + return file_maintenance_proto_rawDescGZIP(), []int{1} +} + +// AlarmMember associates an alarm with a cluster member. +type AlarmMember struct { + state protoimpl.MessageState `protogen:"open.v1"` + // member_id is the ID of the member raising the alarm. + MemberId uint64 `protobuf:"varint,1,opt,name=member_id,json=memberId,proto3" json:"member_id,omitempty"` + // alarm is the type of alarm. + Alarm AlarmType `protobuf:"varint,2,opt,name=alarm,proto3,enum=aether.AlarmType" json:"alarm,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *AlarmMember) Reset() { + *x = AlarmMember{} + mi := &file_maintenance_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *AlarmMember) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AlarmMember) ProtoMessage() {} + +func (x *AlarmMember) ProtoReflect() protoreflect.Message { + mi := &file_maintenance_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 AlarmMember.ProtoReflect.Descriptor instead. +func (*AlarmMember) Descriptor() ([]byte, []int) { + return file_maintenance_proto_rawDescGZIP(), []int{0} +} + +func (x *AlarmMember) GetMemberId() uint64 { + if x != nil { + return x.MemberId + } + return 0 +} + +func (x *AlarmMember) GetAlarm() AlarmType { + if x != nil { + return x.Alarm + } + return AlarmType_ALARM_TYPE_NONE +} + +type DefragRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DefragRequest) Reset() { + *x = DefragRequest{} + mi := &file_maintenance_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DefragRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DefragRequest) ProtoMessage() {} + +func (x *DefragRequest) ProtoReflect() protoreflect.Message { + mi := &file_maintenance_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 DefragRequest.ProtoReflect.Descriptor instead. +func (*DefragRequest) Descriptor() ([]byte, []int) { + return file_maintenance_proto_rawDescGZIP(), []int{1} +} + +type DefragResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DefragResponse) Reset() { + *x = DefragResponse{} + mi := &file_maintenance_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DefragResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DefragResponse) ProtoMessage() {} + +func (x *DefragResponse) ProtoReflect() protoreflect.Message { + mi := &file_maintenance_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 DefragResponse.ProtoReflect.Descriptor instead. +func (*DefragResponse) Descriptor() ([]byte, []int) { + return file_maintenance_proto_rawDescGZIP(), []int{2} +} + +func (x *DefragResponse) GetHeader() *ResponseHeader { + if x != nil { + return x.Header + } + return nil +} + +type AlarmRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // action is the operation to perform. + Action AlarmAction `protobuf:"varint,1,opt,name=action,proto3,enum=aether.AlarmAction" json:"action,omitempty"` + // alarm is the alarm type (used for ACTIVATE and ACKNOWLEDGE). + Alarm AlarmType `protobuf:"varint,2,opt,name=alarm,proto3,enum=aether.AlarmType" json:"alarm,omitempty"` + // member_id is the target member (0 = self, used for ACKNOWLEDGE). + MemberId uint64 `protobuf:"varint,3,opt,name=member_id,json=memberId,proto3" json:"member_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *AlarmRequest) Reset() { + *x = AlarmRequest{} + mi := &file_maintenance_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *AlarmRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AlarmRequest) ProtoMessage() {} + +func (x *AlarmRequest) ProtoReflect() protoreflect.Message { + mi := &file_maintenance_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 AlarmRequest.ProtoReflect.Descriptor instead. +func (*AlarmRequest) Descriptor() ([]byte, []int) { + return file_maintenance_proto_rawDescGZIP(), []int{3} +} + +func (x *AlarmRequest) GetAction() AlarmAction { + if x != nil { + return x.Action + } + return AlarmAction_ALARM_ACTION_GET +} + +func (x *AlarmRequest) GetAlarm() AlarmType { + if x != nil { + return x.Alarm + } + return AlarmType_ALARM_TYPE_NONE +} + +func (x *AlarmRequest) GetMemberId() uint64 { + if x != nil { + return x.MemberId + } + return 0 +} + +type AlarmResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` + // alarms is the list of active alarms (populated on GET). + Alarms []*AlarmMember `protobuf:"bytes,2,rep,name=alarms,proto3" json:"alarms,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *AlarmResponse) Reset() { + *x = AlarmResponse{} + mi := &file_maintenance_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *AlarmResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AlarmResponse) ProtoMessage() {} + +func (x *AlarmResponse) ProtoReflect() protoreflect.Message { + mi := &file_maintenance_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 AlarmResponse.ProtoReflect.Descriptor instead. +func (*AlarmResponse) Descriptor() ([]byte, []int) { + return file_maintenance_proto_rawDescGZIP(), []int{4} +} + +func (x *AlarmResponse) GetHeader() *ResponseHeader { + if x != nil { + return x.Header + } + return nil +} + +func (x *AlarmResponse) GetAlarms() []*AlarmMember { + if x != nil { + return x.Alarms + } + return nil +} + +type StatusRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *StatusRequest) Reset() { + *x = StatusRequest{} + mi := &file_maintenance_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *StatusRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*StatusRequest) ProtoMessage() {} + +func (x *StatusRequest) ProtoReflect() protoreflect.Message { + mi := &file_maintenance_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 StatusRequest.ProtoReflect.Descriptor instead. +func (*StatusRequest) Descriptor() ([]byte, []int) { + return file_maintenance_proto_rawDescGZIP(), []int{5} +} + +type StatusResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` + // version is the Aether server version. + Version string `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"` + // db_size is the total SST file size in bytes (disk usage). + DbSize int64 `protobuf:"varint,3,opt,name=db_size,json=dbSize,proto3" json:"db_size,omitempty"` + // leader is the current Raft leader node ID. + Leader uint64 `protobuf:"varint,4,opt,name=leader,proto3" json:"leader,omitempty"` + // raft_index is the current Raft commit index. + RaftIndex uint64 `protobuf:"varint,5,opt,name=raft_index,json=raftIndex,proto3" json:"raft_index,omitempty"` + // raft_term is the current Raft term. + RaftTerm uint64 `protobuf:"varint,6,opt,name=raft_term,json=raftTerm,proto3" json:"raft_term,omitempty"` + // raft_applied_index is the last applied Raft index. + RaftAppliedIndex uint64 `protobuf:"varint,7,opt,name=raft_applied_index,json=raftAppliedIndex,proto3" json:"raft_applied_index,omitempty"` + // db_in_use is the estimated live data size in bytes. + DbInUse int64 `protobuf:"varint,8,opt,name=db_in_use,json=dbInUse,proto3" json:"db_in_use,omitempty"` + // is_learner indicates if this node is a learner. + IsLearner bool `protobuf:"varint,9,opt,name=is_learner,json=isLearner,proto3" json:"is_learner,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *StatusResponse) Reset() { + *x = StatusResponse{} + mi := &file_maintenance_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *StatusResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*StatusResponse) ProtoMessage() {} + +func (x *StatusResponse) ProtoReflect() protoreflect.Message { + mi := &file_maintenance_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 StatusResponse.ProtoReflect.Descriptor instead. +func (*StatusResponse) Descriptor() ([]byte, []int) { + return file_maintenance_proto_rawDescGZIP(), []int{6} +} + +func (x *StatusResponse) GetHeader() *ResponseHeader { + if x != nil { + return x.Header + } + return nil +} + +func (x *StatusResponse) GetVersion() string { + if x != nil { + return x.Version + } + return "" +} + +func (x *StatusResponse) GetDbSize() int64 { + if x != nil { + return x.DbSize + } + return 0 +} + +func (x *StatusResponse) GetLeader() uint64 { + if x != nil { + return x.Leader + } + return 0 +} + +func (x *StatusResponse) GetRaftIndex() uint64 { + if x != nil { + return x.RaftIndex + } + return 0 +} + +func (x *StatusResponse) GetRaftTerm() uint64 { + if x != nil { + return x.RaftTerm + } + return 0 +} + +func (x *StatusResponse) GetRaftAppliedIndex() uint64 { + if x != nil { + return x.RaftAppliedIndex + } + return 0 +} + +func (x *StatusResponse) GetDbInUse() int64 { + if x != nil { + return x.DbInUse + } + return 0 +} + +func (x *StatusResponse) GetIsLearner() bool { + if x != nil { + return x.IsLearner + } + return false +} + +var File_maintenance_proto protoreflect.FileDescriptor + +const file_maintenance_proto_rawDesc = "" + + "\n" + + "\x11maintenance.proto\x12\x06aether\x1a\fcommon.proto\"S\n" + + "\vAlarmMember\x12\x1b\n" + + "\tmember_id\x18\x01 \x01(\x04R\bmemberId\x12'\n" + + "\x05alarm\x18\x02 \x01(\x0e2\x11.aether.AlarmTypeR\x05alarm\"\x0f\n" + + "\rDefragRequest\"@\n" + + "\x0eDefragResponse\x12.\n" + + "\x06header\x18\x01 \x01(\v2\x16.aether.ResponseHeaderR\x06header\"\x81\x01\n" + + "\fAlarmRequest\x12+\n" + + "\x06action\x18\x01 \x01(\x0e2\x13.aether.AlarmActionR\x06action\x12'\n" + + "\x05alarm\x18\x02 \x01(\x0e2\x11.aether.AlarmTypeR\x05alarm\x12\x1b\n" + + "\tmember_id\x18\x03 \x01(\x04R\bmemberId\"l\n" + + "\rAlarmResponse\x12.\n" + + "\x06header\x18\x01 \x01(\v2\x16.aether.ResponseHeaderR\x06header\x12+\n" + + "\x06alarms\x18\x02 \x03(\v2\x13.aether.AlarmMemberR\x06alarms\"\x0f\n" + + "\rStatusRequest\"\xb0\x02\n" + + "\x0eStatusResponse\x12.\n" + + "\x06header\x18\x01 \x01(\v2\x16.aether.ResponseHeaderR\x06header\x12\x18\n" + + "\aversion\x18\x02 \x01(\tR\aversion\x12\x17\n" + + "\adb_size\x18\x03 \x01(\x03R\x06dbSize\x12\x16\n" + + "\x06leader\x18\x04 \x01(\x04R\x06leader\x12\x1d\n" + + "\n" + + "raft_index\x18\x05 \x01(\x04R\traftIndex\x12\x1b\n" + + "\traft_term\x18\x06 \x01(\x04R\braftTerm\x12,\n" + + "\x12raft_applied_index\x18\a \x01(\x04R\x10raftAppliedIndex\x12\x1a\n" + + "\tdb_in_use\x18\b \x01(\x03R\adbInUse\x12\x1d\n" + + "\n" + + "is_learner\x18\t \x01(\bR\tisLearner*P\n" + + "\tAlarmType\x12\x13\n" + + "\x0fALARM_TYPE_NONE\x10\x00\x12\x16\n" + + "\x12ALARM_TYPE_NOSPACE\x10\x01\x12\x16\n" + + "\x12ALARM_TYPE_CORRUPT\x10\x02*\\\n" + + "\vAlarmAction\x12\x14\n" + + "\x10ALARM_ACTION_GET\x10\x00\x12\x19\n" + + "\x15ALARM_ACTION_ACTIVATE\x10\x01\x12\x1c\n" + + "\x18ALARM_ACTION_ACKNOWLEDGE\x10\x022\xbb\x01\n" + + "\x11AetherMaintenance\x127\n" + + "\x06Defrag\x12\x15.aether.DefragRequest\x1a\x16.aether.DefragResponse\x124\n" + + "\x05Alarm\x12\x14.aether.AlarmRequest\x1a\x15.aether.AlarmResponse\x127\n" + + "\x06Status\x12\x15.aether.StatusRequest\x1a\x16.aether.StatusResponseB-Z+github.com/aether-io/aether/sdk/go/aetherpbb\x06proto3" + +var ( + file_maintenance_proto_rawDescOnce sync.Once + file_maintenance_proto_rawDescData []byte +) + +func file_maintenance_proto_rawDescGZIP() []byte { + file_maintenance_proto_rawDescOnce.Do(func() { + file_maintenance_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_maintenance_proto_rawDesc), len(file_maintenance_proto_rawDesc))) + }) + return file_maintenance_proto_rawDescData +} + +var file_maintenance_proto_enumTypes = make([]protoimpl.EnumInfo, 2) +var file_maintenance_proto_msgTypes = make([]protoimpl.MessageInfo, 7) +var file_maintenance_proto_goTypes = []any{ + (AlarmType)(0), // 0: aether.AlarmType + (AlarmAction)(0), // 1: aether.AlarmAction + (*AlarmMember)(nil), // 2: aether.AlarmMember + (*DefragRequest)(nil), // 3: aether.DefragRequest + (*DefragResponse)(nil), // 4: aether.DefragResponse + (*AlarmRequest)(nil), // 5: aether.AlarmRequest + (*AlarmResponse)(nil), // 6: aether.AlarmResponse + (*StatusRequest)(nil), // 7: aether.StatusRequest + (*StatusResponse)(nil), // 8: aether.StatusResponse + (*ResponseHeader)(nil), // 9: aether.ResponseHeader +} +var file_maintenance_proto_depIdxs = []int32{ + 0, // 0: aether.AlarmMember.alarm:type_name -> aether.AlarmType + 9, // 1: aether.DefragResponse.header:type_name -> aether.ResponseHeader + 1, // 2: aether.AlarmRequest.action:type_name -> aether.AlarmAction + 0, // 3: aether.AlarmRequest.alarm:type_name -> aether.AlarmType + 9, // 4: aether.AlarmResponse.header:type_name -> aether.ResponseHeader + 2, // 5: aether.AlarmResponse.alarms:type_name -> aether.AlarmMember + 9, // 6: aether.StatusResponse.header:type_name -> aether.ResponseHeader + 3, // 7: aether.AetherMaintenance.Defrag:input_type -> aether.DefragRequest + 5, // 8: aether.AetherMaintenance.Alarm:input_type -> aether.AlarmRequest + 7, // 9: aether.AetherMaintenance.Status:input_type -> aether.StatusRequest + 4, // 10: aether.AetherMaintenance.Defrag:output_type -> aether.DefragResponse + 6, // 11: aether.AetherMaintenance.Alarm:output_type -> aether.AlarmResponse + 8, // 12: aether.AetherMaintenance.Status:output_type -> aether.StatusResponse + 10, // [10:13] is the sub-list for method output_type + 7, // [7:10] is the sub-list for method input_type + 7, // [7:7] is the sub-list for extension type_name + 7, // [7:7] is the sub-list for extension extendee + 0, // [0:7] is the sub-list for field type_name +} + +func init() { file_maintenance_proto_init() } +func file_maintenance_proto_init() { + if File_maintenance_proto != nil { + return + } + file_common_proto_init() + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_maintenance_proto_rawDesc), len(file_maintenance_proto_rawDesc)), + NumEnums: 2, + NumMessages: 7, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_maintenance_proto_goTypes, + DependencyIndexes: file_maintenance_proto_depIdxs, + EnumInfos: file_maintenance_proto_enumTypes, + MessageInfos: file_maintenance_proto_msgTypes, + }.Build() + File_maintenance_proto = out.File + file_maintenance_proto_goTypes = nil + file_maintenance_proto_depIdxs = nil +} diff --git a/sdk/go/aetherpb/maintenance_grpc.pb.go b/sdk/go/aetherpb/maintenance_grpc.pb.go new file mode 100644 index 0000000..8ed10f3 --- /dev/null +++ b/sdk/go/aetherpb/maintenance_grpc.pb.go @@ -0,0 +1,205 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.5.1 +// - protoc v6.32.0 +// source: maintenance.proto + +package aetherpb + +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 ( + AetherMaintenance_Defrag_FullMethodName = "/aether.AetherMaintenance/Defrag" + AetherMaintenance_Alarm_FullMethodName = "/aether.AetherMaintenance/Alarm" + AetherMaintenance_Status_FullMethodName = "/aether.AetherMaintenance/Status" +) + +// AetherMaintenanceClient is the client API for AetherMaintenance 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. +// +// AetherMaintenance provides operational tools for cluster maintenance. +type AetherMaintenanceClient interface { + // Defrag triggers storage defragmentation on the receiving node. + Defrag(ctx context.Context, in *DefragRequest, opts ...grpc.CallOption) (*DefragResponse, error) + // Alarm manages cluster-wide alarms (e.g. space quota, corruption). + Alarm(ctx context.Context, in *AlarmRequest, opts ...grpc.CallOption) (*AlarmResponse, error) + // Status returns node-level status information. + Status(ctx context.Context, in *StatusRequest, opts ...grpc.CallOption) (*StatusResponse, error) +} + +type aetherMaintenanceClient struct { + cc grpc.ClientConnInterface +} + +func NewAetherMaintenanceClient(cc grpc.ClientConnInterface) AetherMaintenanceClient { + return &aetherMaintenanceClient{cc} +} + +func (c *aetherMaintenanceClient) Defrag(ctx context.Context, in *DefragRequest, opts ...grpc.CallOption) (*DefragResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(DefragResponse) + err := c.cc.Invoke(ctx, AetherMaintenance_Defrag_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *aetherMaintenanceClient) Alarm(ctx context.Context, in *AlarmRequest, opts ...grpc.CallOption) (*AlarmResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(AlarmResponse) + err := c.cc.Invoke(ctx, AetherMaintenance_Alarm_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *aetherMaintenanceClient) Status(ctx context.Context, in *StatusRequest, opts ...grpc.CallOption) (*StatusResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(StatusResponse) + err := c.cc.Invoke(ctx, AetherMaintenance_Status_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +// AetherMaintenanceServer is the server API for AetherMaintenance service. +// All implementations should embed UnimplementedAetherMaintenanceServer +// for forward compatibility. +// +// AetherMaintenance provides operational tools for cluster maintenance. +type AetherMaintenanceServer interface { + // Defrag triggers storage defragmentation on the receiving node. + Defrag(context.Context, *DefragRequest) (*DefragResponse, error) + // Alarm manages cluster-wide alarms (e.g. space quota, corruption). + Alarm(context.Context, *AlarmRequest) (*AlarmResponse, error) + // Status returns node-level status information. + Status(context.Context, *StatusRequest) (*StatusResponse, error) +} + +// UnimplementedAetherMaintenanceServer should 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 UnimplementedAetherMaintenanceServer struct{} + +func (UnimplementedAetherMaintenanceServer) Defrag(context.Context, *DefragRequest) (*DefragResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Defrag not implemented") +} +func (UnimplementedAetherMaintenanceServer) Alarm(context.Context, *AlarmRequest) (*AlarmResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Alarm not implemented") +} +func (UnimplementedAetherMaintenanceServer) Status(context.Context, *StatusRequest) (*StatusResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Status not implemented") +} +func (UnimplementedAetherMaintenanceServer) testEmbeddedByValue() {} + +// UnsafeAetherMaintenanceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to AetherMaintenanceServer will +// result in compilation errors. +type UnsafeAetherMaintenanceServer interface { + mustEmbedUnimplementedAetherMaintenanceServer() +} + +func RegisterAetherMaintenanceServer(s grpc.ServiceRegistrar, srv AetherMaintenanceServer) { + // If the following call pancis, it indicates UnimplementedAetherMaintenanceServer 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(&AetherMaintenance_ServiceDesc, srv) +} + +func _AetherMaintenance_Defrag_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DefragRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AetherMaintenanceServer).Defrag(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: AetherMaintenance_Defrag_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AetherMaintenanceServer).Defrag(ctx, req.(*DefragRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _AetherMaintenance_Alarm_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(AlarmRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AetherMaintenanceServer).Alarm(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: AetherMaintenance_Alarm_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AetherMaintenanceServer).Alarm(ctx, req.(*AlarmRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _AetherMaintenance_Status_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(StatusRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AetherMaintenanceServer).Status(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: AetherMaintenance_Status_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AetherMaintenanceServer).Status(ctx, req.(*StatusRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// AetherMaintenance_ServiceDesc is the grpc.ServiceDesc for AetherMaintenance service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var AetherMaintenance_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "aether.AetherMaintenance", + HandlerType: (*AetherMaintenanceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Defrag", + Handler: _AetherMaintenance_Defrag_Handler, + }, + { + MethodName: "Alarm", + Handler: _AetherMaintenance_Alarm_Handler, + }, + { + MethodName: "Status", + Handler: _AetherMaintenance_Status_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "maintenance.proto", +} diff --git a/sdk/go/aetherpb/queue.pb.go b/sdk/go/aetherpb/queue.pb.go new file mode 100644 index 0000000..e565352 --- /dev/null +++ b/sdk/go/aetherpb/queue.pb.go @@ -0,0 +1,435 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.6 +// protoc v6.32.0 +// source: queue.proto + +package aetherpb + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + 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 QueueEnqueueRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // name is the queue name. + Name []byte `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // value is the item to enqueue. + Value []byte `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *QueueEnqueueRequest) Reset() { + *x = QueueEnqueueRequest{} + mi := &file_queue_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *QueueEnqueueRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QueueEnqueueRequest) ProtoMessage() {} + +func (x *QueueEnqueueRequest) ProtoReflect() protoreflect.Message { + mi := &file_queue_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 QueueEnqueueRequest.ProtoReflect.Descriptor instead. +func (*QueueEnqueueRequest) Descriptor() ([]byte, []int) { + return file_queue_proto_rawDescGZIP(), []int{0} +} + +func (x *QueueEnqueueRequest) GetName() []byte { + if x != nil { + return x.Name + } + return nil +} + +func (x *QueueEnqueueRequest) GetValue() []byte { + if x != nil { + return x.Value + } + return nil +} + +type QueueEnqueueResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` + // key is the key assigned to the enqueued item. + Key []byte `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *QueueEnqueueResponse) Reset() { + *x = QueueEnqueueResponse{} + mi := &file_queue_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *QueueEnqueueResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QueueEnqueueResponse) ProtoMessage() {} + +func (x *QueueEnqueueResponse) ProtoReflect() protoreflect.Message { + mi := &file_queue_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 QueueEnqueueResponse.ProtoReflect.Descriptor instead. +func (*QueueEnqueueResponse) Descriptor() ([]byte, []int) { + return file_queue_proto_rawDescGZIP(), []int{1} +} + +func (x *QueueEnqueueResponse) GetHeader() *ResponseHeader { + if x != nil { + return x.Header + } + return nil +} + +func (x *QueueEnqueueResponse) GetKey() []byte { + if x != nil { + return x.Key + } + return nil +} + +type QueueDequeueRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // name is the queue name. + Name []byte `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *QueueDequeueRequest) Reset() { + *x = QueueDequeueRequest{} + mi := &file_queue_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *QueueDequeueRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QueueDequeueRequest) ProtoMessage() {} + +func (x *QueueDequeueRequest) ProtoReflect() protoreflect.Message { + mi := &file_queue_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 QueueDequeueRequest.ProtoReflect.Descriptor instead. +func (*QueueDequeueRequest) Descriptor() ([]byte, []int) { + return file_queue_proto_rawDescGZIP(), []int{2} +} + +func (x *QueueDequeueRequest) GetName() []byte { + if x != nil { + return x.Name + } + return nil +} + +type QueueDequeueResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` + // key is the key of the dequeued item. + Key []byte `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"` + // value is the value of the dequeued item. + Value []byte `protobuf:"bytes,3,opt,name=value,proto3" json:"value,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *QueueDequeueResponse) Reset() { + *x = QueueDequeueResponse{} + mi := &file_queue_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *QueueDequeueResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QueueDequeueResponse) ProtoMessage() {} + +func (x *QueueDequeueResponse) ProtoReflect() protoreflect.Message { + mi := &file_queue_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 QueueDequeueResponse.ProtoReflect.Descriptor instead. +func (*QueueDequeueResponse) Descriptor() ([]byte, []int) { + return file_queue_proto_rawDescGZIP(), []int{3} +} + +func (x *QueueDequeueResponse) GetHeader() *ResponseHeader { + if x != nil { + return x.Header + } + return nil +} + +func (x *QueueDequeueResponse) GetKey() []byte { + if x != nil { + return x.Key + } + return nil +} + +func (x *QueueDequeueResponse) GetValue() []byte { + if x != nil { + return x.Value + } + return nil +} + +type QueuePeekRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // name is the queue name. + Name []byte `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *QueuePeekRequest) Reset() { + *x = QueuePeekRequest{} + mi := &file_queue_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *QueuePeekRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QueuePeekRequest) ProtoMessage() {} + +func (x *QueuePeekRequest) ProtoReflect() protoreflect.Message { + mi := &file_queue_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 QueuePeekRequest.ProtoReflect.Descriptor instead. +func (*QueuePeekRequest) Descriptor() ([]byte, []int) { + return file_queue_proto_rawDescGZIP(), []int{4} +} + +func (x *QueuePeekRequest) GetName() []byte { + if x != nil { + return x.Name + } + return nil +} + +type QueuePeekResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` + // key is the key of the front item. + Key []byte `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"` + // value is the value of the front item. + Value []byte `protobuf:"bytes,3,opt,name=value,proto3" json:"value,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *QueuePeekResponse) Reset() { + *x = QueuePeekResponse{} + mi := &file_queue_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *QueuePeekResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QueuePeekResponse) ProtoMessage() {} + +func (x *QueuePeekResponse) ProtoReflect() protoreflect.Message { + mi := &file_queue_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 QueuePeekResponse.ProtoReflect.Descriptor instead. +func (*QueuePeekResponse) Descriptor() ([]byte, []int) { + return file_queue_proto_rawDescGZIP(), []int{5} +} + +func (x *QueuePeekResponse) GetHeader() *ResponseHeader { + if x != nil { + return x.Header + } + return nil +} + +func (x *QueuePeekResponse) GetKey() []byte { + if x != nil { + return x.Key + } + return nil +} + +func (x *QueuePeekResponse) GetValue() []byte { + if x != nil { + return x.Value + } + return nil +} + +var File_queue_proto protoreflect.FileDescriptor + +const file_queue_proto_rawDesc = "" + + "\n" + + "\vqueue.proto\x12\x06aether\x1a\fcommon.proto\"?\n" + + "\x13QueueEnqueueRequest\x12\x12\n" + + "\x04name\x18\x01 \x01(\fR\x04name\x12\x14\n" + + "\x05value\x18\x02 \x01(\fR\x05value\"X\n" + + "\x14QueueEnqueueResponse\x12.\n" + + "\x06header\x18\x01 \x01(\v2\x16.aether.ResponseHeaderR\x06header\x12\x10\n" + + "\x03key\x18\x02 \x01(\fR\x03key\")\n" + + "\x13QueueDequeueRequest\x12\x12\n" + + "\x04name\x18\x01 \x01(\fR\x04name\"n\n" + + "\x14QueueDequeueResponse\x12.\n" + + "\x06header\x18\x01 \x01(\v2\x16.aether.ResponseHeaderR\x06header\x12\x10\n" + + "\x03key\x18\x02 \x01(\fR\x03key\x12\x14\n" + + "\x05value\x18\x03 \x01(\fR\x05value\"&\n" + + "\x10QueuePeekRequest\x12\x12\n" + + "\x04name\x18\x01 \x01(\fR\x04name\"k\n" + + "\x11QueuePeekResponse\x12.\n" + + "\x06header\x18\x01 \x01(\v2\x16.aether.ResponseHeaderR\x06header\x12\x10\n" + + "\x03key\x18\x02 \x01(\fR\x03key\x12\x14\n" + + "\x05value\x18\x03 \x01(\fR\x05value2\xd6\x01\n" + + "\vAetherQueue\x12D\n" + + "\aEnqueue\x12\x1b.aether.QueueEnqueueRequest\x1a\x1c.aether.QueueEnqueueResponse\x12D\n" + + "\aDequeue\x12\x1b.aether.QueueDequeueRequest\x1a\x1c.aether.QueueDequeueResponse\x12;\n" + + "\x04Peek\x12\x18.aether.QueuePeekRequest\x1a\x19.aether.QueuePeekResponseB-Z+github.com/aether-io/aether/sdk/go/aetherpbb\x06proto3" + +var ( + file_queue_proto_rawDescOnce sync.Once + file_queue_proto_rawDescData []byte +) + +func file_queue_proto_rawDescGZIP() []byte { + file_queue_proto_rawDescOnce.Do(func() { + file_queue_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_queue_proto_rawDesc), len(file_queue_proto_rawDesc))) + }) + return file_queue_proto_rawDescData +} + +var file_queue_proto_msgTypes = make([]protoimpl.MessageInfo, 6) +var file_queue_proto_goTypes = []any{ + (*QueueEnqueueRequest)(nil), // 0: aether.QueueEnqueueRequest + (*QueueEnqueueResponse)(nil), // 1: aether.QueueEnqueueResponse + (*QueueDequeueRequest)(nil), // 2: aether.QueueDequeueRequest + (*QueueDequeueResponse)(nil), // 3: aether.QueueDequeueResponse + (*QueuePeekRequest)(nil), // 4: aether.QueuePeekRequest + (*QueuePeekResponse)(nil), // 5: aether.QueuePeekResponse + (*ResponseHeader)(nil), // 6: aether.ResponseHeader +} +var file_queue_proto_depIdxs = []int32{ + 6, // 0: aether.QueueEnqueueResponse.header:type_name -> aether.ResponseHeader + 6, // 1: aether.QueueDequeueResponse.header:type_name -> aether.ResponseHeader + 6, // 2: aether.QueuePeekResponse.header:type_name -> aether.ResponseHeader + 0, // 3: aether.AetherQueue.Enqueue:input_type -> aether.QueueEnqueueRequest + 2, // 4: aether.AetherQueue.Dequeue:input_type -> aether.QueueDequeueRequest + 4, // 5: aether.AetherQueue.Peek:input_type -> aether.QueuePeekRequest + 1, // 6: aether.AetherQueue.Enqueue:output_type -> aether.QueueEnqueueResponse + 3, // 7: aether.AetherQueue.Dequeue:output_type -> aether.QueueDequeueResponse + 5, // 8: aether.AetherQueue.Peek:output_type -> aether.QueuePeekResponse + 6, // [6:9] is the sub-list for method output_type + 3, // [3:6] is the sub-list for method input_type + 3, // [3:3] is the sub-list for extension type_name + 3, // [3:3] is the sub-list for extension extendee + 0, // [0:3] is the sub-list for field type_name +} + +func init() { file_queue_proto_init() } +func file_queue_proto_init() { + if File_queue_proto != nil { + return + } + file_common_proto_init() + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_queue_proto_rawDesc), len(file_queue_proto_rawDesc)), + NumEnums: 0, + NumMessages: 6, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_queue_proto_goTypes, + DependencyIndexes: file_queue_proto_depIdxs, + MessageInfos: file_queue_proto_msgTypes, + }.Build() + File_queue_proto = out.File + file_queue_proto_goTypes = nil + file_queue_proto_depIdxs = nil +} diff --git a/sdk/go/aetherpb/queue_grpc.pb.go b/sdk/go/aetherpb/queue_grpc.pb.go new file mode 100644 index 0000000..1865267 --- /dev/null +++ b/sdk/go/aetherpb/queue_grpc.pb.go @@ -0,0 +1,213 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.5.1 +// - protoc v6.32.0 +// source: queue.proto + +package aetherpb + +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 ( + AetherQueue_Enqueue_FullMethodName = "/aether.AetherQueue/Enqueue" + AetherQueue_Dequeue_FullMethodName = "/aether.AetherQueue/Dequeue" + AetherQueue_Peek_FullMethodName = "/aether.AetherQueue/Peek" +) + +// AetherQueueClient is the client API for AetherQueue 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. +// +// AetherQueue provides distributed FIFO queue operations. +// Items are stored with sequential keys under a named queue prefix. +// Enqueue appends an item; Dequeue pops the front item atomically. +type AetherQueueClient interface { + // Enqueue adds an item to the named queue. + Enqueue(ctx context.Context, in *QueueEnqueueRequest, opts ...grpc.CallOption) (*QueueEnqueueResponse, error) + // Dequeue removes and returns the front item from the named queue. + // Returns NOT_FOUND if the queue is empty. + Dequeue(ctx context.Context, in *QueueDequeueRequest, opts ...grpc.CallOption) (*QueueDequeueResponse, error) + // Peek returns the front item without removing it. + // Returns NOT_FOUND if the queue is empty. + Peek(ctx context.Context, in *QueuePeekRequest, opts ...grpc.CallOption) (*QueuePeekResponse, error) +} + +type aetherQueueClient struct { + cc grpc.ClientConnInterface +} + +func NewAetherQueueClient(cc grpc.ClientConnInterface) AetherQueueClient { + return &aetherQueueClient{cc} +} + +func (c *aetherQueueClient) Enqueue(ctx context.Context, in *QueueEnqueueRequest, opts ...grpc.CallOption) (*QueueEnqueueResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(QueueEnqueueResponse) + err := c.cc.Invoke(ctx, AetherQueue_Enqueue_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *aetherQueueClient) Dequeue(ctx context.Context, in *QueueDequeueRequest, opts ...grpc.CallOption) (*QueueDequeueResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(QueueDequeueResponse) + err := c.cc.Invoke(ctx, AetherQueue_Dequeue_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *aetherQueueClient) Peek(ctx context.Context, in *QueuePeekRequest, opts ...grpc.CallOption) (*QueuePeekResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(QueuePeekResponse) + err := c.cc.Invoke(ctx, AetherQueue_Peek_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +// AetherQueueServer is the server API for AetherQueue service. +// All implementations should embed UnimplementedAetherQueueServer +// for forward compatibility. +// +// AetherQueue provides distributed FIFO queue operations. +// Items are stored with sequential keys under a named queue prefix. +// Enqueue appends an item; Dequeue pops the front item atomically. +type AetherQueueServer interface { + // Enqueue adds an item to the named queue. + Enqueue(context.Context, *QueueEnqueueRequest) (*QueueEnqueueResponse, error) + // Dequeue removes and returns the front item from the named queue. + // Returns NOT_FOUND if the queue is empty. + Dequeue(context.Context, *QueueDequeueRequest) (*QueueDequeueResponse, error) + // Peek returns the front item without removing it. + // Returns NOT_FOUND if the queue is empty. + Peek(context.Context, *QueuePeekRequest) (*QueuePeekResponse, error) +} + +// UnimplementedAetherQueueServer should 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 UnimplementedAetherQueueServer struct{} + +func (UnimplementedAetherQueueServer) Enqueue(context.Context, *QueueEnqueueRequest) (*QueueEnqueueResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Enqueue not implemented") +} +func (UnimplementedAetherQueueServer) Dequeue(context.Context, *QueueDequeueRequest) (*QueueDequeueResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Dequeue not implemented") +} +func (UnimplementedAetherQueueServer) Peek(context.Context, *QueuePeekRequest) (*QueuePeekResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Peek not implemented") +} +func (UnimplementedAetherQueueServer) testEmbeddedByValue() {} + +// UnsafeAetherQueueServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to AetherQueueServer will +// result in compilation errors. +type UnsafeAetherQueueServer interface { + mustEmbedUnimplementedAetherQueueServer() +} + +func RegisterAetherQueueServer(s grpc.ServiceRegistrar, srv AetherQueueServer) { + // If the following call pancis, it indicates UnimplementedAetherQueueServer 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(&AetherQueue_ServiceDesc, srv) +} + +func _AetherQueue_Enqueue_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueueEnqueueRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AetherQueueServer).Enqueue(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: AetherQueue_Enqueue_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AetherQueueServer).Enqueue(ctx, req.(*QueueEnqueueRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _AetherQueue_Dequeue_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueueDequeueRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AetherQueueServer).Dequeue(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: AetherQueue_Dequeue_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AetherQueueServer).Dequeue(ctx, req.(*QueueDequeueRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _AetherQueue_Peek_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueuePeekRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AetherQueueServer).Peek(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: AetherQueue_Peek_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AetherQueueServer).Peek(ctx, req.(*QueuePeekRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// AetherQueue_ServiceDesc is the grpc.ServiceDesc for AetherQueue service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var AetherQueue_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "aether.AetherQueue", + HandlerType: (*AetherQueueServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Enqueue", + Handler: _AetherQueue_Enqueue_Handler, + }, + { + MethodName: "Dequeue", + Handler: _AetherQueue_Dequeue_Handler, + }, + { + MethodName: "Peek", + Handler: _AetherQueue_Peek_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "queue.proto", +} diff --git a/sdk/go/aetherpb/raft.pb.go b/sdk/go/aetherpb/raft.pb.go new file mode 100644 index 0000000..3e992f9 --- /dev/null +++ b/sdk/go/aetherpb/raft.pb.go @@ -0,0 +1,368 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.6 +// protoc v6.32.0 +// source: raft.proto + +package aetherpb + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + 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 AppendEntriesRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Payload []byte `protobuf:"bytes,1,opt,name=payload,proto3" json:"payload,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *AppendEntriesRequest) Reset() { + *x = AppendEntriesRequest{} + mi := &file_raft_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *AppendEntriesRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AppendEntriesRequest) ProtoMessage() {} + +func (x *AppendEntriesRequest) ProtoReflect() protoreflect.Message { + mi := &file_raft_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 AppendEntriesRequest.ProtoReflect.Descriptor instead. +func (*AppendEntriesRequest) Descriptor() ([]byte, []int) { + return file_raft_proto_rawDescGZIP(), []int{0} +} + +func (x *AppendEntriesRequest) GetPayload() []byte { + if x != nil { + return x.Payload + } + return nil +} + +type AppendEntriesResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Payload []byte `protobuf:"bytes,1,opt,name=payload,proto3" json:"payload,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *AppendEntriesResponse) Reset() { + *x = AppendEntriesResponse{} + mi := &file_raft_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *AppendEntriesResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AppendEntriesResponse) ProtoMessage() {} + +func (x *AppendEntriesResponse) ProtoReflect() protoreflect.Message { + mi := &file_raft_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 AppendEntriesResponse.ProtoReflect.Descriptor instead. +func (*AppendEntriesResponse) Descriptor() ([]byte, []int) { + return file_raft_proto_rawDescGZIP(), []int{1} +} + +func (x *AppendEntriesResponse) GetPayload() []byte { + if x != nil { + return x.Payload + } + return nil +} + +type VoteRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Payload []byte `protobuf:"bytes,1,opt,name=payload,proto3" json:"payload,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *VoteRequest) Reset() { + *x = VoteRequest{} + mi := &file_raft_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *VoteRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*VoteRequest) ProtoMessage() {} + +func (x *VoteRequest) ProtoReflect() protoreflect.Message { + mi := &file_raft_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 VoteRequest.ProtoReflect.Descriptor instead. +func (*VoteRequest) Descriptor() ([]byte, []int) { + return file_raft_proto_rawDescGZIP(), []int{2} +} + +func (x *VoteRequest) GetPayload() []byte { + if x != nil { + return x.Payload + } + return nil +} + +type VoteResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Payload []byte `protobuf:"bytes,1,opt,name=payload,proto3" json:"payload,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *VoteResponse) Reset() { + *x = VoteResponse{} + mi := &file_raft_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *VoteResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*VoteResponse) ProtoMessage() {} + +func (x *VoteResponse) ProtoReflect() protoreflect.Message { + mi := &file_raft_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 VoteResponse.ProtoReflect.Descriptor instead. +func (*VoteResponse) Descriptor() ([]byte, []int) { + return file_raft_proto_rawDescGZIP(), []int{3} +} + +func (x *VoteResponse) GetPayload() []byte { + if x != nil { + return x.Payload + } + return nil +} + +type InstallSnapshotRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Payload []byte `protobuf:"bytes,1,opt,name=payload,proto3" json:"payload,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *InstallSnapshotRequest) Reset() { + *x = InstallSnapshotRequest{} + mi := &file_raft_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *InstallSnapshotRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*InstallSnapshotRequest) ProtoMessage() {} + +func (x *InstallSnapshotRequest) ProtoReflect() protoreflect.Message { + mi := &file_raft_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 InstallSnapshotRequest.ProtoReflect.Descriptor instead. +func (*InstallSnapshotRequest) Descriptor() ([]byte, []int) { + return file_raft_proto_rawDescGZIP(), []int{4} +} + +func (x *InstallSnapshotRequest) GetPayload() []byte { + if x != nil { + return x.Payload + } + return nil +} + +type InstallSnapshotResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Payload []byte `protobuf:"bytes,1,opt,name=payload,proto3" json:"payload,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *InstallSnapshotResponse) Reset() { + *x = InstallSnapshotResponse{} + mi := &file_raft_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *InstallSnapshotResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*InstallSnapshotResponse) ProtoMessage() {} + +func (x *InstallSnapshotResponse) ProtoReflect() protoreflect.Message { + mi := &file_raft_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 InstallSnapshotResponse.ProtoReflect.Descriptor instead. +func (*InstallSnapshotResponse) Descriptor() ([]byte, []int) { + return file_raft_proto_rawDescGZIP(), []int{5} +} + +func (x *InstallSnapshotResponse) GetPayload() []byte { + if x != nil { + return x.Payload + } + return nil +} + +var File_raft_proto protoreflect.FileDescriptor + +const file_raft_proto_rawDesc = "" + + "\n" + + "\n" + + "raft.proto\x12\x04raft\"0\n" + + "\x14AppendEntriesRequest\x12\x18\n" + + "\apayload\x18\x01 \x01(\fR\apayload\"1\n" + + "\x15AppendEntriesResponse\x12\x18\n" + + "\apayload\x18\x01 \x01(\fR\apayload\"'\n" + + "\vVoteRequest\x12\x18\n" + + "\apayload\x18\x01 \x01(\fR\apayload\"(\n" + + "\fVoteResponse\x12\x18\n" + + "\apayload\x18\x01 \x01(\fR\apayload\"2\n" + + "\x16InstallSnapshotRequest\x12\x18\n" + + "\apayload\x18\x01 \x01(\fR\apayload\"3\n" + + "\x17InstallSnapshotResponse\x12\x18\n" + + "\apayload\x18\x01 \x01(\fR\apayload2\xd2\x01\n" + + "\aRaftRPC\x12H\n" + + "\rAppendEntries\x12\x1a.raft.AppendEntriesRequest\x1a\x1b.raft.AppendEntriesResponse\x12-\n" + + "\x04Vote\x12\x11.raft.VoteRequest\x1a\x12.raft.VoteResponse\x12N\n" + + "\x0fInstallSnapshot\x12\x1c.raft.InstallSnapshotRequest\x1a\x1d.raft.InstallSnapshotResponseB-Z+github.com/aether-io/aether/sdk/go/aetherpbb\x06proto3" + +var ( + file_raft_proto_rawDescOnce sync.Once + file_raft_proto_rawDescData []byte +) + +func file_raft_proto_rawDescGZIP() []byte { + file_raft_proto_rawDescOnce.Do(func() { + file_raft_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_raft_proto_rawDesc), len(file_raft_proto_rawDesc))) + }) + return file_raft_proto_rawDescData +} + +var file_raft_proto_msgTypes = make([]protoimpl.MessageInfo, 6) +var file_raft_proto_goTypes = []any{ + (*AppendEntriesRequest)(nil), // 0: raft.AppendEntriesRequest + (*AppendEntriesResponse)(nil), // 1: raft.AppendEntriesResponse + (*VoteRequest)(nil), // 2: raft.VoteRequest + (*VoteResponse)(nil), // 3: raft.VoteResponse + (*InstallSnapshotRequest)(nil), // 4: raft.InstallSnapshotRequest + (*InstallSnapshotResponse)(nil), // 5: raft.InstallSnapshotResponse +} +var file_raft_proto_depIdxs = []int32{ + 0, // 0: raft.RaftRPC.AppendEntries:input_type -> raft.AppendEntriesRequest + 2, // 1: raft.RaftRPC.Vote:input_type -> raft.VoteRequest + 4, // 2: raft.RaftRPC.InstallSnapshot:input_type -> raft.InstallSnapshotRequest + 1, // 3: raft.RaftRPC.AppendEntries:output_type -> raft.AppendEntriesResponse + 3, // 4: raft.RaftRPC.Vote:output_type -> raft.VoteResponse + 5, // 5: raft.RaftRPC.InstallSnapshot:output_type -> raft.InstallSnapshotResponse + 3, // [3:6] is the sub-list for method output_type + 0, // [0:3] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_raft_proto_init() } +func file_raft_proto_init() { + if File_raft_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_raft_proto_rawDesc), len(file_raft_proto_rawDesc)), + NumEnums: 0, + NumMessages: 6, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_raft_proto_goTypes, + DependencyIndexes: file_raft_proto_depIdxs, + MessageInfos: file_raft_proto_msgTypes, + }.Build() + File_raft_proto = out.File + file_raft_proto_goTypes = nil + file_raft_proto_depIdxs = nil +} diff --git a/sdk/go/aetherpb/raft_grpc.pb.go b/sdk/go/aetherpb/raft_grpc.pb.go new file mode 100644 index 0000000..6dc8d92 --- /dev/null +++ b/sdk/go/aetherpb/raft_grpc.pb.go @@ -0,0 +1,201 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.5.1 +// - protoc v6.32.0 +// source: raft.proto + +package aetherpb + +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 ( + RaftRPC_AppendEntries_FullMethodName = "/raft.RaftRPC/AppendEntries" + RaftRPC_Vote_FullMethodName = "/raft.RaftRPC/Vote" + RaftRPC_InstallSnapshot_FullMethodName = "/raft.RaftRPC/InstallSnapshot" +) + +// RaftRPCClient is the client API for RaftRPC 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. +// +// RaftRPC provides internal Raft RPCs between cluster nodes. +// Payloads are protobuf-encoded raft-rs messages. +type RaftRPCClient interface { + AppendEntries(ctx context.Context, in *AppendEntriesRequest, opts ...grpc.CallOption) (*AppendEntriesResponse, error) + Vote(ctx context.Context, in *VoteRequest, opts ...grpc.CallOption) (*VoteResponse, error) + InstallSnapshot(ctx context.Context, in *InstallSnapshotRequest, opts ...grpc.CallOption) (*InstallSnapshotResponse, error) +} + +type raftRPCClient struct { + cc grpc.ClientConnInterface +} + +func NewRaftRPCClient(cc grpc.ClientConnInterface) RaftRPCClient { + return &raftRPCClient{cc} +} + +func (c *raftRPCClient) AppendEntries(ctx context.Context, in *AppendEntriesRequest, opts ...grpc.CallOption) (*AppendEntriesResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(AppendEntriesResponse) + err := c.cc.Invoke(ctx, RaftRPC_AppendEntries_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *raftRPCClient) Vote(ctx context.Context, in *VoteRequest, opts ...grpc.CallOption) (*VoteResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(VoteResponse) + err := c.cc.Invoke(ctx, RaftRPC_Vote_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *raftRPCClient) InstallSnapshot(ctx context.Context, in *InstallSnapshotRequest, opts ...grpc.CallOption) (*InstallSnapshotResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(InstallSnapshotResponse) + err := c.cc.Invoke(ctx, RaftRPC_InstallSnapshot_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +// RaftRPCServer is the server API for RaftRPC service. +// All implementations should embed UnimplementedRaftRPCServer +// for forward compatibility. +// +// RaftRPC provides internal Raft RPCs between cluster nodes. +// Payloads are protobuf-encoded raft-rs messages. +type RaftRPCServer interface { + AppendEntries(context.Context, *AppendEntriesRequest) (*AppendEntriesResponse, error) + Vote(context.Context, *VoteRequest) (*VoteResponse, error) + InstallSnapshot(context.Context, *InstallSnapshotRequest) (*InstallSnapshotResponse, error) +} + +// UnimplementedRaftRPCServer should 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 UnimplementedRaftRPCServer struct{} + +func (UnimplementedRaftRPCServer) AppendEntries(context.Context, *AppendEntriesRequest) (*AppendEntriesResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method AppendEntries not implemented") +} +func (UnimplementedRaftRPCServer) Vote(context.Context, *VoteRequest) (*VoteResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Vote not implemented") +} +func (UnimplementedRaftRPCServer) InstallSnapshot(context.Context, *InstallSnapshotRequest) (*InstallSnapshotResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method InstallSnapshot not implemented") +} +func (UnimplementedRaftRPCServer) testEmbeddedByValue() {} + +// UnsafeRaftRPCServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to RaftRPCServer will +// result in compilation errors. +type UnsafeRaftRPCServer interface { + mustEmbedUnimplementedRaftRPCServer() +} + +func RegisterRaftRPCServer(s grpc.ServiceRegistrar, srv RaftRPCServer) { + // If the following call pancis, it indicates UnimplementedRaftRPCServer 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(&RaftRPC_ServiceDesc, srv) +} + +func _RaftRPC_AppendEntries_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(AppendEntriesRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(RaftRPCServer).AppendEntries(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: RaftRPC_AppendEntries_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(RaftRPCServer).AppendEntries(ctx, req.(*AppendEntriesRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _RaftRPC_Vote_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(VoteRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(RaftRPCServer).Vote(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: RaftRPC_Vote_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(RaftRPCServer).Vote(ctx, req.(*VoteRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _RaftRPC_InstallSnapshot_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(InstallSnapshotRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(RaftRPCServer).InstallSnapshot(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: RaftRPC_InstallSnapshot_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(RaftRPCServer).InstallSnapshot(ctx, req.(*InstallSnapshotRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// RaftRPC_ServiceDesc is the grpc.ServiceDesc for RaftRPC service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var RaftRPC_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "raft.RaftRPC", + HandlerType: (*RaftRPCServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "AppendEntries", + Handler: _RaftRPC_AppendEntries_Handler, + }, + { + MethodName: "Vote", + Handler: _RaftRPC_Vote_Handler, + }, + { + MethodName: "InstallSnapshot", + Handler: _RaftRPC_InstallSnapshot_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "raft.proto", +} diff --git a/sdk/go/aetherpb/session.pb.go b/sdk/go/aetherpb/session.pb.go new file mode 100644 index 0000000..c86dfca --- /dev/null +++ b/sdk/go/aetherpb/session.pb.go @@ -0,0 +1,548 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.6 +// protoc v6.32.0 +// source: session.proto + +package aetherpb + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + 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 SessionCreateRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // ttl is the requested time-to-live in seconds. + // The server may grant a shorter TTL (timeout negotiation). + Ttl int64 `protobuf:"varint,1,opt,name=ttl,proto3" json:"ttl,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SessionCreateRequest) Reset() { + *x = SessionCreateRequest{} + mi := &file_session_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SessionCreateRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SessionCreateRequest) ProtoMessage() {} + +func (x *SessionCreateRequest) ProtoReflect() protoreflect.Message { + mi := &file_session_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 SessionCreateRequest.ProtoReflect.Descriptor instead. +func (*SessionCreateRequest) Descriptor() ([]byte, []int) { + return file_session_proto_rawDescGZIP(), []int{0} +} + +func (x *SessionCreateRequest) GetTtl() int64 { + if x != nil { + return x.Ttl + } + return 0 +} + +type SessionCreateResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` + // id is the session identifier (same as the underlying lease ID). + Id int64 `protobuf:"varint,2,opt,name=id,proto3" json:"id,omitempty"` + // granted_ttl is the actual TTL granted by the server (in seconds). + // This may be shorter than the requested TTL. + GrantedTtl int64 `protobuf:"varint,3,opt,name=granted_ttl,json=grantedTtl,proto3" json:"granted_ttl,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SessionCreateResponse) Reset() { + *x = SessionCreateResponse{} + mi := &file_session_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SessionCreateResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SessionCreateResponse) ProtoMessage() {} + +func (x *SessionCreateResponse) ProtoReflect() protoreflect.Message { + mi := &file_session_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 SessionCreateResponse.ProtoReflect.Descriptor instead. +func (*SessionCreateResponse) Descriptor() ([]byte, []int) { + return file_session_proto_rawDescGZIP(), []int{1} +} + +func (x *SessionCreateResponse) GetHeader() *ResponseHeader { + if x != nil { + return x.Header + } + return nil +} + +func (x *SessionCreateResponse) GetId() int64 { + if x != nil { + return x.Id + } + return 0 +} + +func (x *SessionCreateResponse) GetGrantedTtl() int64 { + if x != nil { + return x.GrantedTtl + } + return 0 +} + +type SessionCloseRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // id is the session to close. + Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SessionCloseRequest) Reset() { + *x = SessionCloseRequest{} + mi := &file_session_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SessionCloseRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SessionCloseRequest) ProtoMessage() {} + +func (x *SessionCloseRequest) ProtoReflect() protoreflect.Message { + mi := &file_session_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 SessionCloseRequest.ProtoReflect.Descriptor instead. +func (*SessionCloseRequest) Descriptor() ([]byte, []int) { + return file_session_proto_rawDescGZIP(), []int{2} +} + +func (x *SessionCloseRequest) GetId() int64 { + if x != nil { + return x.Id + } + return 0 +} + +type SessionCloseResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SessionCloseResponse) Reset() { + *x = SessionCloseResponse{} + mi := &file_session_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SessionCloseResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SessionCloseResponse) ProtoMessage() {} + +func (x *SessionCloseResponse) ProtoReflect() protoreflect.Message { + mi := &file_session_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 SessionCloseResponse.ProtoReflect.Descriptor instead. +func (*SessionCloseResponse) Descriptor() ([]byte, []int) { + return file_session_proto_rawDescGZIP(), []int{3} +} + +func (x *SessionCloseResponse) GetHeader() *ResponseHeader { + if x != nil { + return x.Header + } + return nil +} + +type SessionKeepAliveRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // id is the session to keep alive. + Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SessionKeepAliveRequest) Reset() { + *x = SessionKeepAliveRequest{} + mi := &file_session_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SessionKeepAliveRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SessionKeepAliveRequest) ProtoMessage() {} + +func (x *SessionKeepAliveRequest) ProtoReflect() protoreflect.Message { + mi := &file_session_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 SessionKeepAliveRequest.ProtoReflect.Descriptor instead. +func (*SessionKeepAliveRequest) Descriptor() ([]byte, []int) { + return file_session_proto_rawDescGZIP(), []int{4} +} + +func (x *SessionKeepAliveRequest) GetId() int64 { + if x != nil { + return x.Id + } + return 0 +} + +type SessionKeepAliveResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` + // ttl is the remaining TTL in seconds after the keep alive. + Ttl int64 `protobuf:"varint,2,opt,name=ttl,proto3" json:"ttl,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SessionKeepAliveResponse) Reset() { + *x = SessionKeepAliveResponse{} + mi := &file_session_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SessionKeepAliveResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SessionKeepAliveResponse) ProtoMessage() {} + +func (x *SessionKeepAliveResponse) ProtoReflect() protoreflect.Message { + mi := &file_session_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 SessionKeepAliveResponse.ProtoReflect.Descriptor instead. +func (*SessionKeepAliveResponse) Descriptor() ([]byte, []int) { + return file_session_proto_rawDescGZIP(), []int{5} +} + +func (x *SessionKeepAliveResponse) GetHeader() *ResponseHeader { + if x != nil { + return x.Header + } + return nil +} + +func (x *SessionKeepAliveResponse) GetTtl() int64 { + if x != nil { + return x.Ttl + } + return 0 +} + +type SessionQueryRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // id is the session to query. + Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SessionQueryRequest) Reset() { + *x = SessionQueryRequest{} + mi := &file_session_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SessionQueryRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SessionQueryRequest) ProtoMessage() {} + +func (x *SessionQueryRequest) ProtoReflect() protoreflect.Message { + mi := &file_session_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 SessionQueryRequest.ProtoReflect.Descriptor instead. +func (*SessionQueryRequest) Descriptor() ([]byte, []int) { + return file_session_proto_rawDescGZIP(), []int{6} +} + +func (x *SessionQueryRequest) GetId() int64 { + if x != nil { + return x.Id + } + return 0 +} + +type SessionQueryResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` + // id is the session identifier. + Id int64 `protobuf:"varint,2,opt,name=id,proto3" json:"id,omitempty"` + // ttl is the remaining TTL in seconds. + Ttl int64 `protobuf:"varint,3,opt,name=ttl,proto3" json:"ttl,omitempty"` + // granted_ttl is the originally granted TTL in seconds. + GrantedTtl int64 `protobuf:"varint,4,opt,name=granted_ttl,json=grantedTtl,proto3" json:"granted_ttl,omitempty"` + // keys is the number of keys attached to this session. + Keys int64 `protobuf:"varint,5,opt,name=keys,proto3" json:"keys,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SessionQueryResponse) Reset() { + *x = SessionQueryResponse{} + mi := &file_session_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SessionQueryResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SessionQueryResponse) ProtoMessage() {} + +func (x *SessionQueryResponse) ProtoReflect() protoreflect.Message { + mi := &file_session_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 SessionQueryResponse.ProtoReflect.Descriptor instead. +func (*SessionQueryResponse) Descriptor() ([]byte, []int) { + return file_session_proto_rawDescGZIP(), []int{7} +} + +func (x *SessionQueryResponse) GetHeader() *ResponseHeader { + if x != nil { + return x.Header + } + return nil +} + +func (x *SessionQueryResponse) GetId() int64 { + if x != nil { + return x.Id + } + return 0 +} + +func (x *SessionQueryResponse) GetTtl() int64 { + if x != nil { + return x.Ttl + } + return 0 +} + +func (x *SessionQueryResponse) GetGrantedTtl() int64 { + if x != nil { + return x.GrantedTtl + } + return 0 +} + +func (x *SessionQueryResponse) GetKeys() int64 { + if x != nil { + return x.Keys + } + return 0 +} + +var File_session_proto protoreflect.FileDescriptor + +const file_session_proto_rawDesc = "" + + "\n" + + "\rsession.proto\x12\x06aether\x1a\fcommon.proto\"(\n" + + "\x14SessionCreateRequest\x12\x10\n" + + "\x03ttl\x18\x01 \x01(\x03R\x03ttl\"x\n" + + "\x15SessionCreateResponse\x12.\n" + + "\x06header\x18\x01 \x01(\v2\x16.aether.ResponseHeaderR\x06header\x12\x0e\n" + + "\x02id\x18\x02 \x01(\x03R\x02id\x12\x1f\n" + + "\vgranted_ttl\x18\x03 \x01(\x03R\n" + + "grantedTtl\"%\n" + + "\x13SessionCloseRequest\x12\x0e\n" + + "\x02id\x18\x01 \x01(\x03R\x02id\"F\n" + + "\x14SessionCloseResponse\x12.\n" + + "\x06header\x18\x01 \x01(\v2\x16.aether.ResponseHeaderR\x06header\")\n" + + "\x17SessionKeepAliveRequest\x12\x0e\n" + + "\x02id\x18\x01 \x01(\x03R\x02id\"\\\n" + + "\x18SessionKeepAliveResponse\x12.\n" + + "\x06header\x18\x01 \x01(\v2\x16.aether.ResponseHeaderR\x06header\x12\x10\n" + + "\x03ttl\x18\x02 \x01(\x03R\x03ttl\"%\n" + + "\x13SessionQueryRequest\x12\x0e\n" + + "\x02id\x18\x01 \x01(\x03R\x02id\"\x9d\x01\n" + + "\x14SessionQueryResponse\x12.\n" + + "\x06header\x18\x01 \x01(\v2\x16.aether.ResponseHeaderR\x06header\x12\x0e\n" + + "\x02id\x18\x02 \x01(\x03R\x02id\x12\x10\n" + + "\x03ttl\x18\x03 \x01(\x03R\x03ttl\x12\x1f\n" + + "\vgranted_ttl\x18\x04 \x01(\x03R\n" + + "grantedTtl\x12\x12\n" + + "\x04keys\x18\x05 \x01(\x03R\x04keys2\xb2\x02\n" + + "\rAetherSession\x12E\n" + + "\x06Create\x12\x1c.aether.SessionCreateRequest\x1a\x1d.aether.SessionCreateResponse\x12B\n" + + "\x05Close\x12\x1b.aether.SessionCloseRequest\x1a\x1c.aether.SessionCloseResponse\x12R\n" + + "\tKeepAlive\x12\x1f.aether.SessionKeepAliveRequest\x1a .aether.SessionKeepAliveResponse(\x010\x01\x12B\n" + + "\x05Query\x12\x1b.aether.SessionQueryRequest\x1a\x1c.aether.SessionQueryResponseB-Z+github.com/aether-io/aether/sdk/go/aetherpbb\x06proto3" + +var ( + file_session_proto_rawDescOnce sync.Once + file_session_proto_rawDescData []byte +) + +func file_session_proto_rawDescGZIP() []byte { + file_session_proto_rawDescOnce.Do(func() { + file_session_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_session_proto_rawDesc), len(file_session_proto_rawDesc))) + }) + return file_session_proto_rawDescData +} + +var file_session_proto_msgTypes = make([]protoimpl.MessageInfo, 8) +var file_session_proto_goTypes = []any{ + (*SessionCreateRequest)(nil), // 0: aether.SessionCreateRequest + (*SessionCreateResponse)(nil), // 1: aether.SessionCreateResponse + (*SessionCloseRequest)(nil), // 2: aether.SessionCloseRequest + (*SessionCloseResponse)(nil), // 3: aether.SessionCloseResponse + (*SessionKeepAliveRequest)(nil), // 4: aether.SessionKeepAliveRequest + (*SessionKeepAliveResponse)(nil), // 5: aether.SessionKeepAliveResponse + (*SessionQueryRequest)(nil), // 6: aether.SessionQueryRequest + (*SessionQueryResponse)(nil), // 7: aether.SessionQueryResponse + (*ResponseHeader)(nil), // 8: aether.ResponseHeader +} +var file_session_proto_depIdxs = []int32{ + 8, // 0: aether.SessionCreateResponse.header:type_name -> aether.ResponseHeader + 8, // 1: aether.SessionCloseResponse.header:type_name -> aether.ResponseHeader + 8, // 2: aether.SessionKeepAliveResponse.header:type_name -> aether.ResponseHeader + 8, // 3: aether.SessionQueryResponse.header:type_name -> aether.ResponseHeader + 0, // 4: aether.AetherSession.Create:input_type -> aether.SessionCreateRequest + 2, // 5: aether.AetherSession.Close:input_type -> aether.SessionCloseRequest + 4, // 6: aether.AetherSession.KeepAlive:input_type -> aether.SessionKeepAliveRequest + 6, // 7: aether.AetherSession.Query:input_type -> aether.SessionQueryRequest + 1, // 8: aether.AetherSession.Create:output_type -> aether.SessionCreateResponse + 3, // 9: aether.AetherSession.Close:output_type -> aether.SessionCloseResponse + 5, // 10: aether.AetherSession.KeepAlive:output_type -> aether.SessionKeepAliveResponse + 7, // 11: aether.AetherSession.Query:output_type -> aether.SessionQueryResponse + 8, // [8:12] is the sub-list for method output_type + 4, // [4:8] is the sub-list for method input_type + 4, // [4:4] is the sub-list for extension type_name + 4, // [4:4] is the sub-list for extension extendee + 0, // [0:4] is the sub-list for field type_name +} + +func init() { file_session_proto_init() } +func file_session_proto_init() { + if File_session_proto != nil { + return + } + file_common_proto_init() + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_session_proto_rawDesc), len(file_session_proto_rawDesc)), + NumEnums: 0, + NumMessages: 8, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_session_proto_goTypes, + DependencyIndexes: file_session_proto_depIdxs, + MessageInfos: file_session_proto_msgTypes, + }.Build() + File_session_proto = out.File + file_session_proto_goTypes = nil + file_session_proto_depIdxs = nil +} diff --git a/sdk/go/aetherpb/session_grpc.pb.go b/sdk/go/aetherpb/session_grpc.pb.go new file mode 100644 index 0000000..4ad97f8 --- /dev/null +++ b/sdk/go/aetherpb/session_grpc.pb.go @@ -0,0 +1,256 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.5.1 +// - protoc v6.32.0 +// source: session.proto + +package aetherpb + +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 ( + AetherSession_Create_FullMethodName = "/aether.AetherSession/Create" + AetherSession_Close_FullMethodName = "/aether.AetherSession/Close" + AetherSession_KeepAlive_FullMethodName = "/aether.AetherSession/KeepAlive" + AetherSession_Query_FullMethodName = "/aether.AetherSession/Query" +) + +// AetherSessionClient is the client API for AetherSession 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. +// +// AetherSession provides session management with timeout negotiation. +// A session is a higher-level abstraction over leases: it creates a lease +// with a negotiated TTL and provides session-scoped lifecycle management. +// When a session expires or is closed, all keys attached to the session +// are automatically deleted. +type AetherSessionClient interface { + // Create creates a new session with the requested TTL. + // The server may adjust the TTL (timeout negotiation) — the actual + // granted TTL is returned in the response. + Create(ctx context.Context, in *SessionCreateRequest, opts ...grpc.CallOption) (*SessionCreateResponse, error) + // Close closes a session and deletes all attached keys. + Close(ctx context.Context, in *SessionCloseRequest, opts ...grpc.CallOption) (*SessionCloseResponse, error) + // KeepAlive maintains the session by refreshing its TTL. + // The client should send periodic KeepAlive requests at TTL/3 frequency. + // The server responds with the remaining TTL. + KeepAlive(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[SessionKeepAliveRequest, SessionKeepAliveResponse], error) + // Query returns information about a session. + Query(ctx context.Context, in *SessionQueryRequest, opts ...grpc.CallOption) (*SessionQueryResponse, error) +} + +type aetherSessionClient struct { + cc grpc.ClientConnInterface +} + +func NewAetherSessionClient(cc grpc.ClientConnInterface) AetherSessionClient { + return &aetherSessionClient{cc} +} + +func (c *aetherSessionClient) Create(ctx context.Context, in *SessionCreateRequest, opts ...grpc.CallOption) (*SessionCreateResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(SessionCreateResponse) + err := c.cc.Invoke(ctx, AetherSession_Create_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *aetherSessionClient) Close(ctx context.Context, in *SessionCloseRequest, opts ...grpc.CallOption) (*SessionCloseResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(SessionCloseResponse) + err := c.cc.Invoke(ctx, AetherSession_Close_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *aetherSessionClient) KeepAlive(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[SessionKeepAliveRequest, SessionKeepAliveResponse], error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + stream, err := c.cc.NewStream(ctx, &AetherSession_ServiceDesc.Streams[0], AetherSession_KeepAlive_FullMethodName, cOpts...) + if err != nil { + return nil, err + } + x := &grpc.GenericClientStream[SessionKeepAliveRequest, SessionKeepAliveResponse]{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 AetherSession_KeepAliveClient = grpc.BidiStreamingClient[SessionKeepAliveRequest, SessionKeepAliveResponse] + +func (c *aetherSessionClient) Query(ctx context.Context, in *SessionQueryRequest, opts ...grpc.CallOption) (*SessionQueryResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(SessionQueryResponse) + err := c.cc.Invoke(ctx, AetherSession_Query_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +// AetherSessionServer is the server API for AetherSession service. +// All implementations should embed UnimplementedAetherSessionServer +// for forward compatibility. +// +// AetherSession provides session management with timeout negotiation. +// A session is a higher-level abstraction over leases: it creates a lease +// with a negotiated TTL and provides session-scoped lifecycle management. +// When a session expires or is closed, all keys attached to the session +// are automatically deleted. +type AetherSessionServer interface { + // Create creates a new session with the requested TTL. + // The server may adjust the TTL (timeout negotiation) — the actual + // granted TTL is returned in the response. + Create(context.Context, *SessionCreateRequest) (*SessionCreateResponse, error) + // Close closes a session and deletes all attached keys. + Close(context.Context, *SessionCloseRequest) (*SessionCloseResponse, error) + // KeepAlive maintains the session by refreshing its TTL. + // The client should send periodic KeepAlive requests at TTL/3 frequency. + // The server responds with the remaining TTL. + KeepAlive(grpc.BidiStreamingServer[SessionKeepAliveRequest, SessionKeepAliveResponse]) error + // Query returns information about a session. + Query(context.Context, *SessionQueryRequest) (*SessionQueryResponse, error) +} + +// UnimplementedAetherSessionServer should 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 UnimplementedAetherSessionServer struct{} + +func (UnimplementedAetherSessionServer) Create(context.Context, *SessionCreateRequest) (*SessionCreateResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Create not implemented") +} +func (UnimplementedAetherSessionServer) Close(context.Context, *SessionCloseRequest) (*SessionCloseResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Close not implemented") +} +func (UnimplementedAetherSessionServer) KeepAlive(grpc.BidiStreamingServer[SessionKeepAliveRequest, SessionKeepAliveResponse]) error { + return status.Errorf(codes.Unimplemented, "method KeepAlive not implemented") +} +func (UnimplementedAetherSessionServer) Query(context.Context, *SessionQueryRequest) (*SessionQueryResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Query not implemented") +} +func (UnimplementedAetherSessionServer) testEmbeddedByValue() {} + +// UnsafeAetherSessionServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to AetherSessionServer will +// result in compilation errors. +type UnsafeAetherSessionServer interface { + mustEmbedUnimplementedAetherSessionServer() +} + +func RegisterAetherSessionServer(s grpc.ServiceRegistrar, srv AetherSessionServer) { + // If the following call pancis, it indicates UnimplementedAetherSessionServer 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(&AetherSession_ServiceDesc, srv) +} + +func _AetherSession_Create_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(SessionCreateRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AetherSessionServer).Create(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: AetherSession_Create_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AetherSessionServer).Create(ctx, req.(*SessionCreateRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _AetherSession_Close_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(SessionCloseRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AetherSessionServer).Close(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: AetherSession_Close_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AetherSessionServer).Close(ctx, req.(*SessionCloseRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _AetherSession_KeepAlive_Handler(srv interface{}, stream grpc.ServerStream) error { + return srv.(AetherSessionServer).KeepAlive(&grpc.GenericServerStream[SessionKeepAliveRequest, SessionKeepAliveResponse]{ServerStream: stream}) +} + +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type AetherSession_KeepAliveServer = grpc.BidiStreamingServer[SessionKeepAliveRequest, SessionKeepAliveResponse] + +func _AetherSession_Query_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(SessionQueryRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AetherSessionServer).Query(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: AetherSession_Query_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AetherSessionServer).Query(ctx, req.(*SessionQueryRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// AetherSession_ServiceDesc is the grpc.ServiceDesc for AetherSession service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var AetherSession_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "aether.AetherSession", + HandlerType: (*AetherSessionServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Create", + Handler: _AetherSession_Create_Handler, + }, + { + MethodName: "Close", + Handler: _AetherSession_Close_Handler, + }, + { + MethodName: "Query", + Handler: _AetherSession_Query_Handler, + }, + }, + Streams: []grpc.StreamDesc{ + { + StreamName: "KeepAlive", + Handler: _AetherSession_KeepAlive_Handler, + ServerStreams: true, + ClientStreams: true, + }, + }, + Metadata: "session.proto", +} diff --git a/sdk/go/aetherpb/shard.pb.go b/sdk/go/aetherpb/shard.pb.go new file mode 100644 index 0000000..517b0b6 --- /dev/null +++ b/sdk/go/aetherpb/shard.pb.go @@ -0,0 +1,561 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.6 +// protoc v6.32.0 +// source: shard.proto + +package aetherpb + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + 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 GetRegionRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Key []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetRegionRequest) Reset() { + *x = GetRegionRequest{} + mi := &file_shard_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetRegionRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetRegionRequest) ProtoMessage() {} + +func (x *GetRegionRequest) ProtoReflect() protoreflect.Message { + mi := &file_shard_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 GetRegionRequest.ProtoReflect.Descriptor instead. +func (*GetRegionRequest) Descriptor() ([]byte, []int) { + return file_shard_proto_rawDescGZIP(), []int{0} +} + +func (x *GetRegionRequest) GetKey() []byte { + if x != nil { + return x.Key + } + return nil +} + +type GetRegionResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` + Region *Region `protobuf:"bytes,2,opt,name=region,proto3" json:"region,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetRegionResponse) Reset() { + *x = GetRegionResponse{} + mi := &file_shard_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetRegionResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetRegionResponse) ProtoMessage() {} + +func (x *GetRegionResponse) ProtoReflect() protoreflect.Message { + mi := &file_shard_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 GetRegionResponse.ProtoReflect.Descriptor instead. +func (*GetRegionResponse) Descriptor() ([]byte, []int) { + return file_shard_proto_rawDescGZIP(), []int{1} +} + +func (x *GetRegionResponse) GetHeader() *ResponseHeader { + if x != nil { + return x.Header + } + return nil +} + +func (x *GetRegionResponse) GetRegion() *Region { + if x != nil { + return x.Region + } + return nil +} + +type ListRegionsRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ListRegionsRequest) Reset() { + *x = ListRegionsRequest{} + mi := &file_shard_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListRegionsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListRegionsRequest) ProtoMessage() {} + +func (x *ListRegionsRequest) ProtoReflect() protoreflect.Message { + mi := &file_shard_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 ListRegionsRequest.ProtoReflect.Descriptor instead. +func (*ListRegionsRequest) Descriptor() ([]byte, []int) { + return file_shard_proto_rawDescGZIP(), []int{2} +} + +type ListRegionsResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` + Regions []*Region `protobuf:"bytes,2,rep,name=regions,proto3" json:"regions,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ListRegionsResponse) Reset() { + *x = ListRegionsResponse{} + mi := &file_shard_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListRegionsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListRegionsResponse) ProtoMessage() {} + +func (x *ListRegionsResponse) ProtoReflect() protoreflect.Message { + mi := &file_shard_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 ListRegionsResponse.ProtoReflect.Descriptor instead. +func (*ListRegionsResponse) Descriptor() ([]byte, []int) { + return file_shard_proto_rawDescGZIP(), []int{3} +} + +func (x *ListRegionsResponse) GetHeader() *ResponseHeader { + if x != nil { + return x.Header + } + return nil +} + +func (x *ListRegionsResponse) GetRegions() []*Region { + if x != nil { + return x.Regions + } + return nil +} + +type SplitRegionRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + RegionId uint64 `protobuf:"varint,1,opt,name=region_id,json=regionId,proto3" json:"region_id,omitempty"` + SplitKey []byte `protobuf:"bytes,2,opt,name=split_key,json=splitKey,proto3" json:"split_key,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SplitRegionRequest) Reset() { + *x = SplitRegionRequest{} + mi := &file_shard_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SplitRegionRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SplitRegionRequest) ProtoMessage() {} + +func (x *SplitRegionRequest) ProtoReflect() protoreflect.Message { + mi := &file_shard_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 SplitRegionRequest.ProtoReflect.Descriptor instead. +func (*SplitRegionRequest) Descriptor() ([]byte, []int) { + return file_shard_proto_rawDescGZIP(), []int{4} +} + +func (x *SplitRegionRequest) GetRegionId() uint64 { + if x != nil { + return x.RegionId + } + return 0 +} + +func (x *SplitRegionRequest) GetSplitKey() []byte { + if x != nil { + return x.SplitKey + } + return nil +} + +type SplitRegionResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Header *ResponseHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` + Parent *Region `protobuf:"bytes,2,opt,name=parent,proto3" json:"parent,omitempty"` + Child *Region `protobuf:"bytes,3,opt,name=child,proto3" json:"child,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SplitRegionResponse) Reset() { + *x = SplitRegionResponse{} + mi := &file_shard_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SplitRegionResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SplitRegionResponse) ProtoMessage() {} + +func (x *SplitRegionResponse) ProtoReflect() protoreflect.Message { + mi := &file_shard_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 SplitRegionResponse.ProtoReflect.Descriptor instead. +func (*SplitRegionResponse) Descriptor() ([]byte, []int) { + return file_shard_proto_rawDescGZIP(), []int{5} +} + +func (x *SplitRegionResponse) GetHeader() *ResponseHeader { + if x != nil { + return x.Header + } + return nil +} + +func (x *SplitRegionResponse) GetParent() *Region { + if x != nil { + return x.Parent + } + return nil +} + +func (x *SplitRegionResponse) GetChild() *Region { + if x != nil { + return x.Child + } + return nil +} + +type Region struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + StartKey []byte `protobuf:"bytes,2,opt,name=start_key,json=startKey,proto3" json:"start_key,omitempty"` + EndKey []byte `protobuf:"bytes,3,opt,name=end_key,json=endKey,proto3" json:"end_key,omitempty"` + RegionEpoch *RegionEpoch `protobuf:"bytes,4,opt,name=region_epoch,json=regionEpoch,proto3" json:"region_epoch,omitempty"` + Leader uint64 `protobuf:"varint,5,opt,name=leader,proto3" json:"leader,omitempty"` + Replicas []uint64 `protobuf:"varint,6,rep,packed,name=replicas,proto3" json:"replicas,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Region) Reset() { + *x = Region{} + mi := &file_shard_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Region) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Region) ProtoMessage() {} + +func (x *Region) ProtoReflect() protoreflect.Message { + mi := &file_shard_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 Region.ProtoReflect.Descriptor instead. +func (*Region) Descriptor() ([]byte, []int) { + return file_shard_proto_rawDescGZIP(), []int{6} +} + +func (x *Region) GetId() uint64 { + if x != nil { + return x.Id + } + return 0 +} + +func (x *Region) GetStartKey() []byte { + if x != nil { + return x.StartKey + } + return nil +} + +func (x *Region) GetEndKey() []byte { + if x != nil { + return x.EndKey + } + return nil +} + +func (x *Region) GetRegionEpoch() *RegionEpoch { + if x != nil { + return x.RegionEpoch + } + return nil +} + +func (x *Region) GetLeader() uint64 { + if x != nil { + return x.Leader + } + return 0 +} + +func (x *Region) GetReplicas() []uint64 { + if x != nil { + return x.Replicas + } + return nil +} + +type RegionEpoch struct { + state protoimpl.MessageState `protogen:"open.v1"` + ConfVer uint64 `protobuf:"varint,1,opt,name=conf_ver,json=confVer,proto3" json:"conf_ver,omitempty"` + Version uint64 `protobuf:"varint,2,opt,name=version,proto3" json:"version,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RegionEpoch) Reset() { + *x = RegionEpoch{} + mi := &file_shard_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RegionEpoch) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RegionEpoch) ProtoMessage() {} + +func (x *RegionEpoch) ProtoReflect() protoreflect.Message { + mi := &file_shard_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 RegionEpoch.ProtoReflect.Descriptor instead. +func (*RegionEpoch) Descriptor() ([]byte, []int) { + return file_shard_proto_rawDescGZIP(), []int{7} +} + +func (x *RegionEpoch) GetConfVer() uint64 { + if x != nil { + return x.ConfVer + } + return 0 +} + +func (x *RegionEpoch) GetVersion() uint64 { + if x != nil { + return x.Version + } + return 0 +} + +var File_shard_proto protoreflect.FileDescriptor + +const file_shard_proto_rawDesc = "" + + "\n" + + "\vshard.proto\x12\x06aether\x1a\fcommon.proto\"$\n" + + "\x10GetRegionRequest\x12\x10\n" + + "\x03key\x18\x01 \x01(\fR\x03key\"k\n" + + "\x11GetRegionResponse\x12.\n" + + "\x06header\x18\x01 \x01(\v2\x16.aether.ResponseHeaderR\x06header\x12&\n" + + "\x06region\x18\x02 \x01(\v2\x0e.aether.RegionR\x06region\"\x14\n" + + "\x12ListRegionsRequest\"o\n" + + "\x13ListRegionsResponse\x12.\n" + + "\x06header\x18\x01 \x01(\v2\x16.aether.ResponseHeaderR\x06header\x12(\n" + + "\aregions\x18\x02 \x03(\v2\x0e.aether.RegionR\aregions\"N\n" + + "\x12SplitRegionRequest\x12\x1b\n" + + "\tregion_id\x18\x01 \x01(\x04R\bregionId\x12\x1b\n" + + "\tsplit_key\x18\x02 \x01(\fR\bsplitKey\"\x93\x01\n" + + "\x13SplitRegionResponse\x12.\n" + + "\x06header\x18\x01 \x01(\v2\x16.aether.ResponseHeaderR\x06header\x12&\n" + + "\x06parent\x18\x02 \x01(\v2\x0e.aether.RegionR\x06parent\x12$\n" + + "\x05child\x18\x03 \x01(\v2\x0e.aether.RegionR\x05child\"\xba\x01\n" + + "\x06Region\x12\x0e\n" + + "\x02id\x18\x01 \x01(\x04R\x02id\x12\x1b\n" + + "\tstart_key\x18\x02 \x01(\fR\bstartKey\x12\x17\n" + + "\aend_key\x18\x03 \x01(\fR\x06endKey\x126\n" + + "\fregion_epoch\x18\x04 \x01(\v2\x13.aether.RegionEpochR\vregionEpoch\x12\x16\n" + + "\x06leader\x18\x05 \x01(\x04R\x06leader\x12\x1a\n" + + "\breplicas\x18\x06 \x03(\x04R\breplicas\"B\n" + + "\vRegionEpoch\x12\x19\n" + + "\bconf_ver\x18\x01 \x01(\x04R\aconfVer\x12\x18\n" + + "\aversion\x18\x02 \x01(\x04R\aversion2\xdf\x01\n" + + "\vAetherShard\x12@\n" + + "\tGetRegion\x12\x18.aether.GetRegionRequest\x1a\x19.aether.GetRegionResponse\x12F\n" + + "\vListRegions\x12\x1a.aether.ListRegionsRequest\x1a\x1b.aether.ListRegionsResponse\x12F\n" + + "\vSplitRegion\x12\x1a.aether.SplitRegionRequest\x1a\x1b.aether.SplitRegionResponseB-Z+github.com/aether-io/aether/sdk/go/aetherpbb\x06proto3" + +var ( + file_shard_proto_rawDescOnce sync.Once + file_shard_proto_rawDescData []byte +) + +func file_shard_proto_rawDescGZIP() []byte { + file_shard_proto_rawDescOnce.Do(func() { + file_shard_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_shard_proto_rawDesc), len(file_shard_proto_rawDesc))) + }) + return file_shard_proto_rawDescData +} + +var file_shard_proto_msgTypes = make([]protoimpl.MessageInfo, 8) +var file_shard_proto_goTypes = []any{ + (*GetRegionRequest)(nil), // 0: aether.GetRegionRequest + (*GetRegionResponse)(nil), // 1: aether.GetRegionResponse + (*ListRegionsRequest)(nil), // 2: aether.ListRegionsRequest + (*ListRegionsResponse)(nil), // 3: aether.ListRegionsResponse + (*SplitRegionRequest)(nil), // 4: aether.SplitRegionRequest + (*SplitRegionResponse)(nil), // 5: aether.SplitRegionResponse + (*Region)(nil), // 6: aether.Region + (*RegionEpoch)(nil), // 7: aether.RegionEpoch + (*ResponseHeader)(nil), // 8: aether.ResponseHeader +} +var file_shard_proto_depIdxs = []int32{ + 8, // 0: aether.GetRegionResponse.header:type_name -> aether.ResponseHeader + 6, // 1: aether.GetRegionResponse.region:type_name -> aether.Region + 8, // 2: aether.ListRegionsResponse.header:type_name -> aether.ResponseHeader + 6, // 3: aether.ListRegionsResponse.regions:type_name -> aether.Region + 8, // 4: aether.SplitRegionResponse.header:type_name -> aether.ResponseHeader + 6, // 5: aether.SplitRegionResponse.parent:type_name -> aether.Region + 6, // 6: aether.SplitRegionResponse.child:type_name -> aether.Region + 7, // 7: aether.Region.region_epoch:type_name -> aether.RegionEpoch + 0, // 8: aether.AetherShard.GetRegion:input_type -> aether.GetRegionRequest + 2, // 9: aether.AetherShard.ListRegions:input_type -> aether.ListRegionsRequest + 4, // 10: aether.AetherShard.SplitRegion:input_type -> aether.SplitRegionRequest + 1, // 11: aether.AetherShard.GetRegion:output_type -> aether.GetRegionResponse + 3, // 12: aether.AetherShard.ListRegions:output_type -> aether.ListRegionsResponse + 5, // 13: aether.AetherShard.SplitRegion:output_type -> aether.SplitRegionResponse + 11, // [11:14] is the sub-list for method output_type + 8, // [8:11] 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_shard_proto_init() } +func file_shard_proto_init() { + if File_shard_proto != nil { + return + } + file_common_proto_init() + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_shard_proto_rawDesc), len(file_shard_proto_rawDesc)), + NumEnums: 0, + NumMessages: 8, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_shard_proto_goTypes, + DependencyIndexes: file_shard_proto_depIdxs, + MessageInfos: file_shard_proto_msgTypes, + }.Build() + File_shard_proto = out.File + file_shard_proto_goTypes = nil + file_shard_proto_depIdxs = nil +} diff --git a/sdk/go/aetherpb/shard_grpc.pb.go b/sdk/go/aetherpb/shard_grpc.pb.go new file mode 100644 index 0000000..e73d6f9 --- /dev/null +++ b/sdk/go/aetherpb/shard_grpc.pb.go @@ -0,0 +1,201 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.5.1 +// - protoc v6.32.0 +// source: shard.proto + +package aetherpb + +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 ( + AetherShard_GetRegion_FullMethodName = "/aether.AetherShard/GetRegion" + AetherShard_ListRegions_FullMethodName = "/aether.AetherShard/ListRegions" + AetherShard_SplitRegion_FullMethodName = "/aether.AetherShard/SplitRegion" +) + +// AetherShardClient is the client API for AetherShard service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type AetherShardClient interface { + // GetRegion returns the region that owns the given key. + GetRegion(ctx context.Context, in *GetRegionRequest, opts ...grpc.CallOption) (*GetRegionResponse, error) + // ListRegions returns all regions in the cluster. + ListRegions(ctx context.Context, in *ListRegionsRequest, opts ...grpc.CallOption) (*ListRegionsResponse, error) + // SplitRegion splits a region at the given split key. + SplitRegion(ctx context.Context, in *SplitRegionRequest, opts ...grpc.CallOption) (*SplitRegionResponse, error) +} + +type aetherShardClient struct { + cc grpc.ClientConnInterface +} + +func NewAetherShardClient(cc grpc.ClientConnInterface) AetherShardClient { + return &aetherShardClient{cc} +} + +func (c *aetherShardClient) GetRegion(ctx context.Context, in *GetRegionRequest, opts ...grpc.CallOption) (*GetRegionResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(GetRegionResponse) + err := c.cc.Invoke(ctx, AetherShard_GetRegion_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *aetherShardClient) ListRegions(ctx context.Context, in *ListRegionsRequest, opts ...grpc.CallOption) (*ListRegionsResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(ListRegionsResponse) + err := c.cc.Invoke(ctx, AetherShard_ListRegions_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *aetherShardClient) SplitRegion(ctx context.Context, in *SplitRegionRequest, opts ...grpc.CallOption) (*SplitRegionResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(SplitRegionResponse) + err := c.cc.Invoke(ctx, AetherShard_SplitRegion_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +// AetherShardServer is the server API for AetherShard service. +// All implementations should embed UnimplementedAetherShardServer +// for forward compatibility. +type AetherShardServer interface { + // GetRegion returns the region that owns the given key. + GetRegion(context.Context, *GetRegionRequest) (*GetRegionResponse, error) + // ListRegions returns all regions in the cluster. + ListRegions(context.Context, *ListRegionsRequest) (*ListRegionsResponse, error) + // SplitRegion splits a region at the given split key. + SplitRegion(context.Context, *SplitRegionRequest) (*SplitRegionResponse, error) +} + +// UnimplementedAetherShardServer should 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 UnimplementedAetherShardServer struct{} + +func (UnimplementedAetherShardServer) GetRegion(context.Context, *GetRegionRequest) (*GetRegionResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetRegion not implemented") +} +func (UnimplementedAetherShardServer) ListRegions(context.Context, *ListRegionsRequest) (*ListRegionsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ListRegions not implemented") +} +func (UnimplementedAetherShardServer) SplitRegion(context.Context, *SplitRegionRequest) (*SplitRegionResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SplitRegion not implemented") +} +func (UnimplementedAetherShardServer) testEmbeddedByValue() {} + +// UnsafeAetherShardServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to AetherShardServer will +// result in compilation errors. +type UnsafeAetherShardServer interface { + mustEmbedUnimplementedAetherShardServer() +} + +func RegisterAetherShardServer(s grpc.ServiceRegistrar, srv AetherShardServer) { + // If the following call pancis, it indicates UnimplementedAetherShardServer 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(&AetherShard_ServiceDesc, srv) +} + +func _AetherShard_GetRegion_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetRegionRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AetherShardServer).GetRegion(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: AetherShard_GetRegion_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AetherShardServer).GetRegion(ctx, req.(*GetRegionRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _AetherShard_ListRegions_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListRegionsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AetherShardServer).ListRegions(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: AetherShard_ListRegions_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AetherShardServer).ListRegions(ctx, req.(*ListRegionsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _AetherShard_SplitRegion_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(SplitRegionRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AetherShardServer).SplitRegion(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: AetherShard_SplitRegion_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AetherShardServer).SplitRegion(ctx, req.(*SplitRegionRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// AetherShard_ServiceDesc is the grpc.ServiceDesc for AetherShard service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var AetherShard_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "aether.AetherShard", + HandlerType: (*AetherShardServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "GetRegion", + Handler: _AetherShard_GetRegion_Handler, + }, + { + MethodName: "ListRegions", + Handler: _AetherShard_ListRegions_Handler, + }, + { + MethodName: "SplitRegion", + Handler: _AetherShard_SplitRegion_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "shard.proto", +} diff --git a/sdk/go/aetherpb/watch.pb.go b/sdk/go/aetherpb/watch.pb.go new file mode 100644 index 0000000..ccbc3e9 --- /dev/null +++ b/sdk/go/aetherpb/watch.pb.go @@ -0,0 +1,408 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.6 +// protoc v6.32.0 +// source: watch.proto + +package aetherpb + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + 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) +) + +// WatchRequest is sent by the client on the watch stream. +type WatchRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Types that are valid to be assigned to Request: + // + // *WatchRequest_Create + // *WatchRequest_Cancel + Request isWatchRequest_Request `protobuf_oneof:"request"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *WatchRequest) Reset() { + *x = WatchRequest{} + mi := &file_watch_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *WatchRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*WatchRequest) ProtoMessage() {} + +func (x *WatchRequest) ProtoReflect() protoreflect.Message { + mi := &file_watch_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 WatchRequest.ProtoReflect.Descriptor instead. +func (*WatchRequest) Descriptor() ([]byte, []int) { + return file_watch_proto_rawDescGZIP(), []int{0} +} + +func (x *WatchRequest) GetRequest() isWatchRequest_Request { + if x != nil { + return x.Request + } + return nil +} + +func (x *WatchRequest) GetCreate() *WatchCreateRequest { + if x != nil { + if x, ok := x.Request.(*WatchRequest_Create); ok { + return x.Create + } + } + return nil +} + +func (x *WatchRequest) GetCancel() *WatchCancelRequest { + if x != nil { + if x, ok := x.Request.(*WatchRequest_Cancel); ok { + return x.Cancel + } + } + return nil +} + +type isWatchRequest_Request interface { + isWatchRequest_Request() +} + +type WatchRequest_Create struct { + Create *WatchCreateRequest `protobuf:"bytes,1,opt,name=create,proto3,oneof"` +} + +type WatchRequest_Cancel struct { + Cancel *WatchCancelRequest `protobuf:"bytes,2,opt,name=cancel,proto3,oneof"` +} + +func (*WatchRequest_Create) isWatchRequest_Request() {} + +func (*WatchRequest_Cancel) isWatchRequest_Request() {} + +// WatchCreateRequest creates a new watch. +type WatchCreateRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // key is the key to watch. + Key []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + // range_end is the upper bound of the range [key, range_end). + // Empty means watch a single key. "\0" means watch all keys from key. + RangeEnd []byte `protobuf:"bytes,2,opt,name=range_end,json=rangeEnd,proto3" json:"range_end,omitempty"` + // filters filters events by type. Empty means all event types. + Filters []WatchEventType `protobuf:"varint,3,rep,packed,name=filters,proto3,enum=aether.WatchEventType" json:"filters,omitempty"` + // prev_kv requests the previous key-value pair in watch events. + PrevKv bool `protobuf:"varint,4,opt,name=prev_kv,json=prevKv,proto3" json:"prev_kv,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *WatchCreateRequest) Reset() { + *x = WatchCreateRequest{} + mi := &file_watch_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *WatchCreateRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*WatchCreateRequest) ProtoMessage() {} + +func (x *WatchCreateRequest) ProtoReflect() protoreflect.Message { + mi := &file_watch_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 WatchCreateRequest.ProtoReflect.Descriptor instead. +func (*WatchCreateRequest) Descriptor() ([]byte, []int) { + return file_watch_proto_rawDescGZIP(), []int{1} +} + +func (x *WatchCreateRequest) GetKey() []byte { + if x != nil { + return x.Key + } + return nil +} + +func (x *WatchCreateRequest) GetRangeEnd() []byte { + if x != nil { + return x.RangeEnd + } + return nil +} + +func (x *WatchCreateRequest) GetFilters() []WatchEventType { + if x != nil { + return x.Filters + } + return nil +} + +func (x *WatchCreateRequest) GetPrevKv() bool { + if x != nil { + return x.PrevKv + } + return false +} + +// WatchCancelRequest cancels an existing watch. +type WatchCancelRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // watch_id is the ID of the watch to cancel. + WatchId int64 `protobuf:"varint,1,opt,name=watch_id,json=watchId,proto3" json:"watch_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *WatchCancelRequest) Reset() { + *x = WatchCancelRequest{} + mi := &file_watch_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *WatchCancelRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*WatchCancelRequest) ProtoMessage() {} + +func (x *WatchCancelRequest) ProtoReflect() protoreflect.Message { + mi := &file_watch_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 WatchCancelRequest.ProtoReflect.Descriptor instead. +func (*WatchCancelRequest) Descriptor() ([]byte, []int) { + return file_watch_proto_rawDescGZIP(), []int{2} +} + +func (x *WatchCancelRequest) GetWatchId() int64 { + if x != nil { + return x.WatchId + } + return 0 +} + +// WatchResponse is sent by the server on the watch stream. +type WatchResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + // watch_id is the ID of the watch that generated this response. + WatchId int64 `protobuf:"varint,1,opt,name=watch_id,json=watchId,proto3" json:"watch_id,omitempty"` + // created is set to true on the first response after a watch is created. + Created bool `protobuf:"varint,2,opt,name=created,proto3" json:"created,omitempty"` + // events is the list of events that triggered this response. + Events []*WatchEvent `protobuf:"bytes,3,rep,name=events,proto3" json:"events,omitempty"` + // canceled is set to true when the watch is canceled. + Canceled bool `protobuf:"varint,4,opt,name=canceled,proto3" json:"canceled,omitempty"` + // cancel_reason is the reason the watch was canceled. + CancelReason string `protobuf:"bytes,5,opt,name=cancel_reason,json=cancelReason,proto3" json:"cancel_reason,omitempty"` + // header is included in the first response (created) with cluster metadata. + Header *ResponseHeader `protobuf:"bytes,6,opt,name=header,proto3" json:"header,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *WatchResponse) Reset() { + *x = WatchResponse{} + mi := &file_watch_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *WatchResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*WatchResponse) ProtoMessage() {} + +func (x *WatchResponse) ProtoReflect() protoreflect.Message { + mi := &file_watch_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 WatchResponse.ProtoReflect.Descriptor instead. +func (*WatchResponse) Descriptor() ([]byte, []int) { + return file_watch_proto_rawDescGZIP(), []int{3} +} + +func (x *WatchResponse) GetWatchId() int64 { + if x != nil { + return x.WatchId + } + return 0 +} + +func (x *WatchResponse) GetCreated() bool { + if x != nil { + return x.Created + } + return false +} + +func (x *WatchResponse) GetEvents() []*WatchEvent { + if x != nil { + return x.Events + } + return nil +} + +func (x *WatchResponse) GetCanceled() bool { + if x != nil { + return x.Canceled + } + return false +} + +func (x *WatchResponse) GetCancelReason() string { + if x != nil { + return x.CancelReason + } + return "" +} + +func (x *WatchResponse) GetHeader() *ResponseHeader { + if x != nil { + return x.Header + } + return nil +} + +var File_watch_proto protoreflect.FileDescriptor + +const file_watch_proto_rawDesc = "" + + "\n" + + "\vwatch.proto\x12\x06aether\x1a\fcommon.proto\"\x85\x01\n" + + "\fWatchRequest\x124\n" + + "\x06create\x18\x01 \x01(\v2\x1a.aether.WatchCreateRequestH\x00R\x06create\x124\n" + + "\x06cancel\x18\x02 \x01(\v2\x1a.aether.WatchCancelRequestH\x00R\x06cancelB\t\n" + + "\arequest\"\x8e\x01\n" + + "\x12WatchCreateRequest\x12\x10\n" + + "\x03key\x18\x01 \x01(\fR\x03key\x12\x1b\n" + + "\trange_end\x18\x02 \x01(\fR\brangeEnd\x120\n" + + "\afilters\x18\x03 \x03(\x0e2\x16.aether.WatchEventTypeR\afilters\x12\x17\n" + + "\aprev_kv\x18\x04 \x01(\bR\x06prevKv\"/\n" + + "\x12WatchCancelRequest\x12\x19\n" + + "\bwatch_id\x18\x01 \x01(\x03R\awatchId\"\xe1\x01\n" + + "\rWatchResponse\x12\x19\n" + + "\bwatch_id\x18\x01 \x01(\x03R\awatchId\x12\x18\n" + + "\acreated\x18\x02 \x01(\bR\acreated\x12*\n" + + "\x06events\x18\x03 \x03(\v2\x12.aether.WatchEventR\x06events\x12\x1a\n" + + "\bcanceled\x18\x04 \x01(\bR\bcanceled\x12#\n" + + "\rcancel_reason\x18\x05 \x01(\tR\fcancelReason\x12.\n" + + "\x06header\x18\x06 \x01(\v2\x16.aether.ResponseHeaderR\x06header2G\n" + + "\vAetherWatch\x128\n" + + "\x05Watch\x12\x14.aether.WatchRequest\x1a\x15.aether.WatchResponse(\x010\x01B-Z+github.com/aether-io/aether/sdk/go/aetherpbb\x06proto3" + +var ( + file_watch_proto_rawDescOnce sync.Once + file_watch_proto_rawDescData []byte +) + +func file_watch_proto_rawDescGZIP() []byte { + file_watch_proto_rawDescOnce.Do(func() { + file_watch_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_watch_proto_rawDesc), len(file_watch_proto_rawDesc))) + }) + return file_watch_proto_rawDescData +} + +var file_watch_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_watch_proto_goTypes = []any{ + (*WatchRequest)(nil), // 0: aether.WatchRequest + (*WatchCreateRequest)(nil), // 1: aether.WatchCreateRequest + (*WatchCancelRequest)(nil), // 2: aether.WatchCancelRequest + (*WatchResponse)(nil), // 3: aether.WatchResponse + (WatchEventType)(0), // 4: aether.WatchEventType + (*WatchEvent)(nil), // 5: aether.WatchEvent + (*ResponseHeader)(nil), // 6: aether.ResponseHeader +} +var file_watch_proto_depIdxs = []int32{ + 1, // 0: aether.WatchRequest.create:type_name -> aether.WatchCreateRequest + 2, // 1: aether.WatchRequest.cancel:type_name -> aether.WatchCancelRequest + 4, // 2: aether.WatchCreateRequest.filters:type_name -> aether.WatchEventType + 5, // 3: aether.WatchResponse.events:type_name -> aether.WatchEvent + 6, // 4: aether.WatchResponse.header:type_name -> aether.ResponseHeader + 0, // 5: aether.AetherWatch.Watch:input_type -> aether.WatchRequest + 3, // 6: aether.AetherWatch.Watch:output_type -> aether.WatchResponse + 6, // [6:7] is the sub-list for method output_type + 5, // [5:6] is the sub-list for method input_type + 5, // [5:5] is the sub-list for extension type_name + 5, // [5:5] is the sub-list for extension extendee + 0, // [0:5] is the sub-list for field type_name +} + +func init() { file_watch_proto_init() } +func file_watch_proto_init() { + if File_watch_proto != nil { + return + } + file_common_proto_init() + file_watch_proto_msgTypes[0].OneofWrappers = []any{ + (*WatchRequest_Create)(nil), + (*WatchRequest_Cancel)(nil), + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_watch_proto_rawDesc), len(file_watch_proto_rawDesc)), + NumEnums: 0, + NumMessages: 4, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_watch_proto_goTypes, + DependencyIndexes: file_watch_proto_depIdxs, + MessageInfos: file_watch_proto_msgTypes, + }.Build() + File_watch_proto = out.File + file_watch_proto_goTypes = nil + file_watch_proto_depIdxs = nil +} diff --git a/sdk/go/aetherpb/watch_grpc.pb.go b/sdk/go/aetherpb/watch_grpc.pb.go new file mode 100644 index 0000000..cf0b513 --- /dev/null +++ b/sdk/go/aetherpb/watch_grpc.pb.go @@ -0,0 +1,121 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.5.1 +// - protoc v6.32.0 +// source: watch.proto + +package aetherpb + +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 ( + AetherWatch_Watch_FullMethodName = "/aether.AetherWatch/Watch" +) + +// AetherWatchClient is the client API for AetherWatch 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. +// +// AetherWatch provides watch operations for key change notifications. +type AetherWatchClient interface { + // Watch creates a watch stream. The client sends WatchRequests to + // create/cancel watches, and receives WatchResponses with events. + Watch(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[WatchRequest, WatchResponse], error) +} + +type aetherWatchClient struct { + cc grpc.ClientConnInterface +} + +func NewAetherWatchClient(cc grpc.ClientConnInterface) AetherWatchClient { + return &aetherWatchClient{cc} +} + +func (c *aetherWatchClient) Watch(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[WatchRequest, WatchResponse], error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + stream, err := c.cc.NewStream(ctx, &AetherWatch_ServiceDesc.Streams[0], AetherWatch_Watch_FullMethodName, cOpts...) + if err != nil { + return nil, err + } + x := &grpc.GenericClientStream[WatchRequest, WatchResponse]{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 AetherWatch_WatchClient = grpc.BidiStreamingClient[WatchRequest, WatchResponse] + +// AetherWatchServer is the server API for AetherWatch service. +// All implementations should embed UnimplementedAetherWatchServer +// for forward compatibility. +// +// AetherWatch provides watch operations for key change notifications. +type AetherWatchServer interface { + // Watch creates a watch stream. The client sends WatchRequests to + // create/cancel watches, and receives WatchResponses with events. + Watch(grpc.BidiStreamingServer[WatchRequest, WatchResponse]) error +} + +// UnimplementedAetherWatchServer should 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 UnimplementedAetherWatchServer struct{} + +func (UnimplementedAetherWatchServer) Watch(grpc.BidiStreamingServer[WatchRequest, WatchResponse]) error { + return status.Errorf(codes.Unimplemented, "method Watch not implemented") +} +func (UnimplementedAetherWatchServer) testEmbeddedByValue() {} + +// UnsafeAetherWatchServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to AetherWatchServer will +// result in compilation errors. +type UnsafeAetherWatchServer interface { + mustEmbedUnimplementedAetherWatchServer() +} + +func RegisterAetherWatchServer(s grpc.ServiceRegistrar, srv AetherWatchServer) { + // If the following call pancis, it indicates UnimplementedAetherWatchServer 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(&AetherWatch_ServiceDesc, srv) +} + +func _AetherWatch_Watch_Handler(srv interface{}, stream grpc.ServerStream) error { + return srv.(AetherWatchServer).Watch(&grpc.GenericServerStream[WatchRequest, WatchResponse]{ServerStream: stream}) +} + +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type AetherWatch_WatchServer = grpc.BidiStreamingServer[WatchRequest, WatchResponse] + +// AetherWatch_ServiceDesc is the grpc.ServiceDesc for AetherWatch service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var AetherWatch_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "aether.AetherWatch", + HandlerType: (*AetherWatchServer)(nil), + Methods: []grpc.MethodDesc{}, + Streams: []grpc.StreamDesc{ + { + StreamName: "Watch", + Handler: _AetherWatch_Watch_Handler, + ServerStreams: true, + ClientStreams: true, + }, + }, + Metadata: "watch.proto", +} diff --git a/sdk/go/auth.go b/sdk/go/auth.go new file mode 100644 index 0000000..e7fa4ee --- /dev/null +++ b/sdk/go/auth.go @@ -0,0 +1,80 @@ +package aether + +import ( + "context" + + pb "github.com/aether-io/aether/sdk/go/aetherpb" +) + +// AuthClient provides authentication and authorization operations. +type AuthClient struct { + conn pb.AetherAuthClient +} + +func (c *AuthClient) UserAdd(ctx context.Context, name string, password []byte) (*pb.UserAddResponse, error) { + return c.conn.UserAdd(ctx, &pb.UserAddRequest{Name: name, Password: password}) +} + +func (c *AuthClient) UserDelete(ctx context.Context, name string) (*pb.UserDeleteResponse, error) { + return c.conn.UserDelete(ctx, &pb.UserDeleteRequest{Name: name}) +} + +func (c *AuthClient) UserGet(ctx context.Context, name string) (*pb.UserGetResponse, error) { + return c.conn.UserGet(ctx, &pb.UserGetRequest{Name: name}) +} + +func (c *AuthClient) UserList(ctx context.Context) (*pb.UserListResponse, error) { + return c.conn.UserList(ctx, &pb.UserListRequest{}) +} + +func (c *AuthClient) UserChangePassword(ctx context.Context, name string, password []byte) (*pb.UserChangePasswordResponse, error) { + return c.conn.UserChangePassword(ctx, &pb.UserChangePasswordRequest{Name: name, Password: password}) +} + +func (c *AuthClient) UserGrantRole(ctx context.Context, user, role string) (*pb.UserGrantRoleResponse, error) { + return c.conn.UserGrantRole(ctx, &pb.UserGrantRoleRequest{User: user, Role: role}) +} + +func (c *AuthClient) UserRevokeRole(ctx context.Context, user, role string) (*pb.UserRevokeRoleResponse, error) { + return c.conn.UserRevokeRole(ctx, &pb.UserRevokeRoleRequest{User: user, Role: role}) +} + +func (c *AuthClient) RoleAdd(ctx context.Context, name string) (*pb.RoleAddResponse, error) { + return c.conn.RoleAdd(ctx, &pb.RoleAddRequest{Name: name}) +} + +func (c *AuthClient) RoleDelete(ctx context.Context, name string) (*pb.RoleDeleteResponse, error) { + return c.conn.RoleDelete(ctx, &pb.RoleDeleteRequest{Name: name}) +} + +func (c *AuthClient) RoleGet(ctx context.Context, name string) (*pb.RoleGetResponse, error) { + return c.conn.RoleGet(ctx, &pb.RoleGetRequest{Name: name}) +} + +func (c *AuthClient) RoleList(ctx context.Context) (*pb.RoleListResponse, error) { + return c.conn.RoleList(ctx, &pb.RoleListRequest{}) +} + +func (c *AuthClient) RoleGrantPermission(ctx context.Context, role string, perm *pb.Permission) (*pb.RoleGrantPermissionResponse, error) { + return c.conn.RoleGrantPermission(ctx, &pb.RoleGrantPermissionRequest{Role: role, Permission: perm}) +} + +func (c *AuthClient) RoleRevokePermission(ctx context.Context, role string, perm *pb.Permission) (*pb.RoleRevokePermissionResponse, error) { + return c.conn.RoleRevokePermission(ctx, &pb.RoleRevokePermissionRequest{Role: role, Permission: perm}) +} + +func (c *AuthClient) Authenticate(ctx context.Context, name string, password []byte) (*pb.AuthenticateResponse, error) { + return c.conn.Authenticate(ctx, &pb.AuthenticateRequest{Name: name, Password: password}) +} + +func (c *AuthClient) Enable(ctx context.Context, rootPassword []byte) (*pb.AuthEnableResponse, error) { + return c.conn.AuthEnable(ctx, &pb.AuthEnableRequest{RootPassword: rootPassword}) +} + +func (c *AuthClient) Disable(ctx context.Context) (*pb.AuthDisableResponse, error) { + return c.conn.AuthDisable(ctx, &pb.AuthDisableRequest{}) +} + +func (c *AuthClient) Status(ctx context.Context) (*pb.AuthStatusResponse, error) { + return c.conn.AuthStatus(ctx, &pb.AuthStatusRequest{}) +} diff --git a/sdk/go/barrier.go b/sdk/go/barrier.go new file mode 100644 index 0000000..eeff568 --- /dev/null +++ b/sdk/go/barrier.go @@ -0,0 +1,28 @@ +package aether + +import ( + "context" + + pb "github.com/aether-io/aether/sdk/go/aetherpb" +) + +// BarrierClient provides distributed barrier operations. +type BarrierClient struct { + conn pb.AetherBarrierClient +} + +// Create creates and holds a barrier. Other callers trying to enter will block +// until this barrier is released or its lease expires. +func (c *BarrierClient) Create(ctx context.Context, name []byte, leaseID int64) (*pb.BarrierCreateResponse, error) { + return c.conn.Create(ctx, &pb.BarrierCreateRequest{Name: name, LeaseId: leaseID}) +} + +// Release releases the barrier, unblocking all waiters. +func (c *BarrierClient) Release(ctx context.Context, name []byte) (*pb.BarrierReleaseResponse, error) { + return c.conn.Release(ctx, &pb.BarrierReleaseRequest{Name: name}) +} + +// Query returns whether the barrier is currently held. +func (c *BarrierClient) Query(ctx context.Context, name []byte) (*pb.BarrierQueryResponse, error) { + return c.conn.Query(ctx, &pb.BarrierQueryRequest{Name: name}) +} diff --git a/sdk/go/client.go b/sdk/go/client.go new file mode 100644 index 0000000..679114f --- /dev/null +++ b/sdk/go/client.go @@ -0,0 +1,116 @@ +// Package aether provides a Go client SDK for the Aether distributed key-value store. +package aether + +import ( + "crypto/tls" + "errors" + "time" + + "google.golang.org/grpc" + "google.golang.org/grpc/backoff" + "google.golang.org/grpc/credentials" + "google.golang.org/grpc/credentials/insecure" + + pb "github.com/aether-io/aether/sdk/go/aetherpb" +) + +// Client is the entry point for interacting with an Aether cluster. +type Client struct { + conn *grpc.ClientConn + + KV *KVClient + Watch *WatchClient + Lease *LeaseClient + Auth *AuthClient + Cluster *ClusterClient + Maintenance *MaintenanceClient + Lock *LockClient + Election *ElectionClient + Session *SessionClient + Shard *ShardClient + Barrier *BarrierClient + Queue *QueueClient +} + +// Config holds configuration for creating a Client. +type Config struct { + // Endpoints is a list of Aether server addresses (host:port). + Endpoints []string + // DialTimeout is the timeout for establishing a connection. Default: 5s. + DialTimeout time.Duration + // TLS configures TLS for the connection. If nil, plaintext is used. + TLS *tls.Config + // DialOptions are additional gRPC dial options. + DialOptions []grpc.DialOption +} + +func (c *Config) defaults() { + if c.DialTimeout == 0 { + c.DialTimeout = 5 * time.Second + } +} + +// NewClient creates a new Aether client connected to the first available endpoint. +func NewClient(cfg Config) (*Client, error) { + cfg.defaults() + + if len(cfg.Endpoints) == 0 { + return nil, errors.New("aether: at least one endpoint is required") + } + + opts := cfg.DialOptions + if cfg.TLS != nil { + opts = append(opts, grpc.WithTransportCredentials(credentials.NewTLS(cfg.TLS))) + } else { + opts = append(opts, grpc.WithTransportCredentials(insecure.NewCredentials())) + } + + if cfg.DialTimeout > 0 { + opts = append(opts, grpc.WithConnectParams(grpc.ConnectParams{ + Backoff: backoff.DefaultConfig, + MinConnectTimeout: cfg.DialTimeout, + })) + } + + // TODO: implement endpoint load balancing / failover. + // Currently only the first endpoint is used. + conn, err := grpc.NewClient(cfg.Endpoints[0], opts...) + if err != nil { + return nil, err + } + + return newClientFromConn(conn), nil +} + +func newClientFromConn(conn *grpc.ClientConn) *Client { + return &Client{ + conn: conn, + KV: &KVClient{conn: pb.NewAetherKVClient(conn)}, + Watch: &WatchClient{conn: pb.NewAetherWatchClient(conn)}, + Lease: &LeaseClient{conn: pb.NewAetherLeaseClient(conn)}, + Auth: &AuthClient{conn: pb.NewAetherAuthClient(conn)}, + Cluster: &ClusterClient{conn: pb.NewAetherClusterClient(conn)}, + Maintenance: &MaintenanceClient{conn: pb.NewAetherMaintenanceClient(conn)}, + Lock: &LockClient{conn: pb.NewAetherLockClient(conn)}, + Election: &ElectionClient{conn: pb.NewAetherElectionClient(conn)}, + Session: &SessionClient{conn: pb.NewAetherSessionClient(conn)}, + Shard: &ShardClient{conn: pb.NewAetherShardClient(conn)}, + Barrier: &BarrierClient{conn: pb.NewAetherBarrierClient(conn)}, + Queue: &QueueClient{conn: pb.NewAetherQueueClient(conn)}, + } +} + +// Close closes the underlying gRPC connection. +func (c *Client) Close() error { + return c.conn.Close() +} + +// Conn returns the underlying gRPC connection for advanced use cases. +func (c *Client) Conn() *grpc.ClientConn { + return c.conn +} + +// NewClientFromConn creates a Client from an existing gRPC connection. +func NewClientFromConn(conn *grpc.ClientConn) *Client { + return newClientFromConn(conn) +} diff --git a/sdk/go/cluster.go b/sdk/go/cluster.go new file mode 100644 index 0000000..332c15c --- /dev/null +++ b/sdk/go/cluster.go @@ -0,0 +1,28 @@ +package aether + +import ( + "context" + + pb "github.com/aether-io/aether/sdk/go/aetherpb" +) + +// ClusterClient provides cluster membership management operations. +type ClusterClient struct { + conn pb.AetherClusterClient +} + +func (c *ClusterClient) MemberList(ctx context.Context) (*pb.MemberListResponse, error) { + return c.conn.MemberList(ctx, &pb.MemberListRequest{}) +} + +func (c *ClusterClient) MemberAdd(ctx context.Context, addr string, isLearner bool) (*pb.MemberAddResponse, error) { + return c.conn.MemberAdd(ctx, &pb.MemberAddRequest{Addr: addr, IsLearner: isLearner}) +} + +func (c *ClusterClient) MemberRemove(ctx context.Context, id uint64) (*pb.MemberRemoveResponse, error) { + return c.conn.MemberRemove(ctx, &pb.MemberRemoveRequest{Id: id}) +} + +func (c *ClusterClient) MemberPromote(ctx context.Context, id uint64) (*pb.MemberPromoteResponse, error) { + return c.conn.MemberPromote(ctx, &pb.MemberPromoteRequest{Id: id}) +} diff --git a/sdk/go/election.go b/sdk/go/election.go new file mode 100644 index 0000000..5aeddb6 --- /dev/null +++ b/sdk/go/election.go @@ -0,0 +1,72 @@ +package aether + +import ( + "context" + "io" + + pb "github.com/aether-io/aether/sdk/go/aetherpb" +) + +// ElectionClient provides distributed leader election operations. +type ElectionClient struct { + conn pb.AetherElectionClient +} + +// Campaign waits to acquire leadership for the given election name. +// Returns a leader key that can be used to resign or query leadership. +func (c *ElectionClient) Campaign(ctx context.Context, name []byte, leaseID int64, value []byte) (*pb.CampaignResponse, error) { + return c.conn.Campaign(ctx, &pb.CampaignRequest{ + Name: name, + LeaseId: leaseID, + Value: value, + }) +} + +// Leader returns the current leader of the given election. +func (c *ElectionClient) Leader(ctx context.Context, name []byte) (*pb.LeaderResponse, error) { + return c.conn.Leader(ctx, &pb.LeaderRequest{Name: name}) +} + +// Resign voluntarily gives up leadership for the given leader key. +func (c *ElectionClient) Resign(ctx context.Context, leaderKey []byte) (*pb.ResignResponse, error) { + return c.conn.Resign(ctx, &pb.ResignRequest{LeaderKey: leaderKey}) +} + +// Observe streams leadership changes for the given election name. +func (c *ElectionClient) Observe(ctx context.Context, name []byte) (<-chan ObserveResult, error) { + stream, err := c.conn.Observe(ctx, &pb.ObserveRequest{Name: name}) + if err != nil { + return nil, err + } + + ch := make(chan ObserveResult, 16) + go func() { + defer close(ch) + for { + resp, err := stream.Recv() + if err != nil { + if err == io.EOF { + return + } + select { + case ch <- ObserveResult{Err: err}: + case <-ctx.Done(): + return + } + return + } + select { + case ch <- ObserveResult{Response: resp}: + case <-ctx.Done(): + return + } + } + }() + return ch, nil +} + +// ObserveResult wraps an observe response or error. +type ObserveResult struct { + Response *pb.ObserveResponse + Err error +} diff --git a/sdk/go/gen/buf.gen.yaml b/sdk/go/gen/buf.gen.yaml new file mode 100644 index 0000000..9616cfa --- /dev/null +++ b/sdk/go/gen/buf.gen.yaml @@ -0,0 +1,8 @@ +version: v2 +plugins: + - local: protoc-gen-go + out: ../aetherpb + opt: paths=source_relative + - local: protoc-gen-go-grpc + out: ../aetherpb + opt: paths=source_relative,require_unimplemented_servers=false diff --git a/sdk/go/gen/buf.yaml b/sdk/go/gen/buf.yaml new file mode 100644 index 0000000..2dd674f --- /dev/null +++ b/sdk/go/gen/buf.yaml @@ -0,0 +1,10 @@ +version: v2 +modules: + - path: proto +deps: [] +lint: + use: + - STANDARD +breaking: + use: + - FILE diff --git a/sdk/go/gen/proto/auth.proto b/sdk/go/gen/proto/auth.proto new file mode 100644 index 0000000..238dba9 --- /dev/null +++ b/sdk/go/gen/proto/auth.proto @@ -0,0 +1,178 @@ +syntax = "proto3"; + +package aether; +option go_package = "github.com/aether-io/aether/sdk/go/aetherpb"; + +import "common.proto"; + +// PermissionType defines the type of permission. +enum PermissionType { + PERMISSION_TYPE_READ = 0; + PERMISSION_TYPE_WRITE = 1; + PERMISSION_TYPE_READWRITE = 2; +} + +// Permission defines a key-range permission. +message Permission { + PermissionType perm_type = 1; + bytes key = 2; + bytes range_end = 3; +} + +// User represents an authenticated user. +message AuthUser { + string name = 1; + repeated string roles = 2; + bool enabled = 3; +} + +// Role represents an authorization role. +message AuthRole { + string name = 1; + repeated Permission permissions = 2; +} + +// AetherAuth provides authentication and authorization. +service AetherAuth { + rpc UserAdd(UserAddRequest) returns (UserAddResponse); + rpc UserDelete(UserDeleteRequest) returns (UserDeleteResponse); + rpc UserGet(UserGetRequest) returns (UserGetResponse); + rpc UserList(UserListRequest) returns (UserListResponse); + rpc UserChangePassword(UserChangePasswordRequest) returns (UserChangePasswordResponse); + rpc UserGrantRole(UserGrantRoleRequest) returns (UserGrantRoleResponse); + rpc UserRevokeRole(UserRevokeRoleRequest) returns (UserRevokeRoleResponse); + rpc RoleAdd(RoleAddRequest) returns (RoleAddResponse); + rpc RoleDelete(RoleDeleteRequest) returns (RoleDeleteResponse); + rpc RoleGet(RoleGetRequest) returns (RoleGetResponse); + rpc RoleList(RoleListRequest) returns (RoleListResponse); + rpc RoleGrantPermission(RoleGrantPermissionRequest) returns (RoleGrantPermissionResponse); + rpc RoleRevokePermission(RoleRevokePermissionRequest) returns (RoleRevokePermissionResponse); + rpc Authenticate(AuthenticateRequest) returns (AuthenticateResponse); + rpc AuthEnable(AuthEnableRequest) returns (AuthEnableResponse); + rpc AuthDisable(AuthDisableRequest) returns (AuthDisableResponse); + rpc AuthStatus(AuthStatusRequest) returns (AuthStatusResponse); +} + +message UserAddRequest { + string name = 1; + bytes password = 2; +} +message UserAddResponse { + ResponseHeader header = 1; +} + +message UserDeleteRequest { + string name = 1; +} +message UserDeleteResponse { + ResponseHeader header = 1; +} + +message UserGetRequest { + string name = 1; +} +message UserGetResponse { + ResponseHeader header = 1; + AuthUser user = 2; +} + +message UserListRequest {} +message UserListResponse { + ResponseHeader header = 1; + repeated AuthUser users = 2; +} + +message UserChangePasswordRequest { + string name = 1; + bytes password = 2; +} +message UserChangePasswordResponse { + ResponseHeader header = 1; +} + +message UserGrantRoleRequest { + string user = 1; + string role = 2; +} +message UserGrantRoleResponse { + ResponseHeader header = 1; +} + +message UserRevokeRoleRequest { + string user = 1; + string role = 2; +} +message UserRevokeRoleResponse { + ResponseHeader header = 1; +} + +message RoleAddRequest { + string name = 1; +} +message RoleAddResponse { + ResponseHeader header = 1; +} + +message RoleDeleteRequest { + string name = 1; +} +message RoleDeleteResponse { + ResponseHeader header = 1; +} + +message RoleGetRequest { + string name = 1; +} +message RoleGetResponse { + ResponseHeader header = 1; + AuthRole role = 2; +} + +message RoleListRequest {} +message RoleListResponse { + ResponseHeader header = 1; + repeated AuthRole roles = 2; +} + +message RoleGrantPermissionRequest { + string role = 1; + Permission permission = 2; +} +message RoleGrantPermissionResponse { + ResponseHeader header = 1; +} + +message RoleRevokePermissionRequest { + string role = 1; + Permission permission = 2; +} +message RoleRevokePermissionResponse { + ResponseHeader header = 1; +} + +message AuthenticateRequest { + string name = 1; + bytes password = 2; +} +message AuthenticateResponse { + ResponseHeader header = 1; + string token = 2; +} + +message AuthEnableRequest { + bytes root_password = 1; +} +message AuthEnableResponse { + ResponseHeader header = 1; +} + +message AuthDisableRequest {} +message AuthDisableResponse { + ResponseHeader header = 1; +} + +message AuthStatusRequest {} +message AuthStatusResponse { + ResponseHeader header = 1; + bool enabled = 2; +} diff --git a/sdk/go/gen/proto/barrier.proto b/sdk/go/gen/proto/barrier.proto new file mode 100644 index 0000000..07aa159 --- /dev/null +++ b/sdk/go/gen/proto/barrier.proto @@ -0,0 +1,61 @@ +syntax = "proto3"; + +package aether; +option go_package = "github.com/aether-io/aether/sdk/go/aetherpb"; + +import "common.proto"; + +// AetherBarrier provides distributed barrier operations. +// A barrier is a synchronization primitive: while the barrier exists, +// other callers that try to enter it will block until the barrier +// is released or its lease expires. +service AetherBarrier { + // Create creates and holds a barrier with the given name. + // Other callers trying to enter will block until this barrier + // is released or its lease expires. + // Returns a barrier key that can be used to release or query. + rpc Create(BarrierCreateRequest) returns (BarrierCreateResponse); + // Release releases the barrier, unblocking all waiters. + rpc Release(BarrierReleaseRequest) returns (BarrierReleaseResponse); + // Query returns whether the barrier is currently held. + rpc Query(BarrierQueryRequest) returns (BarrierQueryResponse); +} + +message BarrierCreateRequest { + // name is the barrier name. + bytes name = 1; + // lease_id is the lease to associate with the barrier. + // If 0, the barrier will not be associated with a lease + // and must be explicitly released. + int64 lease_id = 2; +} + +message BarrierCreateResponse { + ResponseHeader header = 1; + // key is the key created for the barrier. + bytes key = 2; +} + +message BarrierReleaseRequest { + // name is the barrier name to release. + bytes name = 1; +} + +message BarrierReleaseResponse { + ResponseHeader header = 1; +} + +message BarrierQueryRequest { + // name is the barrier name to query. + bytes name = 1; +} + +message BarrierQueryResponse { + ResponseHeader header = 1; + // held is true if the barrier is currently held. + bool held = 2; + // key is the barrier key if held, empty otherwise. + bytes key = 3; + // lease_id is the lease associated with the barrier, 0 if none. + int64 lease_id = 4; +} diff --git a/sdk/go/gen/proto/cluster.proto b/sdk/go/gen/proto/cluster.proto new file mode 100644 index 0000000..0985221 --- /dev/null +++ b/sdk/go/gen/proto/cluster.proto @@ -0,0 +1,69 @@ +syntax = "proto3"; + +package aether; +option go_package = "github.com/aether-io/aether/sdk/go/aetherpb"; + +import "common.proto"; + +// AetherCluster provides cluster membership management operations. +service AetherCluster { + // MemberList lists all current cluster members. + rpc MemberList(MemberListRequest) returns (MemberListResponse); + + // MemberAdd adds a new member to the cluster. + rpc MemberAdd(MemberAddRequest) returns (MemberAddResponse); + + // MemberRemove removes a member from the cluster. + rpc MemberRemove(MemberRemoveRequest) returns (MemberRemoveResponse); + + // MemberPromote promotes a learner member to a voting member. + rpc MemberPromote(MemberPromoteRequest) returns (MemberPromoteResponse); +} + +// Member represents a cluster member. +message Member { + uint64 id = 1; + string addr = 2; + bool is_learner = 3; + string data = 4; +} + +message MemberListRequest {} + +message MemberListResponse { + ResponseHeader header = 1; + repeated Member members = 2; +} + +message MemberAddRequest { + // addr is the address of the new member (host:port for Raft communication). + string addr = 1; + // is_learner adds the member as a non-voting learner if true. + bool is_learner = 2; +} + +message MemberAddResponse { + ResponseHeader header = 1; + Member member = 2; + repeated Member members = 3; +} + +message MemberRemoveRequest { + // id is the node ID of the member to remove. + uint64 id = 1; +} + +message MemberRemoveResponse { + ResponseHeader header = 1; + repeated Member members = 2; +} + +message MemberPromoteRequest { + // id is the node ID of the learner to promote to voter. + uint64 id = 1; +} + +message MemberPromoteResponse { + ResponseHeader header = 1; + repeated Member members = 2; +} diff --git a/sdk/go/gen/proto/common.proto b/sdk/go/gen/proto/common.proto new file mode 100644 index 0000000..6808974 --- /dev/null +++ b/sdk/go/gen/proto/common.proto @@ -0,0 +1,60 @@ +syntax = "proto3"; + +package aether; +option go_package = "github.com/aether-io/aether/sdk/go/aetherpb"; + +// ResponseHeader is included in every response with cluster metadata. +message ResponseHeader { + uint64 cluster_id = 1; + uint64 member_id = 2; + // Current store revision when response was created. + int64 revision = 3; + uint64 raft_term = 4; +} + +// KeyValue represents a key-value pair with metadata. +message KeyValue { + bytes key = 1; + bytes value = 2; + int64 create_revision = 3; + int64 mod_revision = 4; + int64 version = 5; + int64 lease = 6; +} + +// SortOrder defines the sort order for Range results. +enum SortOrder { + SORT_ORDER_NONE = 0; + SORT_ORDER_ASCEND = 1; + SORT_ORDER_DESCEND = 2; +} + +// SortTarget defines the field to sort on. +enum SortTarget { + SORT_TARGET_KEY = 0; + SORT_TARGET_VERSION = 1; + SORT_TARGET_CREATE = 2; + SORT_TARGET_MOD = 3; + SORT_TARGET_VALUE = 4; +} + +// WatchEvent represents a single watch event. +message WatchEvent { + WatchEventType event_type = 1; + KeyValue kv = 2; + KeyValue prev_kv = 3; +} + +// WatchEventType is the type of a watch event. +enum WatchEventType { + WATCH_EVENT_TYPE_PUT = 0; + WATCH_EVENT_TYPE_DELETE = 1; +} + +// LeaseInfo contains lease metadata. +message LeaseInfo { + int64 id = 1; + int64 ttl = 2; + int64 granted_ttl = 3; + repeated bytes keys = 4; +} diff --git a/sdk/go/gen/proto/election.proto b/sdk/go/gen/proto/election.proto new file mode 100644 index 0000000..e9378aa --- /dev/null +++ b/sdk/go/gen/proto/election.proto @@ -0,0 +1,71 @@ +syntax = "proto3"; + +package aether; +option go_package = "github.com/aether-io/aether/sdk/go/aetherpb"; + +import "common.proto"; + +// AetherElection provides distributed leader election operations. +// Elections are built on top of leases: a campaign creates a key with the +// given lease, ensuring automatic resignation when the lease expires. +service AetherElection { + // Campaign waits to acquire leadership for the given election name. + // The caller becomes the leader and returns the leader key. Other + // callers block until the current leader resigns or their lease expires. + rpc Campaign(CampaignRequest) returns (CampaignResponse); + // Leader returns the current leader of the given election. + rpc Leader(LeaderRequest) returns (LeaderResponse); + // Resign voluntarily gives up leadership for the given leader key. + rpc Resign(ResignRequest) returns (ResignResponse); + // Observe streams leadership changes for the given election name. + rpc Observe(ObserveRequest) returns (stream ObserveResponse); +} + +message CampaignRequest { + // name is the election name to campaign for. + bytes name = 1; + // lease_id is the lease to associate with the campaign. + // The campaign is automatically revoked when the lease expires. + int64 lease_id = 2; + // value is the value to store with the campaign (typically the + // candidate's identity or proposal). + bytes value = 3; +} + +message CampaignResponse { + ResponseHeader header = 1; + // leader_key is the key that identifies this campaign. It can be + // used to resign or query leadership. + bytes leader_key = 2; +} + +message LeaderRequest { + // name is the election name. + bytes name = 1; +} + +message LeaderResponse { + ResponseHeader header = 1; + // kv is the current leader's key-value, empty if no leader. + KeyValue kv = 2; +} + +message ResignRequest { + // leader_key is the key returned by Campaign. + bytes leader_key = 1; +} + +message ResignResponse { + ResponseHeader header = 1; +} + +message ObserveRequest { + // name is the election name to observe. + bytes name = 1; +} + +message ObserveResponse { + ResponseHeader header = 1; + // kv is the current leader's key-value. + KeyValue kv = 2; +} diff --git a/sdk/go/gen/proto/kv.proto b/sdk/go/gen/proto/kv.proto new file mode 100644 index 0000000..ae16a3d --- /dev/null +++ b/sdk/go/gen/proto/kv.proto @@ -0,0 +1,175 @@ +syntax = "proto3"; + +package aether; +option go_package = "github.com/aether-io/aether/sdk/go/aetherpb"; + +import "common.proto"; + +// AetherKV provides key-value operations. +service AetherKV { + // Put puts the given key into the store. + rpc Put(PutRequest) returns (PutResponse); + + // Get gets the key or a range of keys from the store. + rpc Get(GetRequest) returns (GetResponse); + + // Delete deletes the given key or range of keys from the store. + rpc Delete(DeleteRequest) returns (DeleteResponse); + + // Range gets the keys in the range [key, range_end). + rpc Range(RangeRequest) returns (RangeResponse); + + // Txn processes multiple operations in a single transaction. + rpc Txn(TxnRequest) returns (TxnResponse); +} + +message PutRequest { + bytes key = 1; + bytes value = 2; + // lease is the lease ID to attach to the key, 0 = no lease. + int64 lease = 3; + // prev_kv returns the previous key-value pair if true. + bool prev_kv = 4; +} + +message PutResponse { + ResponseHeader header = 1; + // prev_kv is the previous key-value pair, set only if prev_kv was true. + KeyValue prev_kv = 2; +} + +message GetRequest { + bytes key = 1; + // range_end is the upper bound of the range [key, range_end). + // Empty means single key lookup. + bytes range_end = 2; + // limit is the maximum number of keys to return, 0 = no limit. + int64 limit = 3; + // revision is the point-in-time revision to read, 0 = latest. + int64 revision = 4; + // serializable enables serializable reads (may read stale data). + bool serializable = 5; + SortOrder sort_order = 6; + SortTarget sort_target = 7; +} + +message GetResponse { + ResponseHeader header = 1; + repeated KeyValue kvs = 2; + // count is the total number of keys in the range. + int64 count = 3; +} + +message DeleteRequest { + bytes key = 1; + // range_end is the upper bound of the range [key, range_end). + // Empty means single key delete. + bytes range_end = 2; + // prev_kv returns the deleted key-value pairs if true. + bool prev_kv = 3; +} + +message DeleteResponse { + ResponseHeader header = 1; + // deleted is the number of keys deleted. + int64 deleted = 2; + // prev_kvs contains the deleted key-value pairs, set only if prev_kv was true. + repeated KeyValue prev_kvs = 3; +} + +// RangeRequest gets the keys in the range [key, range_end). +message RangeRequest { + bytes key = 1; + // range_end is the upper bound of the range [key, range_end). + // If range_end is "\0", it returns all keys from key to end of keyspace. + // If range_end is empty, it returns only the key. + bytes range_end = 2; + // limit is the maximum number of keys to return, 0 = no limit. + int64 limit = 3; + // revision is the point-in-time revision to read, 0 = latest. + int64 revision = 4; + SortOrder sort_order = 5; + SortTarget sort_target = 6; + // serializable enables serializable reads (may read stale data). + bool serializable = 7; +} + +message RangeResponse { + ResponseHeader header = 1; + repeated KeyValue kvs = 2; + // count is the total number of keys in the range. + int64 count = 3; +} + +// --- Transaction types --- + +// CompareResult defines the comparison result. +enum CompareResult { + COMPARE_RESULT_EQUAL = 0; + COMPARE_RESULT_GREATER = 1; + COMPARE_RESULT_LESS = 2; + COMPARE_RESULT_NOT_EQUAL = 3; +} + +// CompareTarget defines what to compare. +enum CompareTarget { + COMPARE_TARGET_VERSION = 0; + COMPARE_TARGET_CREATE = 1; + COMPARE_TARGET_MOD = 2; + COMPARE_TARGET_VALUE = 3; + COMPARE_TARGET_LEASE = 4; +} + +// Compare defines a comparison condition for a transaction. +message Compare { + CompareResult result = 1; + CompareTarget target = 2; + bytes key = 3; + oneof target_union { + int64 version = 4; + int64 create_revision = 5; + int64 mod_revision = 6; + bytes value = 7; + int64 lease = 8; + } +} + +// RequestOp is a single operation within a transaction. +message RequestOp { + oneof request { + PutRequest put = 1; + GetRequest get = 2; + DeleteRequest delete = 3; + RangeRequest range = 4; + TxnRequest txn = 5; + } +} + +// ResponseOp is the response for a single operation within a transaction. +message ResponseOp { + oneof response { + PutResponse put = 1; + GetResponse get = 2; + DeleteResponse delete = 3; + RangeResponse range = 4; + TxnResponse txn = 5; + } +} + +// TxnRequest processes multiple operations in a single transaction. +message TxnRequest { + // compare is the list of conditions that must all be true for success. + repeated Compare compare = 1; + // success is the list of operations to execute if all compares succeed. + repeated RequestOp success = 2; + // failure is the list of operations to execute if any compare fails. + repeated RequestOp failure = 3; +} + +message TxnResponse { + ResponseHeader header = 1; + // succeeded is true if all compares succeeded. + bool succeeded = 2; + // responses contains the results of the executed operations. + repeated ResponseOp responses = 3; +} diff --git a/sdk/go/gen/proto/lease.proto b/sdk/go/gen/proto/lease.proto new file mode 100644 index 0000000..41ec8c0 --- /dev/null +++ b/sdk/go/gen/proto/lease.proto @@ -0,0 +1,73 @@ +syntax = "proto3"; + +package aether; +option go_package = "github.com/aether-io/aether/sdk/go/aetherpb"; + +import "common.proto"; + +// AetherLease provides lease management operations. +service AetherLease { + // LeaseGrant creates a new lease with a TTL. + rpc LeaseGrant(LeaseGrantRequest) returns (LeaseGrantResponse); + // LeaseRevoke revokes a lease and deletes all attached keys. + rpc LeaseRevoke(LeaseRevokeRequest) returns (LeaseRevokeResponse); + // LeaseKeepAlive keeps a lease alive by resetting its TTL. + rpc LeaseKeepAlive(stream LeaseKeepAliveRequest) returns (stream LeaseKeepAliveResponse); + // LeaseTimeToLive returns the remaining TTL of a lease. + rpc LeaseTimeToLive(LeaseTimeToLiveRequest) returns (LeaseTimeToLiveResponse); + // LeaseLeases lists all active leases. + rpc LeaseLeases(LeaseLeasesRequest) returns (LeaseLeasesResponse); +} + +message LeaseGrantRequest { + int64 ttl = 1; + reserved 2; // was: int64 id (removed — IDs are server-assigned) +} + +message LeaseGrantResponse { + ResponseHeader header = 1; + int64 id = 2; + int64 ttl = 3; +} + +message LeaseRevokeRequest { + int64 id = 1; +} + +message LeaseRevokeResponse { + ResponseHeader header = 1; +} + +message LeaseKeepAliveRequest { + int64 id = 1; +} + +message LeaseKeepAliveResponse { + ResponseHeader header = 1; + int64 id = 2; + int64 ttl = 3; +} + +message LeaseTimeToLiveRequest { + int64 id = 1; + bool keys = 2; +} + +message LeaseTimeToLiveResponse { + ResponseHeader header = 1; + int64 id = 2; + int64 ttl = 3; + int64 granted_ttl = 4; + repeated bytes keys = 5; +} + +message LeaseLeasesRequest {} + +message LeaseLeasesResponse { + ResponseHeader header = 1; + repeated LeaseStatus leases = 2; +} + +message LeaseStatus { + int64 id = 1; +} diff --git a/sdk/go/gen/proto/lock.proto b/sdk/go/gen/proto/lock.proto new file mode 100644 index 0000000..b9f8ae3 --- /dev/null +++ b/sdk/go/gen/proto/lock.proto @@ -0,0 +1,59 @@ +syntax = "proto3"; + +package aether; +option go_package = "github.com/aether-io/aether/sdk/go/aetherpb"; + +import "common.proto"; + +// AetherLock provides distributed lock operations. +// Locks are implemented using leases: a lock creates a key with the given +// lease, ensuring automatic release when the lease expires. +service AetherLock { + // Lock acquires a distributed lock with the given name. + // The lock is associated with the provided lease_id and will be + // automatically released when the lease expires. + // Returns a lock header with the key that was locked. + rpc Lock(LockRequest) returns (LockResponse); + // Unlock releases a distributed lock. + rpc Unlock(UnlockRequest) returns (UnlockResponse); + // LockQuery returns information about a lock. + rpc LockQuery(LockQueryRequest) returns (LockQueryResponse); +} + +message LockRequest { + // name is the name of the lock to acquire. + bytes name = 1; + // lease_id is the lease to associate with the lock. + // If 0, the lock will not be associated with a lease + // and must be explicitly unlocked. + int64 lease_id = 2; +} + +message LockResponse { + ResponseHeader header = 1; + // key is the key that was created for the lock. + // This can be used to unlock or query the lock. + bytes key = 2; +} + +message UnlockRequest { + // key is the key returned by Lock. + bytes key = 1; +} + +message UnlockResponse { + ResponseHeader header = 1; +} + +message LockQueryRequest { + // name is the name of the lock to query. + bytes name = 1; +} + +message LockQueryResponse { + ResponseHeader header = 1; + // owner is the key that currently holds the lock, empty if unlocked. + bytes owner = 2; + // lease_id is the lease associated with the lock, 0 if none. + int64 lease_id = 3; +} diff --git a/sdk/go/gen/proto/maintenance.proto b/sdk/go/gen/proto/maintenance.proto new file mode 100644 index 0000000..a288c12 --- /dev/null +++ b/sdk/go/gen/proto/maintenance.proto @@ -0,0 +1,85 @@ +syntax = "proto3"; + +package aether; +option go_package = "github.com/aether-io/aether/sdk/go/aetherpb"; + +import "common.proto"; + +// AetherMaintenance provides operational tools for cluster maintenance. +service AetherMaintenance { + // Defrag triggers storage defragmentation on the receiving node. + rpc Defrag(DefragRequest) returns (DefragResponse); + + // Alarm manages cluster-wide alarms (e.g. space quota, corruption). + rpc Alarm(AlarmRequest) returns (AlarmResponse); + + // Status returns node-level status information. + rpc Status(StatusRequest) returns (StatusResponse); +} + +// AlarmType identifies the type of alarm. +enum AlarmType { + ALARM_TYPE_NONE = 0; + // Space quota has been exceeded. + ALARM_TYPE_NOSPACE = 1; + // Storage corruption detected. + ALARM_TYPE_CORRUPT = 2; +} + +// AlarmMember associates an alarm with a cluster member. +message AlarmMember { + // member_id is the ID of the member raising the alarm. + uint64 member_id = 1; + // alarm is the type of alarm. + AlarmType alarm = 2; +} + +// AlarmAction defines the operation to perform on alarms. +enum AlarmAction { + ALARM_ACTION_GET = 0; + ALARM_ACTION_ACTIVATE = 1; + ALARM_ACTION_ACKNOWLEDGE = 2; +} + +message DefragRequest {} + +message DefragResponse { + ResponseHeader header = 1; +} + +message AlarmRequest { + // action is the operation to perform. + AlarmAction action = 1; + // alarm is the alarm type (used for ACTIVATE and ACKNOWLEDGE). + AlarmType alarm = 2; + // member_id is the target member (0 = self, used for ACKNOWLEDGE). + uint64 member_id = 3; +} + +message AlarmResponse { + ResponseHeader header = 1; + // alarms is the list of active alarms (populated on GET). + repeated AlarmMember alarms = 2; +} + +message StatusRequest {} + +message StatusResponse { + ResponseHeader header = 1; + // version is the Aether server version. + string version = 2; + // db_size is the total SST file size in bytes (disk usage). + int64 db_size = 3; + // leader is the current Raft leader node ID. + uint64 leader = 4; + // raft_index is the current Raft commit index. + uint64 raft_index = 5; + // raft_term is the current Raft term. + uint64 raft_term = 6; + // raft_applied_index is the last applied Raft index. + uint64 raft_applied_index = 7; + // db_in_use is the estimated live data size in bytes. + int64 db_in_use = 8; + // is_learner indicates if this node is a learner. + bool is_learner = 9; +} diff --git a/sdk/go/gen/proto/queue.proto b/sdk/go/gen/proto/queue.proto new file mode 100644 index 0000000..bdda8f2 --- /dev/null +++ b/sdk/go/gen/proto/queue.proto @@ -0,0 +1,59 @@ +syntax = "proto3"; + +package aether; +option go_package = "github.com/aether-io/aether/sdk/go/aetherpb"; + +import "common.proto"; + +// AetherQueue provides distributed FIFO queue operations. +// Items are stored with sequential keys under a named queue prefix. +// Enqueue appends an item; Dequeue pops the front item atomically. +service AetherQueue { + // Enqueue adds an item to the named queue. + rpc Enqueue(QueueEnqueueRequest) returns (QueueEnqueueResponse); + // Dequeue removes and returns the front item from the named queue. + // Returns NOT_FOUND if the queue is empty. + rpc Dequeue(QueueDequeueRequest) returns (QueueDequeueResponse); + // Peek returns the front item without removing it. + // Returns NOT_FOUND if the queue is empty. + rpc Peek(QueuePeekRequest) returns (QueuePeekResponse); +} + +message QueueEnqueueRequest { + // name is the queue name. + bytes name = 1; + // value is the item to enqueue. + bytes value = 2; +} + +message QueueEnqueueResponse { + ResponseHeader header = 1; + // key is the key assigned to the enqueued item. + bytes key = 2; +} + +message QueueDequeueRequest { + // name is the queue name. + bytes name = 1; +} + +message QueueDequeueResponse { + ResponseHeader header = 1; + // key is the key of the dequeued item. + bytes key = 2; + // value is the value of the dequeued item. + bytes value = 3; +} + +message QueuePeekRequest { + // name is the queue name. + bytes name = 1; +} + +message QueuePeekResponse { + ResponseHeader header = 1; + // key is the key of the front item. + bytes key = 2; + // value is the value of the front item. + bytes value = 3; +} diff --git a/sdk/go/gen/proto/raft.proto b/sdk/go/gen/proto/raft.proto new file mode 100644 index 0000000..8fc1854 --- /dev/null +++ b/sdk/go/gen/proto/raft.proto @@ -0,0 +1,36 @@ +syntax = "proto3"; + +package raft; +option go_package = "github.com/aether-io/aether/sdk/go/aetherpb"; + +// RaftRPC provides internal Raft RPCs between cluster nodes. +// Payloads are protobuf-encoded raft-rs messages. +service RaftRPC { + rpc AppendEntries(AppendEntriesRequest) returns (AppendEntriesResponse); + rpc Vote(VoteRequest) returns (VoteResponse); + rpc InstallSnapshot(InstallSnapshotRequest) returns (InstallSnapshotResponse); +} + +message AppendEntriesRequest { + bytes payload = 1; +} + +message AppendEntriesResponse { + bytes payload = 1; +} + +message VoteRequest { + bytes payload = 1; +} + +message VoteResponse { + bytes payload = 1; +} + +message InstallSnapshotRequest { + bytes payload = 1; +} + +message InstallSnapshotResponse { + bytes payload = 1; +} diff --git a/sdk/go/gen/proto/session.proto b/sdk/go/gen/proto/session.proto new file mode 100644 index 0000000..d0641ea --- /dev/null +++ b/sdk/go/gen/proto/session.proto @@ -0,0 +1,78 @@ +syntax = "proto3"; + +package aether; +option go_package = "github.com/aether-io/aether/sdk/go/aetherpb"; + +import "common.proto"; + +// AetherSession provides session management with timeout negotiation. +// A session is a higher-level abstraction over leases: it creates a lease +// with a negotiated TTL and provides session-scoped lifecycle management. +// When a session expires or is closed, all keys attached to the session +// are automatically deleted. +service AetherSession { + // Create creates a new session with the requested TTL. + // The server may adjust the TTL (timeout negotiation) — the actual + // granted TTL is returned in the response. + rpc Create(SessionCreateRequest) returns (SessionCreateResponse); + // Close closes a session and deletes all attached keys. + rpc Close(SessionCloseRequest) returns (SessionCloseResponse); + // KeepAlive maintains the session by refreshing its TTL. + // The client should send periodic KeepAlive requests at TTL/3 frequency. + // The server responds with the remaining TTL. + rpc KeepAlive(stream SessionKeepAliveRequest) returns (stream SessionKeepAliveResponse); + // Query returns information about a session. + rpc Query(SessionQueryRequest) returns (SessionQueryResponse); +} + +message SessionCreateRequest { + // ttl is the requested time-to-live in seconds. + // The server may grant a shorter TTL (timeout negotiation). + int64 ttl = 1; +} + +message SessionCreateResponse { + ResponseHeader header = 1; + // id is the session identifier (same as the underlying lease ID). + int64 id = 2; + // granted_ttl is the actual TTL granted by the server (in seconds). + // This may be shorter than the requested TTL. + int64 granted_ttl = 3; +} + +message SessionCloseRequest { + // id is the session to close. + int64 id = 1; +} + +message SessionCloseResponse { + ResponseHeader header = 1; +} + +message SessionKeepAliveRequest { + // id is the session to keep alive. + int64 id = 1; +} + +message SessionKeepAliveResponse { + ResponseHeader header = 1; + // ttl is the remaining TTL in seconds after the keep alive. + int64 ttl = 2; +} + +message SessionQueryRequest { + // id is the session to query. + int64 id = 1; +} + +message SessionQueryResponse { + ResponseHeader header = 1; + // id is the session identifier. + int64 id = 2; + // ttl is the remaining TTL in seconds. + int64 ttl = 3; + // granted_ttl is the originally granted TTL in seconds. + int64 granted_ttl = 4; + // keys is the number of keys attached to this session. + int64 keys = 5; +} diff --git a/sdk/go/gen/proto/shard.proto b/sdk/go/gen/proto/shard.proto new file mode 100644 index 0000000..a2676fe --- /dev/null +++ b/sdk/go/gen/proto/shard.proto @@ -0,0 +1,58 @@ +syntax = "proto3"; + +package aether; +option go_package = "github.com/aether-io/aether/sdk/go/aetherpb"; + +import "common.proto"; + +service AetherShard { + // GetRegion returns the region that owns the given key. + rpc GetRegion(GetRegionRequest) returns (GetRegionResponse); + + // ListRegions returns all regions in the cluster. + rpc ListRegions(ListRegionsRequest) returns (ListRegionsResponse); + + // SplitRegion splits a region at the given split key. + rpc SplitRegion(SplitRegionRequest) returns (SplitRegionResponse); +} + +message GetRegionRequest { + bytes key = 1; +} + +message GetRegionResponse { + ResponseHeader header = 1; + Region region = 2; +} + +message ListRegionsRequest {} + +message ListRegionsResponse { + ResponseHeader header = 1; + repeated Region regions = 2; +} + +message SplitRegionRequest { + uint64 region_id = 1; + bytes split_key = 2; +} + +message SplitRegionResponse { + ResponseHeader header = 1; + Region parent = 2; + Region child = 3; +} + +message Region { + uint64 id = 1; + bytes start_key = 2; + bytes end_key = 3; + RegionEpoch region_epoch = 4; + uint64 leader = 5; + repeated uint64 replicas = 6; +} + +message RegionEpoch { + uint64 conf_ver = 1; + uint64 version = 2; +} diff --git a/sdk/go/gen/proto/watch.proto b/sdk/go/gen/proto/watch.proto new file mode 100644 index 0000000..1810eff --- /dev/null +++ b/sdk/go/gen/proto/watch.proto @@ -0,0 +1,56 @@ +syntax = "proto3"; + +package aether; +option go_package = "github.com/aether-io/aether/sdk/go/aetherpb"; + +import "common.proto"; + +// AetherWatch provides watch operations for key change notifications. +service AetherWatch { + // Watch creates a watch stream. The client sends WatchRequests to + // create/cancel watches, and receives WatchResponses with events. + rpc Watch(stream WatchRequest) returns (stream WatchResponse); +} + +// WatchRequest is sent by the client on the watch stream. +message WatchRequest { + oneof request { + WatchCreateRequest create = 1; + WatchCancelRequest cancel = 2; + } +} + +// WatchCreateRequest creates a new watch. +message WatchCreateRequest { + // key is the key to watch. + bytes key = 1; + // range_end is the upper bound of the range [key, range_end). + // Empty means watch a single key. "\0" means watch all keys from key. + bytes range_end = 2; + // filters filters events by type. Empty means all event types. + repeated WatchEventType filters = 3; + // prev_kv requests the previous key-value pair in watch events. + bool prev_kv = 4; +} + +// WatchCancelRequest cancels an existing watch. +message WatchCancelRequest { + // watch_id is the ID of the watch to cancel. + int64 watch_id = 1; +} + +// WatchResponse is sent by the server on the watch stream. +message WatchResponse { + // watch_id is the ID of the watch that generated this response. + int64 watch_id = 1; + // created is set to true on the first response after a watch is created. + bool created = 2; + // events is the list of events that triggered this response. + repeated WatchEvent events = 3; + // canceled is set to true when the watch is canceled. + bool canceled = 4; + // cancel_reason is the reason the watch was canceled. + string cancel_reason = 5; + // header is included in the first response (created) with cluster metadata. + ResponseHeader header = 6; +} diff --git a/sdk/go/go.mod b/sdk/go/go.mod new file mode 100644 index 0000000..81ac54b --- /dev/null +++ b/sdk/go/go.mod @@ -0,0 +1,15 @@ +module github.com/aether-io/aether/sdk/go + +go 1.25.0 + +require ( + google.golang.org/grpc v1.81.1 + google.golang.org/protobuf v1.36.11 +) + +require ( + golang.org/x/net v0.56.0 // indirect + golang.org/x/sys v0.46.0 // indirect + golang.org/x/text v0.38.0 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20260610212136-7ab31c22f7ad // indirect +) diff --git a/sdk/go/go.sum b/sdk/go/go.sum new file mode 100644 index 0000000..03c7151 --- /dev/null +++ b/sdk/go/go.sum @@ -0,0 +1,38 @@ +github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= +github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/go-logr/logr v1.4.3 h1:CjnDlHq8ikf6E492q6eKboGOC0T8CDaOvkHCIg8idEI= +github.com/go-logr/logr v1.4.3/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= +github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= +github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= +github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= +github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +go.opentelemetry.io/auto/sdk v1.2.1 h1:jXsnJ4Lmnqd11kwkBV2LgLoFMZKizbCi5fNZ/ipaZ64= +go.opentelemetry.io/auto/sdk v1.2.1/go.mod h1:KRTj+aOaElaLi+wW1kO/DZRXwkF4C5xPbEe3ZiIhN7Y= +go.opentelemetry.io/otel v1.43.0 h1:mYIM03dnh5zfN7HautFE4ieIig9amkNANT+xcVxAj9I= +go.opentelemetry.io/otel v1.43.0/go.mod h1:JuG+u74mvjvcm8vj8pI5XiHy1zDeoCS2LB1spIq7Ay0= +go.opentelemetry.io/otel/metric v1.43.0 h1:d7638QeInOnuwOONPp4JAOGfbCEpYb+K6DVWvdxGzgM= +go.opentelemetry.io/otel/metric v1.43.0/go.mod h1:RDnPtIxvqlgO8GRW18W6Z/4P462ldprJtfxHxyKd2PY= +go.opentelemetry.io/otel/sdk v1.43.0 h1:pi5mE86i5rTeLXqoF/hhiBtUNcrAGHLKQdhg4h4V9Dg= +go.opentelemetry.io/otel/sdk v1.43.0/go.mod h1:P+IkVU3iWukmiit/Yf9AWvpyRDlUeBaRg6Y+C58QHzg= +go.opentelemetry.io/otel/sdk/metric v1.43.0 h1:S88dyqXjJkuBNLeMcVPRFXpRw2fuwdvfCGLEo89fDkw= +go.opentelemetry.io/otel/sdk/metric v1.43.0/go.mod h1:C/RJtwSEJ5hzTiUz5pXF1kILHStzb9zFlIEe85bhj6A= +go.opentelemetry.io/otel/trace v1.43.0 h1:BkNrHpup+4k4w+ZZ86CZoHHEkohws8AY+WTX09nk+3A= +go.opentelemetry.io/otel/trace v1.43.0/go.mod h1:/QJhyVBUUswCphDVxq+8mld+AvhXZLhe+8WVFxiFff0= +golang.org/x/net v0.56.0 h1:Rw8j/hFzGvJUZwNBXnAtf5sVDVt+65SK2C7IxCxZt5o= +golang.org/x/net v0.56.0/go.mod h1:D3Ku6r+V6JROoZK144D2XfMHFcMq/0zSfLelVTCFKec= +golang.org/x/sys v0.46.0 h1:noSf2Fq6F8DBgS+LysIkx7rIExoNHJsxOAtPp4rthXw= +golang.org/x/sys v0.46.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= +golang.org/x/text v0.38.0 h1:sXmwo9DwP3OK9EZ7PqAdaooSGozfl/3a6/xJcbzPRhE= +golang.org/x/text v0.38.0/go.mod h1:YXZt3QhHUKYT53r2lLKFIVi6Ao1jdzrTR/KQ09qyxF4= +gonum.org/v1/gonum v0.17.0 h1:VbpOemQlsSMrYmn7T2OUvQ4dqxQXU+ouZFQsZOx50z4= +gonum.org/v1/gonum v0.17.0/go.mod h1:El3tOrEuMpv2UdMrbNlKEh9vd86bmQ6vqIcDwxEOc1E= +google.golang.org/genproto/googleapis/rpc v0.0.0-20260610212136-7ab31c22f7ad h1:45WmJvIV6C2+O/jjLkPUH+F3aOj/1miDoU2DD0+NWbg= +google.golang.org/genproto/googleapis/rpc v0.0.0-20260610212136-7ab31c22f7ad/go.mod h1:4Hqkh8ycfw05ld/3BWL7rJOSfebL2Q+DVDeRgYgxUU8= +google.golang.org/grpc v1.81.1 h1:VnnIIZ88UzOOKLukQi+ImGz8O1Wdp8nAGGnvOfEIWQQ= +google.golang.org/grpc v1.81.1/go.mod h1:xGH9GfzOyMTGIOXBJmXt+BX/V0kcdQbdcuwQ/zNw42I= +google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBNVE= +google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= diff --git a/sdk/go/kv.go b/sdk/go/kv.go new file mode 100644 index 0000000..befc696 --- /dev/null +++ b/sdk/go/kv.go @@ -0,0 +1,144 @@ +package aether + +import ( + "context" + + pb "github.com/aether-io/aether/sdk/go/aetherpb" +) + +// KVClient provides key-value operations. +type KVClient struct { + conn pb.AetherKVClient +} + +// Put puts a key-value pair into the store. +func (c *KVClient) Put(ctx context.Context, key, value []byte, opts ...PutOption) (*pb.PutResponse, error) { + req := &pb.PutRequest{Key: key, Value: value} + for _, opt := range opts { + opt(req) + } + return c.conn.Put(ctx, req) +} + +// Get retrieves a key or range of keys from the store. +func (c *KVClient) Get(ctx context.Context, key []byte, opts ...GetOption) (*pb.GetResponse, error) { + req := &pb.GetRequest{Key: key} + for _, opt := range opts { + opt(req) + } + return c.conn.Get(ctx, req) +} + +// Delete deletes a key or range of keys from the store. +func (c *KVClient) Delete(ctx context.Context, key []byte, opts ...DeleteOption) (*pb.DeleteResponse, error) { + req := &pb.DeleteRequest{Key: key} + for _, opt := range opts { + opt(req) + } + return c.conn.Delete(ctx, req) +} + +// Range retrieves keys in the range [key, range_end). +func (c *KVClient) Range(ctx context.Context, key, rangeEnd []byte, opts ...RangeOption) (*pb.RangeResponse, error) { + req := &pb.RangeRequest{Key: key, RangeEnd: rangeEnd} + for _, opt := range opts { + opt(req) + } + return c.conn.Range(ctx, req) +} + +// Txn processes multiple operations in a single transaction. +func (c *KVClient) Txn(ctx context.Context, req *pb.TxnRequest) (*pb.TxnResponse, error) { + return c.conn.Txn(ctx, req) +} + +// --- Put options --- + +// PutOption configures a Put request. +type PutOption func(*pb.PutRequest) + +// WithLease attaches a lease to the key. +func WithLease(leaseID int64) PutOption { + return func(r *pb.PutRequest) { r.Lease = leaseID } +} + +// WithPrevKV requests the previous key-value pair in the response. +func WithPrevKV() PutOption { + return func(r *pb.PutRequest) { r.PrevKv = true } +} + +// --- Get options --- + +// GetOption configures a Get request. +type GetOption func(*pb.GetRequest) + +// WithRangeEnd sets the upper bound of the range. +func WithRangeEnd(rangeEnd []byte) GetOption { + return func(r *pb.GetRequest) { r.RangeEnd = rangeEnd } +} + +// WithLimit sets the maximum number of keys to return. +func WithLimit(limit int64) GetOption { + return func(r *pb.GetRequest) { r.Limit = limit } +} + +// WithRevision reads at a specific point-in-time revision. +func WithRevision(rev int64) GetOption { + return func(r *pb.GetRequest) { r.Revision = rev } +} + +// WithSerializable enables serializable reads (may read stale data). +func WithSerializable() GetOption { + return func(r *pb.GetRequest) { r.Serializable = true } +} + +// WithSort sets the sort order and target for range results. +func WithSort(order pb.SortOrder, target pb.SortTarget) GetOption { + return func(r *pb.GetRequest) { + r.SortOrder = order + r.SortTarget = target + } +} + +// --- Delete options --- + +// DeleteOption configures a Delete request. +type DeleteOption func(*pb.DeleteRequest) + +// DeleteWithRangeEnd sets the upper bound of the range to delete. +func DeleteWithRangeEnd(rangeEnd []byte) DeleteOption { + return func(r *pb.DeleteRequest) { r.RangeEnd = rangeEnd } +} + +// DeleteWithPrevKV requests the deleted key-value pairs in the response. +func DeleteWithPrevKV() DeleteOption { + return func(r *pb.DeleteRequest) { r.PrevKv = true } +} + +// --- Range options --- + +// RangeOption configures a Range request. +type RangeOption func(*pb.RangeRequest) + +// RangeWithLimit sets the maximum number of keys to return. +func RangeWithLimit(limit int64) RangeOption { + return func(r *pb.RangeRequest) { r.Limit = limit } +} + +// RangeWithRevision reads at a specific point-in-time revision. +func RangeWithRevision(rev int64) RangeOption { + return func(r *pb.RangeRequest) { r.Revision = rev } +} + +// RangeWithSort sets the sort order and target. +func RangeWithSort(order pb.SortOrder, target pb.SortTarget) RangeOption { + return func(r *pb.RangeRequest) { + r.SortOrder = order + r.SortTarget = target + } +} + +// RangeWithSerializable enables serializable reads. +func RangeWithSerializable() RangeOption { + return func(r *pb.RangeRequest) { r.Serializable = true } +} diff --git a/sdk/go/lease.go b/sdk/go/lease.go new file mode 100644 index 0000000..bf6b8c9 --- /dev/null +++ b/sdk/go/lease.go @@ -0,0 +1,123 @@ +package aether + +import ( + "context" + "errors" + "sync" + "sync/atomic" + "time" + + pb "github.com/aether-io/aether/sdk/go/aetherpb" +) + +// LeaseClient provides lease management operations. +type LeaseClient struct { + conn pb.AetherLeaseClient +} + +// Grant creates a new lease with the given TTL. +func (c *LeaseClient) Grant(ctx context.Context, ttl int64) (*pb.LeaseGrantResponse, error) { + return c.conn.LeaseGrant(ctx, &pb.LeaseGrantRequest{Ttl: ttl}) +} + +// Revoke revokes a lease and deletes all attached keys. +func (c *LeaseClient) Revoke(ctx context.Context, id int64) (*pb.LeaseRevokeResponse, error) { + return c.conn.LeaseRevoke(ctx, &pb.LeaseRevokeRequest{Id: id}) +} + +// TimeToLive returns the remaining TTL of a lease. +func (c *LeaseClient) TimeToLive(ctx context.Context, id int64, keys bool) (*pb.LeaseTimeToLiveResponse, error) { + return c.conn.LeaseTimeToLive(ctx, &pb.LeaseTimeToLiveRequest{Id: id, Keys: keys}) +} + +// Leases lists all active leases. +func (c *LeaseClient) Leases(ctx context.Context) (*pb.LeaseLeasesResponse, error) { + return c.conn.LeaseLeases(ctx, &pb.LeaseLeasesRequest{}) +} + +// KeepAlive starts a keep-alive stream for the given lease. +func (c *LeaseClient) KeepAlive(ctx context.Context, id int64) (*LeaseKeepAlive, error) { + stream, err := c.conn.LeaseKeepAlive(ctx) + if err != nil { + return nil, err + } + return &LeaseKeepAlive{stream: stream, id: id}, nil +} + +// LeaseKeepAlive manages a lease keep-alive stream. +type LeaseKeepAlive struct { + stream pb.AetherLease_LeaseKeepAliveClient + id int64 +} + +// Send sends a keep-alive request for the lease. +func (k *LeaseKeepAlive) Send() error { + return k.stream.Send(&pb.LeaseKeepAliveRequest{Id: k.id}) +} + +// Recv receives the keep-alive response. +func (k *LeaseKeepAlive) Recv() (*pb.LeaseKeepAliveResponse, error) { + return k.stream.Recv() +} + +// StartKeepAlive starts a background goroutine that sends keep-alive requests +// at the given interval. Returns a stop function that cancels the goroutine. +// If onError is non-nil, it is called when the keep-alive stream encounters an +// error (e.g. connection drop). The goroutine exits after calling onError. +func (c *LeaseClient) StartKeepAlive(ctx context.Context, id int64, interval time.Duration, onError func(error)) (stop func(), err error) { + if interval <= 0 { + return nil, errors.New("aether: keepalive interval must be positive") + } + ctx, cancel := context.WithCancel(ctx) + ka, err := c.KeepAlive(ctx, id) + if err != nil { + cancel() + return nil, err + } + + var once sync.Once + var stopped atomic.Bool + reportError := func(err error) { + once.Do(func() { + if onError != nil { + onError(err) + } + }) + } + + go func() { + defer cancel() + ticker := time.NewTicker(interval) + defer ticker.Stop() + for { + select { + case <-ctx.Done(): + return + case <-ticker.C: + if err := ka.Send(); err != nil { + if !stopped.Load() { + reportError(err) + } + return + } + } + } + }() + + go func() { + for { + if _, err := ka.Recv(); err != nil { + if !stopped.Load() { + reportError(err) + } + cancel() + return + } + } + }() + + return func() { + stopped.Store(true) + cancel() + }, nil +} diff --git a/sdk/go/lock.go b/sdk/go/lock.go new file mode 100644 index 0000000..71f0908 --- /dev/null +++ b/sdk/go/lock.go @@ -0,0 +1,29 @@ +package aether + +import ( + "context" + + pb "github.com/aether-io/aether/sdk/go/aetherpb" +) + +// LockClient provides distributed lock operations. +type LockClient struct { + conn pb.AetherLockClient +} + +// Lock acquires a distributed lock with the given name. +// The lock is associated with the provided leaseID and will be +// automatically released when the lease expires. +func (c *LockClient) Lock(ctx context.Context, name []byte, leaseID int64) (*pb.LockResponse, error) { + return c.conn.Lock(ctx, &pb.LockRequest{Name: name, LeaseId: leaseID}) +} + +// Unlock releases a distributed lock. +func (c *LockClient) Unlock(ctx context.Context, key []byte) (*pb.UnlockResponse, error) { + return c.conn.Unlock(ctx, &pb.UnlockRequest{Key: key}) +} + +// Query returns information about a lock. +func (c *LockClient) Query(ctx context.Context, name []byte) (*pb.LockQueryResponse, error) { + return c.conn.LockQuery(ctx, &pb.LockQueryRequest{Name: name}) +} diff --git a/sdk/go/maintenance.go b/sdk/go/maintenance.go new file mode 100644 index 0000000..9607968 --- /dev/null +++ b/sdk/go/maintenance.go @@ -0,0 +1,24 @@ +package aether + +import ( + "context" + + pb "github.com/aether-io/aether/sdk/go/aetherpb" +) + +// MaintenanceClient provides operational tools for cluster maintenance. +type MaintenanceClient struct { + conn pb.AetherMaintenanceClient +} + +func (c *MaintenanceClient) Defrag(ctx context.Context) (*pb.DefragResponse, error) { + return c.conn.Defrag(ctx, &pb.DefragRequest{}) +} + +func (c *MaintenanceClient) Alarm(ctx context.Context, action pb.AlarmAction, alarmType pb.AlarmType, memberID uint64) (*pb.AlarmResponse, error) { + return c.conn.Alarm(ctx, &pb.AlarmRequest{Action: action, Alarm: alarmType, MemberId: memberID}) +} + +func (c *MaintenanceClient) Status(ctx context.Context) (*pb.StatusResponse, error) { + return c.conn.Status(ctx, &pb.StatusRequest{}) +} diff --git a/sdk/go/queue.go b/sdk/go/queue.go new file mode 100644 index 0000000..6ebc415 --- /dev/null +++ b/sdk/go/queue.go @@ -0,0 +1,27 @@ +package aether + +import ( + "context" + + pb "github.com/aether-io/aether/sdk/go/aetherpb" +) + +// QueueClient provides distributed FIFO queue operations. +type QueueClient struct { + conn pb.AetherQueueClient +} + +// Enqueue adds an item to the named queue. +func (c *QueueClient) Enqueue(ctx context.Context, name, value []byte) (*pb.QueueEnqueueResponse, error) { + return c.conn.Enqueue(ctx, &pb.QueueEnqueueRequest{Name: name, Value: value}) +} + +// Dequeue removes and returns the front item from the named queue. +func (c *QueueClient) Dequeue(ctx context.Context, name []byte) (*pb.QueueDequeueResponse, error) { + return c.conn.Dequeue(ctx, &pb.QueueDequeueRequest{Name: name}) +} + +// Peek returns the front item without removing it. +func (c *QueueClient) Peek(ctx context.Context, name []byte) (*pb.QueuePeekResponse, error) { + return c.conn.Peek(ctx, &pb.QueuePeekRequest{Name: name}) +} diff --git a/sdk/go/session.go b/sdk/go/session.go new file mode 100644 index 0000000..2f065f8 --- /dev/null +++ b/sdk/go/session.go @@ -0,0 +1,118 @@ +package aether + +import ( + "context" + "errors" + "sync" + "sync/atomic" + "time" + + pb "github.com/aether-io/aether/sdk/go/aetherpb" +) + +// SessionClient provides session management operations. +type SessionClient struct { + conn pb.AetherSessionClient +} + +// Create creates a new session with the requested TTL. +func (c *SessionClient) Create(ctx context.Context, ttl int64) (*pb.SessionCreateResponse, error) { + return c.conn.Create(ctx, &pb.SessionCreateRequest{Ttl: ttl}) +} + +// Close closes a session and deletes all attached keys. +func (c *SessionClient) Close(ctx context.Context, id int64) (*pb.SessionCloseResponse, error) { + return c.conn.Close(ctx, &pb.SessionCloseRequest{Id: id}) +} + +// Query returns information about a session. +func (c *SessionClient) Query(ctx context.Context, id int64) (*pb.SessionQueryResponse, error) { + return c.conn.Query(ctx, &pb.SessionQueryRequest{Id: id}) +} + +// KeepAlive starts a keep-alive stream for the given session. +func (c *SessionClient) KeepAlive(ctx context.Context, id int64) (*SessionKeepAlive, error) { + stream, err := c.conn.KeepAlive(ctx) + if err != nil { + return nil, err + } + return &SessionKeepAlive{stream: stream, id: id}, nil +} + +// SessionKeepAlive manages a session keep-alive stream. +type SessionKeepAlive struct { + stream pb.AetherSession_KeepAliveClient + id int64 +} + +// Send sends a keep-alive request for the session. +func (k *SessionKeepAlive) Send() error { + return k.stream.Send(&pb.SessionKeepAliveRequest{Id: k.id}) +} + +// Recv receives the keep-alive response. +func (k *SessionKeepAlive) Recv() (*pb.SessionKeepAliveResponse, error) { + return k.stream.Recv() +} + +// StartKeepAlive starts a background goroutine that sends keep-alive requests +// at the given interval. Returns a stop function that cancels the goroutine. +// If onError is non-nil, it is called when the keep-alive stream encounters an +// error (e.g. connection drop). The goroutine exits after calling onError. +func (c *SessionClient) StartKeepAlive(ctx context.Context, id int64, interval time.Duration, onError func(error)) (stop func(), err error) { + if interval <= 0 { + return nil, errors.New("aether: keepalive interval must be positive") + } + ctx, cancel := context.WithCancel(ctx) + ka, err := c.KeepAlive(ctx, id) + if err != nil { + cancel() + return nil, err + } + + var once sync.Once + var stopped atomic.Bool + reportError := func(err error) { + once.Do(func() { + if onError != nil { + onError(err) + } + }) + } + + go func() { + defer cancel() + ticker := time.NewTicker(interval) + defer ticker.Stop() + for { + select { + case <-ctx.Done(): + return + case <-ticker.C: + if err := ka.Send(); err != nil { + if !stopped.Load() { + reportError(err) + } + return + } + } + } + }() + + go func() { + for { + if _, err := ka.Recv(); err != nil { + if !stopped.Load() { + reportError(err) + } + cancel() + return + } + } + }() + + return func() { + stopped.Store(true) + cancel() + }, nil +} diff --git a/sdk/go/shard.go b/sdk/go/shard.go new file mode 100644 index 0000000..0ff080f --- /dev/null +++ b/sdk/go/shard.go @@ -0,0 +1,24 @@ +package aether + +import ( + "context" + + pb "github.com/aether-io/aether/sdk/go/aetherpb" +) + +// ShardClient provides data sharding operations. +type ShardClient struct { + conn pb.AetherShardClient +} + +func (c *ShardClient) GetRegion(ctx context.Context, key []byte) (*pb.GetRegionResponse, error) { + return c.conn.GetRegion(ctx, &pb.GetRegionRequest{Key: key}) +} + +func (c *ShardClient) ListRegions(ctx context.Context) (*pb.ListRegionsResponse, error) { + return c.conn.ListRegions(ctx, &pb.ListRegionsRequest{}) +} + +func (c *ShardClient) SplitRegion(ctx context.Context, regionID uint64, splitKey []byte) (*pb.SplitRegionResponse, error) { + return c.conn.SplitRegion(ctx, &pb.SplitRegionRequest{RegionId: regionID, SplitKey: splitKey}) +} diff --git a/sdk/go/watch.go b/sdk/go/watch.go new file mode 100644 index 0000000..6c281ee --- /dev/null +++ b/sdk/go/watch.go @@ -0,0 +1,88 @@ +package aether + +import ( + "context" + "io" + "sync" + + pb "github.com/aether-io/aether/sdk/go/aetherpb" +) + +// WatchClient provides watch operations for key change notifications. +type WatchClient struct { + conn pb.AetherWatchClient +} + +// Watch creates a bidirectional watch stream. +func (c *WatchClient) Watch(ctx context.Context) (*WatchStream, error) { + stream, err := c.conn.Watch(ctx) + if err != nil { + return nil, err + } + return &WatchStream{stream: stream, ctx: ctx}, nil +} + +// WatchStream is a bidirectional watch stream. +type WatchStream struct { + stream pb.AetherWatch_WatchClient + ctx context.Context + recvOnce sync.Once + recvCh <-chan WatchResult +} + +// Create sends a watch create request for a key or key range. +func (s *WatchStream) Create(req *pb.WatchCreateRequest) error { + return s.stream.Send(&pb.WatchRequest{ + Request: &pb.WatchRequest_Create{Create: req}, + }) +} + +// Cancel sends a watch cancel request. +func (s *WatchStream) Cancel(watchID int64) error { + return s.stream.Send(&pb.WatchRequest{ + Request: &pb.WatchRequest_Cancel{Cancel: &pb.WatchCancelRequest{WatchId: watchID}}, + }) +} + +// Recv receives the next watch response from the stream. +func (s *WatchStream) Recv() (*pb.WatchResponse, error) { + return s.stream.Recv() +} + +// RecvChan returns a channel that yields watch responses. +// The channel is closed when the stream ends or an error occurs. +// Cancel the context passed to Watch() to stop the stream and close the channel. +// Safe to call multiple times — only the first call spawns the goroutine. +func (s *WatchStream) RecvChan() <-chan WatchResult { + s.recvOnce.Do(func() { + ch := make(chan WatchResult, 16) + s.recvCh = ch + go func() { + defer close(ch) + for { + resp, err := s.stream.Recv() + if err != nil { + if err != io.EOF { + select { + case ch <- WatchResult{Err: err}: + case <-s.ctx.Done(): + } + } + return + } + select { + case ch <- WatchResult{Response: resp}: + case <-s.ctx.Done(): + return + } + } + }() + }) + return s.recvCh +} + +// WatchResult wraps a watch response or error. +type WatchResult struct { + Response *pb.WatchResponse + Err error +}