Add load space methods and fix storage errors

This commit is contained in:
mcrakhman 2022-12-02 09:52:04 +01:00
parent 4593637e23
commit ea9a51ec02
No known key found for this signature in database
GPG Key ID: DED12CFEF5B8396B
9 changed files with 410 additions and 40 deletions

View File

@ -786,6 +786,86 @@ func (m *AllSpacesResponse) GetSpaceIds() []string {
return nil return nil
} }
type LoadSpaceRequest struct {
SpaceId string `protobuf:"bytes,1,opt,name=spaceId,proto3" json:"spaceId,omitempty"`
}
func (m *LoadSpaceRequest) Reset() { *m = LoadSpaceRequest{} }
func (m *LoadSpaceRequest) String() string { return proto.CompactTextString(m) }
func (*LoadSpaceRequest) ProtoMessage() {}
func (*LoadSpaceRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_fc31080c27db9707, []int{17}
}
func (m *LoadSpaceRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *LoadSpaceRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_LoadSpaceRequest.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *LoadSpaceRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_LoadSpaceRequest.Merge(m, src)
}
func (m *LoadSpaceRequest) XXX_Size() int {
return m.Size()
}
func (m *LoadSpaceRequest) XXX_DiscardUnknown() {
xxx_messageInfo_LoadSpaceRequest.DiscardUnknown(m)
}
var xxx_messageInfo_LoadSpaceRequest proto.InternalMessageInfo
func (m *LoadSpaceRequest) GetSpaceId() string {
if m != nil {
return m.SpaceId
}
return ""
}
type LoadSpaceResponse struct {
}
func (m *LoadSpaceResponse) Reset() { *m = LoadSpaceResponse{} }
func (m *LoadSpaceResponse) String() string { return proto.CompactTextString(m) }
func (*LoadSpaceResponse) ProtoMessage() {}
func (*LoadSpaceResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_fc31080c27db9707, []int{18}
}
func (m *LoadSpaceResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *LoadSpaceResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_LoadSpaceResponse.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *LoadSpaceResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_LoadSpaceResponse.Merge(m, src)
}
func (m *LoadSpaceResponse) XXX_Size() int {
return m.Size()
}
func (m *LoadSpaceResponse) XXX_DiscardUnknown() {
xxx_messageInfo_LoadSpaceResponse.DiscardUnknown(m)
}
var xxx_messageInfo_LoadSpaceResponse proto.InternalMessageInfo
func init() { func init() {
proto.RegisterType((*CreateSpaceRequest)(nil), "api.CreateSpaceRequest") proto.RegisterType((*CreateSpaceRequest)(nil), "api.CreateSpaceRequest")
proto.RegisterType((*CreateSpaceResponse)(nil), "api.CreateSpaceResponse") proto.RegisterType((*CreateSpaceResponse)(nil), "api.CreateSpaceResponse")
@ -804,45 +884,48 @@ func init() {
proto.RegisterType((*AllTreesResponse)(nil), "api.AllTreesResponse") proto.RegisterType((*AllTreesResponse)(nil), "api.AllTreesResponse")
proto.RegisterType((*AllSpacesRequest)(nil), "api.AllSpacesRequest") proto.RegisterType((*AllSpacesRequest)(nil), "api.AllSpacesRequest")
proto.RegisterType((*AllSpacesResponse)(nil), "api.AllSpacesResponse") proto.RegisterType((*AllSpacesResponse)(nil), "api.AllSpacesResponse")
proto.RegisterType((*LoadSpaceRequest)(nil), "api.LoadSpaceRequest")
proto.RegisterType((*LoadSpaceResponse)(nil), "api.LoadSpaceResponse")
} }
func init() { proto.RegisterFile("api/apiproto/protos/api.proto", fileDescriptor_fc31080c27db9707) } func init() { proto.RegisterFile("api/apiproto/protos/api.proto", fileDescriptor_fc31080c27db9707) }
var fileDescriptor_fc31080c27db9707 = []byte{ var fileDescriptor_fc31080c27db9707 = []byte{
// 517 bytes of a gzipped FileDescriptorProto // 544 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x54, 0x4d, 0x8f, 0xd2, 0x50, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x55, 0x4d, 0x6f, 0xd3, 0x40,
0x14, 0xa5, 0xc0, 0x7c, 0xf4, 0x60, 0x60, 0xbc, 0x03, 0xd8, 0xd4, 0x58, 0xc9, 0x4b, 0x9c, 0x90, 0x10, 0x8d, 0x93, 0xf4, 0xc3, 0x13, 0x94, 0xa4, 0x93, 0x0f, 0x2c, 0x23, 0x4c, 0xb4, 0x12, 0x55,
0x68, 0x86, 0x38, 0x63, 0x62, 0xe2, 0x6a, 0x70, 0xd8, 0x10, 0x57, 0xe2, 0xac, 0x5c, 0x98, 0xd4, 0x24, 0xaa, 0x46, 0xb4, 0x48, 0x48, 0x9c, 0x1a, 0x9a, 0x4b, 0x04, 0x17, 0x42, 0x4f, 0x1c, 0x90,
0xe9, 0x4b, 0x6c, 0xc2, 0xc7, 0x93, 0x16, 0x33, 0x7f, 0xc1, 0x9d, 0x3f, 0xcb, 0xe5, 0x2c, 0x5d, 0x4c, 0x77, 0x25, 0x2c, 0x25, 0xf1, 0x12, 0x3b, 0xa8, 0x3f, 0x83, 0x3f, 0x85, 0xc4, 0xb1, 0x47,
0x1a, 0xf8, 0x23, 0xa6, 0xaf, 0xb7, 0xa5, 0x1f, 0x4c, 0xcc, 0x64, 0x36, 0xf0, 0xee, 0x79, 0xf7, 0x8e, 0x28, 0xf9, 0x23, 0xc8, 0xeb, 0xf1, 0xd7, 0x3a, 0x05, 0x55, 0xbd, 0x24, 0x9e, 0xb7, 0xf3,
0x9c, 0x7b, 0x4b, 0xcf, 0x01, 0xcf, 0x5c, 0xe5, 0x0f, 0x5c, 0xe5, 0xab, 0xe5, 0x22, 0x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, 0x48, 0xac, 0xd7, 0x70, 0x98, 0xb8, 0x13, 0xe3, 0x0e, 0xcd, 0xf9, 0x76, 0x4f, 0x43, 0x33,
0xc4, 0xee, 0x16, 0xe1, 0x98, 0xfb, 0xfe, 0xe4, 0xf7, 0xda, 0x31, 0x6e, 0xd7, 0x8e, 0xf1, 0x77, 0x62, 0xe2, 0x29, 0x22, 0x6a, 0xee, 0x25, 0x62, 0xc9, 0x78, 0x6f, 0xc0, 0x4c, 0x3d, 0x84, 0x69,
0xed, 0x18, 0xbf, 0x36, 0x4e, 0xe5, 0x76, 0xe3, 0x54, 0xfe, 0x6c, 0x9c, 0xca, 0xe7, 0x47, 0xd9, 0x4f, 0xc1, 0x67, 0x76, 0x5f, 0x87, 0x33, 0x6e, 0x6a, 0x10, 0xe2, 0xea, 0xf6, 0x22, 0x6e, 0xc9,
0xbf, 0xe0, 0xaf, 0xfb, 0xfa, 0xeb, 0xfc, 0x5f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x38, 0x60, 0xfe, 0x47, 0x6f, 0x8f, 0x7f, 0x6d, 0x1c, 0xe3, 0x76, 0xe3, 0x18, 0x7f, 0x36, 0x8e, 0xf1, 0x63, 0xeb,
0x5b, 0x99, 0x05, 0x00, 0x00, 0x54, 0x6e, 0xb7, 0x4e, 0xe5, 0xf7, 0xd6, 0xa9, 0x7c, 0x7a, 0x94, 0xff, 0x07, 0xf8, 0xb2, 0xaf,
0xbe, 0xce, 0xff, 0x06, 0x00, 0x00, 0xff, 0xff, 0x7a, 0xb5, 0x35, 0xcb, 0x18, 0x06, 0x00, 0x00,
} }
func (m *CreateSpaceRequest) Marshal() (dAtA []byte, err error) { func (m *CreateSpaceRequest) Marshal() (dAtA []byte, err error) {
@ -1380,6 +1463,59 @@ func (m *AllSpacesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
return len(dAtA) - i, nil return len(dAtA) - i, nil
} }
func (m *LoadSpaceRequest) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *LoadSpaceRequest) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *LoadSpaceRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.SpaceId) > 0 {
i -= len(m.SpaceId)
copy(dAtA[i:], m.SpaceId)
i = encodeVarintApi(dAtA, i, uint64(len(m.SpaceId)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *LoadSpaceResponse) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *LoadSpaceResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *LoadSpaceResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
return len(dAtA) - i, nil
}
func encodeVarintApi(dAtA []byte, offset int, v uint64) int { func encodeVarintApi(dAtA []byte, offset int, v uint64) int {
offset -= sovApi(v) offset -= sovApi(v)
base := offset base := offset
@ -1626,6 +1762,28 @@ func (m *AllSpacesResponse) Size() (n int) {
return n return n
} }
func (m *LoadSpaceRequest) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.SpaceId)
if l > 0 {
n += 1 + l + sovApi(uint64(l))
}
return n
}
func (m *LoadSpaceResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
return n
}
func sovApi(x uint64) (n int) { func sovApi(x uint64) (n int) {
return (math_bits.Len64(x|1) + 6) / 7 return (math_bits.Len64(x|1) + 6) / 7
} }
@ -3092,6 +3250,138 @@ func (m *AllSpacesResponse) Unmarshal(dAtA []byte) error {
} }
return nil return nil
} }
func (m *LoadSpaceRequest) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowApi
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: LoadSpaceRequest: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: LoadSpaceRequest: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field SpaceId", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowApi
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthApi
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthApi
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.SpaceId = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipApi(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthApi
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *LoadSpaceResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowApi
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: LoadSpaceResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: LoadSpaceResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
default:
iNdEx = preIndex
skippy, err := skipApi(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthApi
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func skipApi(dAtA []byte) (n int, err error) { func skipApi(dAtA []byte) (n int, err error) {
l := len(dAtA) l := len(dAtA)
iNdEx := 0 iNdEx := 0

View File

@ -48,6 +48,7 @@ type DRPCClientApiClient interface {
DumpTree(ctx context.Context, in *DumpTreeRequest) (*DumpTreeResponse, error) DumpTree(ctx context.Context, in *DumpTreeRequest) (*DumpTreeResponse, error)
AllTrees(ctx context.Context, in *AllTreesRequest) (*AllTreesResponse, error) AllTrees(ctx context.Context, in *AllTreesRequest) (*AllTreesResponse, error)
AllSpaces(ctx context.Context, in *AllSpacesRequest) (*AllSpacesResponse, error) AllSpaces(ctx context.Context, in *AllSpacesRequest) (*AllSpacesResponse, error)
LoadSpace(ctx context.Context, in *LoadSpaceRequest) (*LoadSpaceResponse, error)
} }
type drpcClientApiClient struct { type drpcClientApiClient struct {
@ -132,6 +133,15 @@ func (c *drpcClientApiClient) AllSpaces(ctx context.Context, in *AllSpacesReques
return out, nil return out, nil
} }
func (c *drpcClientApiClient) LoadSpace(ctx context.Context, in *LoadSpaceRequest) (*LoadSpaceResponse, error) {
out := new(LoadSpaceResponse)
err := c.cc.Invoke(ctx, "/api.ClientApi/LoadSpace", drpcEncoding_File_api_apiproto_protos_api_proto{}, in, out)
if err != nil {
return nil, err
}
return out, nil
}
type DRPCClientApiServer interface { type DRPCClientApiServer interface {
CreateSpace(context.Context, *CreateSpaceRequest) (*CreateSpaceResponse, error) CreateSpace(context.Context, *CreateSpaceRequest) (*CreateSpaceResponse, error)
DeriveSpace(context.Context, *DeriveSpaceRequest) (*DeriveSpaceResponse, error) DeriveSpace(context.Context, *DeriveSpaceRequest) (*DeriveSpaceResponse, error)
@ -141,6 +151,7 @@ type DRPCClientApiServer interface {
DumpTree(context.Context, *DumpTreeRequest) (*DumpTreeResponse, error) DumpTree(context.Context, *DumpTreeRequest) (*DumpTreeResponse, error)
AllTrees(context.Context, *AllTreesRequest) (*AllTreesResponse, error) AllTrees(context.Context, *AllTreesRequest) (*AllTreesResponse, error)
AllSpaces(context.Context, *AllSpacesRequest) (*AllSpacesResponse, error) AllSpaces(context.Context, *AllSpacesRequest) (*AllSpacesResponse, error)
LoadSpace(context.Context, *LoadSpaceRequest) (*LoadSpaceResponse, error)
} }
type DRPCClientApiUnimplementedServer struct{} type DRPCClientApiUnimplementedServer struct{}
@ -177,9 +188,13 @@ func (s *DRPCClientApiUnimplementedServer) AllSpaces(context.Context, *AllSpaces
return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented) return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented)
} }
func (s *DRPCClientApiUnimplementedServer) LoadSpace(context.Context, *LoadSpaceRequest) (*LoadSpaceResponse, error) {
return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented)
}
type DRPCClientApiDescription struct{} type DRPCClientApiDescription struct{}
func (DRPCClientApiDescription) NumMethods() int { return 8 } func (DRPCClientApiDescription) NumMethods() int { return 9 }
func (DRPCClientApiDescription) Method(n int) (string, drpc.Encoding, drpc.Receiver, interface{}, bool) { func (DRPCClientApiDescription) Method(n int) (string, drpc.Encoding, drpc.Receiver, interface{}, bool) {
switch n { switch n {
@ -255,6 +270,15 @@ func (DRPCClientApiDescription) Method(n int) (string, drpc.Encoding, drpc.Recei
in1.(*AllSpacesRequest), in1.(*AllSpacesRequest),
) )
}, DRPCClientApiServer.AllSpaces, true }, DRPCClientApiServer.AllSpaces, true
case 8:
return "/api.ClientApi/LoadSpace", drpcEncoding_File_api_apiproto_protos_api_proto{},
func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) {
return srv.(DRPCClientApiServer).
LoadSpace(
ctx,
in1.(*LoadSpaceRequest),
)
}, DRPCClientApiServer.LoadSpace, true
default: default:
return "", nil, nil, nil, false return "", nil, nil, nil, false
} }
@ -391,3 +415,19 @@ func (x *drpcClientApi_AllSpacesStream) SendAndClose(m *AllSpacesResponse) error
} }
return x.CloseSend() return x.CloseSend()
} }
type DRPCClientApi_LoadSpaceStream interface {
drpc.Stream
SendAndClose(*LoadSpaceResponse) error
}
type drpcClientApi_LoadSpaceStream struct {
drpc.Stream
}
func (x *drpcClientApi_LoadSpaceStream) SendAndClose(m *LoadSpaceResponse) error {
if err := x.MsgSend(m, drpcEncoding_File_api_apiproto_protos_api_proto{}); err != nil {
return err
}
return x.CloseSend()
}

View File

@ -12,6 +12,7 @@ service ClientApi {
rpc DumpTree(DumpTreeRequest) returns(DumpTreeResponse); rpc DumpTree(DumpTreeRequest) returns(DumpTreeResponse);
rpc AllTrees(AllTreesRequest) returns(AllTreesResponse); rpc AllTrees(AllTreesRequest) returns(AllTreesResponse);
rpc AllSpaces(AllSpacesRequest) returns(AllSpacesResponse); rpc AllSpaces(AllSpacesRequest) returns(AllSpacesResponse);
rpc LoadSpace(LoadSpaceRequest) returns(LoadSpaceResponse);
} }
message CreateSpaceRequest { message CreateSpaceRequest {
@ -83,3 +84,10 @@ message AllSpacesRequest {
message AllSpacesResponse { message AllSpacesResponse {
repeated string spaceIds = 1; repeated string spaceIds = 1;
} }
message LoadSpaceRequest {
string spaceId = 1;
}
message LoadSpaceResponse {
}

View File

@ -9,6 +9,15 @@ type rpcHandler struct {
controller Controller controller Controller
} }
func (r *rpcHandler) LoadSpace(ctx context.Context, request *apiproto.LoadSpaceRequest) (resp *apiproto.LoadSpaceResponse, err error) {
err = r.controller.LoadSpace(request.SpaceId)
if err != nil {
return
}
resp = &apiproto.LoadSpaceResponse{}
return
}
func (r *rpcHandler) CreateSpace(ctx context.Context, request *apiproto.CreateSpaceRequest) (resp *apiproto.CreateSpaceResponse, err error) { func (r *rpcHandler) CreateSpace(ctx context.Context, request *apiproto.CreateSpaceRequest) (resp *apiproto.CreateSpaceResponse, err error) {
id, err := r.controller.CreateSpace() id, err := r.controller.CreateSpace()
if err != nil { if err != nil {

View File

@ -50,7 +50,7 @@ func newSpaceStorage(objDb *badger.DB, spaceId string) (store spacestorage.Space
return nil return nil
}) })
if err == badger.ErrKeyNotFound { if err == badger.ErrKeyNotFound {
err = spacesyncproto.ErrSpaceMissing err = spacestorage.ErrSpaceStorageMissing
} }
return return
} }
@ -58,7 +58,7 @@ func newSpaceStorage(objDb *badger.DB, spaceId string) (store spacestorage.Space
func createSpaceStorage(db *badger.DB, payload spacestorage.SpaceStorageCreatePayload) (store spacestorage.SpaceStorage, err error) { func createSpaceStorage(db *badger.DB, payload spacestorage.SpaceStorageCreatePayload) (store spacestorage.SpaceStorage, err error) {
keys := newSpaceKeys(payload.SpaceHeaderWithId.Id) keys := newSpaceKeys(payload.SpaceHeaderWithId.Id)
if hasDB(db, keys.HeaderKey()) { if hasDB(db, keys.HeaderKey()) {
err = spacesyncproto.ErrSpaceExists err = spacestorage.ErrSpaceStorageExists
return return
} }
err = spaceValidationFunc(payload) err = spaceValidationFunc(payload)

View File

@ -7,8 +7,8 @@ grpcServer:
account: account:
peerId: 12D3KooWEmCHgpYfEWmG558s3TmhKX4ieegQykUJpcLKtciWfwJh peerId: 12D3KooWEmCHgpYfEWmG558s3TmhKX4ieegQykUJpcLKtciWfwJh
peerKey: +6iFHEa4A0gHQxXmzxNv4J7TAiPPlYuOUWk7pb4WvVFJeoVAydioJiY78tm22pceORFqdPFJLH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3z/8vMvUnppvjQ9GYHA1plZPxXh1uy+mTLjk7vfbeEahQKJAoGBAIDbI7SL7MmWumSnPPwwxfQ5DaWwdn7yReWKUFlO3WFG9oN15M43NXG3zZoUsPdaeTNcvgDRQ4PmtZ+zQonac+obHNsq8ZZP7KjyFJNrrIgfeUDmdnW8u+UPxPjt1J4YStsLX5Ea+x5uE8qGWmK0xYCUkntBFgENhbD7qDokB1+q
apiServer: apiServer:
listenAddrs: listenAddrs:
- 127.0.0.1:8091 - 127.0.0.1:8091

View File

@ -110,7 +110,7 @@ func createSpaceStorage(rootPath string, payload spacestorage.SpaceStorageCreate
return return
} }
if has { if has {
err = spacesyncproto.ErrSpaceExists err = spacestorage.ErrSpaceStorageExists
return return
} }
err = spaceValidationFunc(payload) err = spaceValidationFunc(payload)

View File

@ -20,6 +20,7 @@ type Service interface {
AddText(ctx context.Context, ip string, request *apiproto.AddTextRequest) (resp *apiproto.AddTextResponse, err error) AddText(ctx context.Context, ip string, request *apiproto.AddTextRequest) (resp *apiproto.AddTextResponse, err error)
AllTrees(ctx context.Context, ip string, request *apiproto.AllTreesRequest) (resp *apiproto.AllTreesResponse, err error) AllTrees(ctx context.Context, ip string, request *apiproto.AllTreesRequest) (resp *apiproto.AllTreesResponse, err error)
AllSpaces(ctx context.Context, ip string, request *apiproto.AllSpacesRequest) (resp *apiproto.AllSpacesResponse, err error) AllSpaces(ctx context.Context, ip string, request *apiproto.AllSpacesRequest) (resp *apiproto.AllSpacesResponse, err error)
LoadSpace(ctx context.Context, ip string, request *apiproto.LoadSpaceRequest) (res *apiproto.LoadSpaceResponse, err error)
app.Component app.Component
} }
@ -95,3 +96,11 @@ func (s *service) AllSpaces(ctx context.Context, ip string, request *apiproto.Al
} }
return cl.AllSpaces(ctx, request) return cl.AllSpaces(ctx, request)
} }
func (s *service) LoadSpace(ctx context.Context, ip string, request *apiproto.LoadSpaceRequest) (res *apiproto.LoadSpaceResponse, err error) {
cl, err := s.client.GetClient(ctx, ip)
if err != nil {
return
}
return cl.LoadSpace(ctx, request)
}

View File

@ -168,6 +168,20 @@ func (s *service) registerClientCommands() {
res = resp.DocumentId res = resp.DocumentId
return return
}} }}
s.clientCommands["load-space"] = Command{Cmd: func(server peers.Peer, params []string) (res string, err error) {
if len(params) != 1 {
err = ErrIncorrectParamsCount
return
}
_, err = client.LoadSpace(context.Background(), server.Address, &apiproto.LoadSpaceRequest{
SpaceId: params[0],
})
if err != nil {
return
}
res = params[0]
return
}}
} }
func (s *service) registerNodeCommands() { func (s *service) registerNodeCommands() {