diff --git a/app/app.go b/app/app.go index 85d67f61..84682f2c 100644 --- a/app/app.go +++ b/app/app.go @@ -20,7 +20,10 @@ var ( ) var ( - log = logger.NewNamed("app") + log = logger.NewNamed("app") + StopDeadline = time.Minute + StopWarningAfter = time.Second * 10 + StartWarningAfter = time.Second * 10 ) // Component is a minimal interface for a common app.Component @@ -53,7 +56,8 @@ type ComponentStatable interface { type App struct { components []Component mu sync.RWMutex - startStat StartStat + startStat Stat + stopStat Stat deviceState int } @@ -67,18 +71,25 @@ func (app *App) Version() string { return GitSummary } -type StartStat struct { +type Stat struct { SpentMsPerComp map[string]int64 SpentMsTotal int64 } -// StartStat returns total time spent per comp -func (app *App) StartStat() StartStat { +// StartStat returns total time spent per comp for the last Start +func (app *App) StartStat() Stat { app.mu.Lock() defer app.mu.Unlock() return app.startStat } +// StopStat returns total time spent per comp for the last Close +func (app *App) StopStat() Stat { + app.mu.Lock() + defer app.mu.Unlock() + return app.stopStat +} + // VersionDescription return the full info about the build func (app *App) VersionDescription() string { return VersionDescription() @@ -158,7 +169,17 @@ func (app *App) Start(ctx context.Context) (err error) { app.mu.RLock() defer app.mu.RUnlock() app.startStat.SpentMsPerComp = make(map[string]int64) - + var currentComponentStarting string + done := make(chan struct{}) + go func() { + select { + case <-done: + return + case <-time.After(StartWarningAfter): + l := statLogger(app.stopStat, log).With(zap.String("in_progress", currentComponentStarting)) + l.Warn("components start in progress") + } + }() closeServices := func(idx int) { for i := idx; i >= 0; i-- { if serviceClose, ok := app.components[i].(ComponentRunnable); ok { @@ -172,7 +193,7 @@ func (app *App) Start(ctx context.Context) (err error) { for i, s := range app.components { if err = s.Init(app); err != nil { closeServices(i) - return fmt.Errorf("can't init service '%s': %v", s.Name(), err) + return fmt.Errorf("can't init service '%s': %w", s.Name(), err) } } @@ -181,14 +202,20 @@ func (app *App) Start(ctx context.Context) (err error) { start := time.Now() if err = serviceRun.Run(ctx); err != nil { closeServices(i) - return fmt.Errorf("can't run service '%s': %v", serviceRun.Name(), err) + return fmt.Errorf("can't run service '%s': %w", serviceRun.Name(), err) } spent := time.Since(start).Milliseconds() app.startStat.SpentMsTotal += spent app.startStat.SpentMsPerComp[s.Name()] = spent } } - log.Debug("all components started") + + close(done) + l := statLogger(app.stopStat, log) + if app.startStat.SpentMsTotal > StartWarningAfter.Milliseconds() { + l.Warn("all components started") + } + l.Debug("all components started") return } @@ -203,18 +230,41 @@ func stackAllGoroutines() []byte { } } +func statLogger(stat Stat, ctxLogger logger.CtxLogger) logger.CtxLogger { + l := ctxLogger + for k, v := range stat.SpentMsPerComp { + l = l.With(zap.Int64(k, v)) + } + l = l.With(zap.Int64("total", stat.SpentMsTotal)) + + return l +} + // Close stops the application // All components with ComponentRunnable implementation will be closed in the reversed order func (app *App) Close(ctx context.Context) error { log.Debug("close components...") app.mu.RLock() defer app.mu.RUnlock() + app.stopStat.SpentMsPerComp = make(map[string]int64) + var currentComponentStopping string done := make(chan struct{}) + go func() { select { case <-done: return - case <-time.After(time.Minute): + case <-time.After(StopWarningAfter): + statLogger(app.stopStat, log). + With(zap.String("in_progress", currentComponentStopping)). + Warn("components close in progress") + } + }() + go func() { + select { + case <-done: + return + case <-time.After(StopDeadline): _, _ = os.Stderr.Write([]byte("app.Close timeout\n")) _, _ = os.Stderr.Write(stackAllGoroutines()) panic("app.Close timeout") @@ -224,16 +274,27 @@ func (app *App) Close(ctx context.Context) error { var errs []string for i := len(app.components) - 1; i >= 0; i-- { if serviceClose, ok := app.components[i].(ComponentRunnable); ok { + start := time.Now() + currentComponentStopping = app.components[i].Name() if e := serviceClose.Close(ctx); e != nil { errs = append(errs, fmt.Sprintf("Component '%s' close error: %v", serviceClose.Name(), e)) } + spent := time.Since(start).Milliseconds() + app.stopStat.SpentMsTotal += spent + app.stopStat.SpentMsPerComp[app.components[i].Name()] = spent } } close(done) if len(errs) > 0 { return errors.New(strings.Join(errs, "\n")) } - log.Debug("all components have been closed") + + l := statLogger(app.stopStat, log) + if app.stopStat.SpentMsTotal > StopWarningAfter.Milliseconds() { + l.Warn("all components have been closed") + } + + l.Debug("all components have been closed") return nil } diff --git a/app/logger/ctxfiled.go b/app/logger/ctxfiled.go index 83d8bba4..5597ba54 100644 --- a/app/logger/ctxfiled.go +++ b/app/logger/ctxfiled.go @@ -32,6 +32,7 @@ func CtxGetFields(ctx context.Context) (fields []zap.Field) { type CtxLogger struct { *zap.Logger + name string } func (cl CtxLogger) DebugCtx(ctx context.Context, msg string, fields ...zap.Field) { @@ -51,5 +52,9 @@ func (cl CtxLogger) ErrorCtx(ctx context.Context, msg string, fields ...zap.Fiel } func (cl CtxLogger) With(fields ...zap.Field) CtxLogger { - return CtxLogger{cl.Logger.With(fields...)} + return CtxLogger{cl.Logger.With(fields...), cl.name} +} + +func (cl CtxLogger) Sugar() *zap.SugaredLogger { + return NewNamedSugared(cl.name) } diff --git a/app/logger/log.go b/app/logger/log.go index 264cdaf1..e41c20d1 100644 --- a/app/logger/log.go +++ b/app/logger/log.go @@ -8,12 +8,13 @@ import ( ) var ( - mu sync.Mutex - logger *zap.Logger - loggerConfig zap.Config - namedLevels = make(map[string]zap.AtomicLevel) - namedGlobs = make(map[string]glob.Glob) - namedLoggers = make(map[string]CtxLogger) + mu sync.Mutex + logger *zap.Logger + loggerConfig zap.Config + namedLevels = make(map[string]zap.AtomicLevel) + namedGlobs = make(map[string]glob.Glob) + namedLoggers = make(map[string]CtxLogger) + namedSugarLoggers = make(map[string]*zap.SugaredLogger) ) func init() { @@ -59,10 +60,18 @@ func SetNamedLevels(l map[string]zap.AtomicLevel) { for name, nl := range namedLoggers { level := getLevel(name) - // this can be racy, but - nl.Logger = zap.New(logger.Core()).WithOptions( + newCore := zap.New(logger.Core()).Named(name).WithOptions( zap.IncreaseLevel(level), - ).Named(name) + ) + *(nl.Logger) = *newCore + } + + for name, nl := range namedSugarLoggers { + level := getLevel(name) + newCore := zap.New(logger.Core()).Named(name).WithOptions( + zap.IncreaseLevel(level), + ).Sugar() + *(nl) = *newCore } } @@ -100,11 +109,24 @@ func NewNamed(name string, fields ...zap.Field) CtxLogger { } level := getLevel(name) - l := zap.New(logger.Core()).WithOptions( - zap.IncreaseLevel(level), - ).Named(name) + l := zap.New(logger.Core()).Named(name).WithOptions(zap.IncreaseLevel(level), + zap.Fields(fields...)) - ctxL := CtxLogger{l} + ctxL := CtxLogger{Logger: l, name: name} namedLoggers[name] = ctxL return ctxL } + +func NewNamedSugared(name string) *zap.SugaredLogger { + mu.Lock() + defer mu.Unlock() + + if l, nameExists := namedSugarLoggers[name]; nameExists { + return l + } + + level := getLevel(name) + l := zap.New(logger.Core()).Named(name).Sugar().WithOptions(zap.IncreaseLevel(level)) + namedSugarLoggers[name] = l + return l +} diff --git a/commonfile/fileblockstore/fileblockstore.go b/commonfile/fileblockstore/fileblockstore.go index 3f2e33af..99c89b20 100644 --- a/commonfile/fileblockstore/fileblockstore.go +++ b/commonfile/fileblockstore/fileblockstore.go @@ -21,6 +21,7 @@ type ctxKey uint const ( ctxKeySpaceId ctxKey = iota + ctxKeyFileId ) type BlockStore interface { @@ -48,3 +49,12 @@ func CtxGetSpaceId(ctx context.Context) (spaceId string) { spaceId, _ = ctx.Value(ctxKeySpaceId).(string) return } + +func CtxWithFileId(ctx context.Context, spaceId string) context.Context { + return context.WithValue(ctx, ctxKeyFileId, spaceId) +} + +func CtxGetFileId(ctx context.Context) (spaceId string) { + spaceId, _ = ctx.Value(ctxKeyFileId).(string) + return +} diff --git a/commonfile/fileproto/file.pb.go b/commonfile/fileproto/file.pb.go index f0b84530..a13658fc 100644 --- a/commonfile/fileproto/file.pb.go +++ b/commonfile/fileproto/file.pb.go @@ -25,21 +25,33 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type ErrCodes int32 const ( - ErrCodes_Unexpected ErrCodes = 0 - ErrCodes_CIDNotFound ErrCodes = 1 - ErrCodes_ErrorOffset ErrCodes = 200 + ErrCodes_Unexpected ErrCodes = 0 + ErrCodes_CIDNotFound ErrCodes = 1 + ErrCodes_Forbidden ErrCodes = 2 + ErrCodes_SpaceLimitExceeded ErrCodes = 3 + ErrCodes_QuerySizeExceeded ErrCodes = 4 + ErrCodes_WrongHash ErrCodes = 5 + ErrCodes_ErrorOffset ErrCodes = 200 ) var ErrCodes_name = map[int32]string{ 0: "Unexpected", 1: "CIDNotFound", + 2: "Forbidden", + 3: "SpaceLimitExceeded", + 4: "QuerySizeExceeded", + 5: "WrongHash", 200: "ErrorOffset", } var ErrCodes_value = map[string]int32{ - "Unexpected": 0, - "CIDNotFound": 1, - "ErrorOffset": 200, + "Unexpected": 0, + "CIDNotFound": 1, + "Forbidden": 2, + "SpaceLimitExceeded": 3, + "QuerySizeExceeded": 4, + "WrongHash": 5, + "ErrorOffset": 200, } func (x ErrCodes) String() string { @@ -184,8 +196,9 @@ func (m *BlockGetResponse) GetData() []byte { type BlockPushRequest struct { SpaceId string `protobuf:"bytes,1,opt,name=spaceId,proto3" json:"spaceId,omitempty"` - Cid []byte `protobuf:"bytes,2,opt,name=cid,proto3" json:"cid,omitempty"` - Data []byte `protobuf:"bytes,3,opt,name=data,proto3" json:"data,omitempty"` + FileId string `protobuf:"bytes,2,opt,name=fileId,proto3" json:"fileId,omitempty"` + Cid []byte `protobuf:"bytes,3,opt,name=cid,proto3" json:"cid,omitempty"` + Data []byte `protobuf:"bytes,4,opt,name=data,proto3" json:"data,omitempty"` } func (m *BlockPushRequest) Reset() { *m = BlockPushRequest{} } @@ -228,6 +241,13 @@ func (m *BlockPushRequest) GetSpaceId() string { return "" } +func (m *BlockPushRequest) GetFileId() string { + if m != nil { + return m.FileId + } + return "" +} + func (m *BlockPushRequest) GetCid() []byte { if m != nil { return m.Cid @@ -516,7 +536,8 @@ func (m *BlockAvailability) GetStatus() AvailabilityStatus { type BlocksBindRequest struct { SpaceId string `protobuf:"bytes,1,opt,name=spaceId,proto3" json:"spaceId,omitempty"` - Cids [][]byte `protobuf:"bytes,2,rep,name=cids,proto3" json:"cids,omitempty"` + FileId string `protobuf:"bytes,2,opt,name=fileId,proto3" json:"fileId,omitempty"` + Cids [][]byte `protobuf:"bytes,3,rep,name=cids,proto3" json:"cids,omitempty"` } func (m *BlocksBindRequest) Reset() { *m = BlocksBindRequest{} } @@ -559,6 +580,13 @@ func (m *BlocksBindRequest) GetSpaceId() string { return "" } +func (m *BlocksBindRequest) GetFileId() string { + if m != nil { + return m.FileId + } + return "" +} + func (m *BlocksBindRequest) GetCids() [][]byte { if m != nil { return m.Cids @@ -602,6 +630,250 @@ func (m *BlocksBindResponse) XXX_DiscardUnknown() { var xxx_messageInfo_BlocksBindResponse proto.InternalMessageInfo +type FilesDeleteRequest struct { + SpaceId string `protobuf:"bytes,1,opt,name=spaceId,proto3" json:"spaceId,omitempty"` + FileIds []string `protobuf:"bytes,2,rep,name=fileIds,proto3" json:"fileIds,omitempty"` +} + +func (m *FilesDeleteRequest) Reset() { *m = FilesDeleteRequest{} } +func (m *FilesDeleteRequest) String() string { return proto.CompactTextString(m) } +func (*FilesDeleteRequest) ProtoMessage() {} +func (*FilesDeleteRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_fd665a7e11c833d5, []int{11} +} +func (m *FilesDeleteRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *FilesDeleteRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_FilesDeleteRequest.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 *FilesDeleteRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_FilesDeleteRequest.Merge(m, src) +} +func (m *FilesDeleteRequest) XXX_Size() int { + return m.Size() +} +func (m *FilesDeleteRequest) XXX_DiscardUnknown() { + xxx_messageInfo_FilesDeleteRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_FilesDeleteRequest proto.InternalMessageInfo + +func (m *FilesDeleteRequest) GetSpaceId() string { + if m != nil { + return m.SpaceId + } + return "" +} + +func (m *FilesDeleteRequest) GetFileIds() []string { + if m != nil { + return m.FileIds + } + return nil +} + +type FilesDeleteResponse struct { +} + +func (m *FilesDeleteResponse) Reset() { *m = FilesDeleteResponse{} } +func (m *FilesDeleteResponse) String() string { return proto.CompactTextString(m) } +func (*FilesDeleteResponse) ProtoMessage() {} +func (*FilesDeleteResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_fd665a7e11c833d5, []int{12} +} +func (m *FilesDeleteResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *FilesDeleteResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_FilesDeleteResponse.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 *FilesDeleteResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_FilesDeleteResponse.Merge(m, src) +} +func (m *FilesDeleteResponse) XXX_Size() int { + return m.Size() +} +func (m *FilesDeleteResponse) XXX_DiscardUnknown() { + xxx_messageInfo_FilesDeleteResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_FilesDeleteResponse proto.InternalMessageInfo + +type FilesInfoRequest struct { + SpaceId string `protobuf:"bytes,1,opt,name=spaceId,proto3" json:"spaceId,omitempty"` + FileIds []string `protobuf:"bytes,2,rep,name=fileIds,proto3" json:"fileIds,omitempty"` +} + +func (m *FilesInfoRequest) Reset() { *m = FilesInfoRequest{} } +func (m *FilesInfoRequest) String() string { return proto.CompactTextString(m) } +func (*FilesInfoRequest) ProtoMessage() {} +func (*FilesInfoRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_fd665a7e11c833d5, []int{13} +} +func (m *FilesInfoRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *FilesInfoRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_FilesInfoRequest.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 *FilesInfoRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_FilesInfoRequest.Merge(m, src) +} +func (m *FilesInfoRequest) XXX_Size() int { + return m.Size() +} +func (m *FilesInfoRequest) XXX_DiscardUnknown() { + xxx_messageInfo_FilesInfoRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_FilesInfoRequest proto.InternalMessageInfo + +func (m *FilesInfoRequest) GetSpaceId() string { + if m != nil { + return m.SpaceId + } + return "" +} + +func (m *FilesInfoRequest) GetFileIds() []string { + if m != nil { + return m.FileIds + } + return nil +} + +type FilesInfoResponse struct { + FilesInfo []*FileInfo `protobuf:"bytes,1,rep,name=filesInfo,proto3" json:"filesInfo,omitempty"` +} + +func (m *FilesInfoResponse) Reset() { *m = FilesInfoResponse{} } +func (m *FilesInfoResponse) String() string { return proto.CompactTextString(m) } +func (*FilesInfoResponse) ProtoMessage() {} +func (*FilesInfoResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_fd665a7e11c833d5, []int{14} +} +func (m *FilesInfoResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *FilesInfoResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_FilesInfoResponse.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 *FilesInfoResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_FilesInfoResponse.Merge(m, src) +} +func (m *FilesInfoResponse) XXX_Size() int { + return m.Size() +} +func (m *FilesInfoResponse) XXX_DiscardUnknown() { + xxx_messageInfo_FilesInfoResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_FilesInfoResponse proto.InternalMessageInfo + +func (m *FilesInfoResponse) GetFilesInfo() []*FileInfo { + if m != nil { + return m.FilesInfo + } + return nil +} + +type FileInfo struct { + FileId string `protobuf:"bytes,1,opt,name=fileId,proto3" json:"fileId,omitempty"` + UsageBytes uint64 `protobuf:"varint,2,opt,name=usageBytes,proto3" json:"usageBytes,omitempty"` + CidsCount uint32 `protobuf:"varint,3,opt,name=cidsCount,proto3" json:"cidsCount,omitempty"` +} + +func (m *FileInfo) Reset() { *m = FileInfo{} } +func (m *FileInfo) String() string { return proto.CompactTextString(m) } +func (*FileInfo) ProtoMessage() {} +func (*FileInfo) Descriptor() ([]byte, []int) { + return fileDescriptor_fd665a7e11c833d5, []int{15} +} +func (m *FileInfo) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *FileInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_FileInfo.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 *FileInfo) XXX_Merge(src proto.Message) { + xxx_messageInfo_FileInfo.Merge(m, src) +} +func (m *FileInfo) XXX_Size() int { + return m.Size() +} +func (m *FileInfo) XXX_DiscardUnknown() { + xxx_messageInfo_FileInfo.DiscardUnknown(m) +} + +var xxx_messageInfo_FileInfo proto.InternalMessageInfo + +func (m *FileInfo) GetFileId() string { + if m != nil { + return m.FileId + } + return "" +} + +func (m *FileInfo) GetUsageBytes() uint64 { + if m != nil { + return m.UsageBytes + } + return 0 +} + +func (m *FileInfo) GetCidsCount() uint32 { + if m != nil { + return m.CidsCount + } + return 0 +} + type CheckRequest struct { } @@ -609,7 +881,7 @@ func (m *CheckRequest) Reset() { *m = CheckRequest{} } func (m *CheckRequest) String() string { return proto.CompactTextString(m) } func (*CheckRequest) ProtoMessage() {} func (*CheckRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_fd665a7e11c833d5, []int{11} + return fileDescriptor_fd665a7e11c833d5, []int{16} } func (m *CheckRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -647,7 +919,7 @@ func (m *CheckResponse) Reset() { *m = CheckResponse{} } func (m *CheckResponse) String() string { return proto.CompactTextString(m) } func (*CheckResponse) ProtoMessage() {} func (*CheckResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_fd665a7e11c833d5, []int{12} + return fileDescriptor_fd665a7e11c833d5, []int{17} } func (m *CheckResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -690,6 +962,118 @@ func (m *CheckResponse) GetAllowWrite() bool { return false } +type SpaceInfoRequest struct { + SpaceId string `protobuf:"bytes,1,opt,name=spaceId,proto3" json:"spaceId,omitempty"` +} + +func (m *SpaceInfoRequest) Reset() { *m = SpaceInfoRequest{} } +func (m *SpaceInfoRequest) String() string { return proto.CompactTextString(m) } +func (*SpaceInfoRequest) ProtoMessage() {} +func (*SpaceInfoRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_fd665a7e11c833d5, []int{18} +} +func (m *SpaceInfoRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *SpaceInfoRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_SpaceInfoRequest.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 *SpaceInfoRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_SpaceInfoRequest.Merge(m, src) +} +func (m *SpaceInfoRequest) XXX_Size() int { + return m.Size() +} +func (m *SpaceInfoRequest) XXX_DiscardUnknown() { + xxx_messageInfo_SpaceInfoRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_SpaceInfoRequest proto.InternalMessageInfo + +func (m *SpaceInfoRequest) GetSpaceId() string { + if m != nil { + return m.SpaceId + } + return "" +} + +type SpaceInfoResponse struct { + LimitBytes uint64 `protobuf:"varint,1,opt,name=limitBytes,proto3" json:"limitBytes,omitempty"` + UsageBytes uint64 `protobuf:"varint,2,opt,name=usageBytes,proto3" json:"usageBytes,omitempty"` + CidsCount uint64 `protobuf:"varint,3,opt,name=cidsCount,proto3" json:"cidsCount,omitempty"` + FilesCount uint64 `protobuf:"varint,4,opt,name=filesCount,proto3" json:"filesCount,omitempty"` +} + +func (m *SpaceInfoResponse) Reset() { *m = SpaceInfoResponse{} } +func (m *SpaceInfoResponse) String() string { return proto.CompactTextString(m) } +func (*SpaceInfoResponse) ProtoMessage() {} +func (*SpaceInfoResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_fd665a7e11c833d5, []int{19} +} +func (m *SpaceInfoResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *SpaceInfoResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_SpaceInfoResponse.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 *SpaceInfoResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_SpaceInfoResponse.Merge(m, src) +} +func (m *SpaceInfoResponse) XXX_Size() int { + return m.Size() +} +func (m *SpaceInfoResponse) XXX_DiscardUnknown() { + xxx_messageInfo_SpaceInfoResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_SpaceInfoResponse proto.InternalMessageInfo + +func (m *SpaceInfoResponse) GetLimitBytes() uint64 { + if m != nil { + return m.LimitBytes + } + return 0 +} + +func (m *SpaceInfoResponse) GetUsageBytes() uint64 { + if m != nil { + return m.UsageBytes + } + return 0 +} + +func (m *SpaceInfoResponse) GetCidsCount() uint64 { + if m != nil { + return m.CidsCount + } + return 0 +} + +func (m *SpaceInfoResponse) GetFilesCount() uint64 { + if m != nil { + return m.FilesCount + } + return 0 +} + func init() { proto.RegisterEnum("filesync.ErrCodes", ErrCodes_name, ErrCodes_value) proto.RegisterEnum("filesync.AvailabilityStatus", AvailabilityStatus_name, AvailabilityStatus_value) @@ -704,8 +1088,15 @@ func init() { proto.RegisterType((*BlockAvailability)(nil), "filesync.BlockAvailability") proto.RegisterType((*BlocksBindRequest)(nil), "filesync.BlocksBindRequest") proto.RegisterType((*BlocksBindResponse)(nil), "filesync.BlocksBindResponse") + proto.RegisterType((*FilesDeleteRequest)(nil), "filesync.FilesDeleteRequest") + proto.RegisterType((*FilesDeleteResponse)(nil), "filesync.FilesDeleteResponse") + proto.RegisterType((*FilesInfoRequest)(nil), "filesync.FilesInfoRequest") + proto.RegisterType((*FilesInfoResponse)(nil), "filesync.FilesInfoResponse") + proto.RegisterType((*FileInfo)(nil), "filesync.FileInfo") proto.RegisterType((*CheckRequest)(nil), "filesync.CheckRequest") proto.RegisterType((*CheckResponse)(nil), "filesync.CheckResponse") + proto.RegisterType((*SpaceInfoRequest)(nil), "filesync.SpaceInfoRequest") + proto.RegisterType((*SpaceInfoResponse)(nil), "filesync.SpaceInfoResponse") } func init() { @@ -713,44 +1104,59 @@ func init() { } var fileDescriptor_fd665a7e11c833d5 = []byte{ - // 582 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x54, 0xcf, 0x6e, 0xda, 0x4e, - 0x10, 0xc6, 0x21, 0x3f, 0x7e, 0x30, 0xfc, 0x89, 0x33, 0x41, 0x29, 0x75, 0xa8, 0x85, 0x7c, 0xa8, - 0x50, 0x0e, 0x44, 0xa2, 0x3d, 0xe4, 0x92, 0x03, 0xff, 0x12, 0xd1, 0xa8, 0x69, 0xe5, 0xa8, 0xaa, - 0xd4, 0x9e, 0x8c, 0xbd, 0x28, 0x56, 0x1c, 0x2f, 0xf5, 0x2e, 0x6d, 0xf2, 0x16, 0x7d, 0x91, 0xbe, - 0x47, 0x8e, 0x39, 0xf6, 0x58, 0xc1, 0x8b, 0x54, 0x5e, 0xaf, 0xc1, 0x80, 0xa3, 0x4a, 0x5c, 0xcc, - 0xec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64, 0x9b, 0xc5, 0xf6, 0x51, 0x2b, 0x6e, 0x60, - 0x4b, 0xa4, 0x26, 0x21, 0x66, 0x4a, 0x9a, 0xf1, 0x55, 0x2a, 0x93, 0x74, 0xa6, 0x34, 0xea, 0x2d, - 0xe4, 0x18, 0xb7, 0xf8, 0x94, 0x09, 0xa5, 0x2b, 0xed, 0xfa, 0xb2, 0x4e, 0x32, 0xf3, 0x5a, 0x60, - 0x4c, 0x89, 0x35, 0x3a, 0x92, 0x9c, 0x75, 0x5d, 0xdf, 0xd9, 0x4e, 0x83, 0x6a, 0xac, 0x63, 0x44, - 0x21, 0xd5, 0xad, 0x40, 0x29, 0xa9, 0xab, 0x71, 0x09, 0xe5, 0x55, 0x8d, 0x34, 0xc8, 0x4b, 0x56, - 0x26, 0x94, 0x29, 0x98, 0x8b, 0x33, 0xea, 0x00, 0x96, 0xe7, 0xd1, 0x1f, 0x9f, 0x03, 0x97, 0x13, - 0xf1, 0x9e, 0xbc, 0x99, 0xf0, 0x1c, 0x9f, 0x41, 0x7e, 0x10, 0x04, 0x3d, 0xea, 0x10, 0x86, 0x15, - 0x80, 0x4f, 0x3e, 0xb9, 0x9f, 0x10, 0x9b, 0x13, 0x47, 0xcd, 0xe0, 0x1e, 0x14, 0x7b, 0xc3, 0xfe, - 0x15, 0xe5, 0xe7, 0x74, 0xea, 0x3b, 0xaa, 0x82, 0x2a, 0x14, 0x07, 0x41, 0x40, 0x83, 0x0f, 0xe3, - 0x31, 0x23, 0x5c, 0x7d, 0x54, 0x8e, 0xbb, 0x80, 0x9b, 0x92, 0x60, 0x19, 0x0a, 0x57, 0x94, 0x0f, - 0xee, 0x5d, 0xc6, 0x99, 0x9a, 0x41, 0x80, 0x9c, 0xb4, 0x15, 0xdc, 0x87, 0x72, 0x64, 0x0f, 0xfd, - 0xeb, 0xf0, 0x8e, 0xea, 0x4e, 0xfb, 0x57, 0x16, 0x76, 0xcf, 0x5d, 0x8f, 0x60, 0x07, 0xf2, 0xf1, - 0x1a, 0xe1, 0xcb, 0xb5, 0xde, 0x2e, 0x37, 0x53, 0xd3, 0xd2, 0x42, 0x52, 0x8a, 0x3e, 0x14, 0x16, - 0xb3, 0x8f, 0xeb, 0xc0, 0xc4, 0x92, 0x69, 0x47, 0xa9, 0x31, 0xc9, 0xf2, 0x0e, 0x8a, 0x89, 0x59, - 0xc4, 0xfa, 0x1a, 0x76, 0x65, 0xcc, 0xb5, 0x57, 0xcf, 0x44, 0x25, 0xd7, 0x05, 0xc0, 0xb2, 0xa7, - 0xb8, 0x5e, 0x36, 0x39, 0x2c, 0x5a, 0x3d, 0x3d, 0x28, 0x89, 0xde, 0x43, 0x29, 0xb9, 0x7c, 0xb8, - 0x51, 0x77, 0x65, 0xb3, 0x35, 0xfd, 0xb9, 0xb0, 0xa4, 0x3b, 0x85, 0xff, 0xa2, 0xd7, 0x1d, 0x2e, - 0x81, 0x2b, 0xef, 0x7a, 0xb1, 0xe1, 0x8f, 0x32, 0xbb, 0xad, 0xc7, 0x99, 0xae, 0x3c, 0xcd, 0x74, - 0xe5, 0xcf, 0x4c, 0x57, 0x7e, 0xce, 0xf5, 0xcc, 0xd3, 0x5c, 0xcf, 0xfc, 0x9e, 0xeb, 0x99, 0x2f, - 0xd5, 0xb4, 0x3f, 0xde, 0x51, 0x4e, 0xfc, 0xbc, 0xf9, 0x1b, 0x00, 0x00, 0xff, 0xff, 0x5a, 0xe8, - 0xf5, 0x9b, 0x97, 0x05, 0x00, 0x00, + // 817 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x56, 0x4f, 0x53, 0xfb, 0x44, + 0x18, 0x6e, 0xda, 0xfc, 0x4a, 0xf3, 0x96, 0x42, 0xba, 0x40, 0xad, 0xa5, 0x66, 0x3a, 0x39, 0x38, + 0x0c, 0xe3, 0x14, 0x07, 0x3d, 0x70, 0xf1, 0x40, 0x4b, 0x0b, 0x15, 0x07, 0x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 0x69, 0x73, 0xea, 0x59, 0x00, 0x13, 0xea, 0x5e, 0xe3, 0xce, + 0x94, 0xe1, 0x64, 0x7c, 0xba, 0xa3, 0x20, 0xa8, 0x09, 0x06, 0x57, 0xb4, 0x4b, 0x26, 0x11, 0x13, + 0xf7, 0xa8, 0xe2, 0x64, 0x80, 0xbd, 0x01, 0xeb, 0xea, 0x17, 0x6c, 0x9f, 0x43, 0x65, 0xfe, 0x6b, + 0x6c, 0x40, 0x49, 0x1e, 0x97, 0x8a, 0x9e, 0x0d, 0x67, 0xf6, 0xce, 0xa9, 0xdd, 0x30, 0x24, 0xbf, + 0x5c, 0xc5, 0x01, 0xc3, 0x82, 0xba, 0xe4, 0x28, 0x88, 0xfd, 0x11, 0x98, 0x97, 0x22, 0xf6, 0x35, + 0x6a, 0xda, 0x7f, 0x68, 0x50, 0x55, 0xc2, 0x25, 0xbf, 0x05, 0x10, 0x06, 0x77, 0x01, 0x4b, 0x8e, + 0xa7, 0x25, 0xc7, 0xcb, 0x90, 0xff, 0x7e, 0x7c, 0x5d, 0x39, 0x3e, 0xcf, 0x16, 0x6a, 0x27, 0xdb, + 0x7a, 0x92, 0x9d, 0x21, 0xfb, 0xbf, 0x69, 0x50, 0xea, 0xc5, 0x71, 0x97, 0xf8, 0x98, 0xa2, 0x0d, + 0x80, 0x6f, 0x22, 0x7c, 0x3f, 0xc6, 0x1e, 0xc3, 0xbe, 0x99, 0x43, 0x9b, 0x50, 0xee, 0x0e, 0x4e, + 0x2e, 0x08, 0xeb, 0x93, 0x49, 0xe4, 0x9b, 0x1a, 0xaa, 0x80, 0xd1, 0x27, 0xf1, 0x30, 0xf0, 0x7d, + 0x1c, 0x99, 0x79, 0x54, 0x03, 0x24, 0xce, 0xf3, 0x05, 0xef, 0xb6, 0x77, 0xef, 0x61, 0xec, 0x63, + 0xdf, 0x2c, 0xa0, 0x1d, 0xa8, 0x7e, 0x3d, 0xc1, 0xf1, 0xf4, 0x32, 0xf8, 0x15, 0xcf, 0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0x4b, 0x7b, 0x7c, 0xb2, 0xb4, 0xbf, 0x9f, 0x2c, 0xed, 0xf7, 0x67, + 0x2b, 0xf7, 0xf8, 0x6c, 0xe5, 0xfe, 0x7a, 0xb6, 0x72, 0xdf, 0x6d, 0xaf, 0xfa, 0x4d, 0x32, 0x2c, + 0x8a, 0x3f, 0x9f, 0xfc, 0x13, 0x00, 0x00, 0xff, 0xff, 0x26, 0x23, 0x7f, 0x83, 0xb2, 0x08, 0x00, + 0x00, } func (m *BlockGetRequest) Marshal() (dAtA []byte, err error) { @@ -852,13 +1258,20 @@ func (m *BlockPushRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { copy(dAtA[i:], m.Data) i = encodeVarintFile(dAtA, i, uint64(len(m.Data))) i-- - dAtA[i] = 0x1a + dAtA[i] = 0x22 } if len(m.Cid) > 0 { i -= len(m.Cid) copy(dAtA[i:], m.Cid) i = encodeVarintFile(dAtA, i, uint64(len(m.Cid))) i-- + dAtA[i] = 0x1a + } + if len(m.FileId) > 0 { + i -= len(m.FileId) + copy(dAtA[i:], m.FileId) + i = encodeVarintFile(dAtA, i, uint64(len(m.FileId))) + i-- dAtA[i] = 0x12 } if len(m.SpaceId) > 0 { @@ -1093,9 +1506,16 @@ func (m *BlocksBindRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { copy(dAtA[i:], m.Cids[iNdEx]) i = encodeVarintFile(dAtA, i, uint64(len(m.Cids[iNdEx]))) i-- - dAtA[i] = 0x12 + dAtA[i] = 0x1a } } + if len(m.FileId) > 0 { + i -= len(m.FileId) + copy(dAtA[i:], m.FileId) + i = encodeVarintFile(dAtA, i, uint64(len(m.FileId))) + i-- + dAtA[i] = 0x12 + } if len(m.SpaceId) > 0 { i -= len(m.SpaceId) copy(dAtA[i:], m.SpaceId) @@ -1129,6 +1549,184 @@ func (m *BlocksBindResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *FilesDeleteRequest) 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 *FilesDeleteRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *FilesDeleteRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.FileIds) > 0 { + for iNdEx := len(m.FileIds) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.FileIds[iNdEx]) + copy(dAtA[i:], m.FileIds[iNdEx]) + i = encodeVarintFile(dAtA, i, uint64(len(m.FileIds[iNdEx]))) + i-- + dAtA[i] = 0x12 + } + } + if len(m.SpaceId) > 0 { + i -= len(m.SpaceId) + copy(dAtA[i:], m.SpaceId) + i = encodeVarintFile(dAtA, i, uint64(len(m.SpaceId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *FilesDeleteResponse) 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 *FilesDeleteResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *FilesDeleteResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *FilesInfoRequest) 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 *FilesInfoRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *FilesInfoRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.FileIds) > 0 { + for iNdEx := len(m.FileIds) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.FileIds[iNdEx]) + copy(dAtA[i:], m.FileIds[iNdEx]) + i = encodeVarintFile(dAtA, i, uint64(len(m.FileIds[iNdEx]))) + i-- + dAtA[i] = 0x12 + } + } + if len(m.SpaceId) > 0 { + i -= len(m.SpaceId) + copy(dAtA[i:], m.SpaceId) + i = encodeVarintFile(dAtA, i, uint64(len(m.SpaceId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *FilesInfoResponse) 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 *FilesInfoResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *FilesInfoResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.FilesInfo) > 0 { + for iNdEx := len(m.FilesInfo) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.FilesInfo[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintFile(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *FileInfo) 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 *FileInfo) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *FileInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.CidsCount != 0 { + i = encodeVarintFile(dAtA, i, uint64(m.CidsCount)) + i-- + dAtA[i] = 0x18 + } + if m.UsageBytes != 0 { + i = encodeVarintFile(dAtA, i, uint64(m.UsageBytes)) + i-- + dAtA[i] = 0x10 + } + if len(m.FileId) > 0 { + i -= len(m.FileId) + copy(dAtA[i:], m.FileId) + i = encodeVarintFile(dAtA, i, uint64(len(m.FileId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func (m *CheckRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -1194,6 +1792,79 @@ func (m *CheckResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *SpaceInfoRequest) 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 *SpaceInfoRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *SpaceInfoRequest) 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 = encodeVarintFile(dAtA, i, uint64(len(m.SpaceId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *SpaceInfoResponse) 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 *SpaceInfoResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *SpaceInfoResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.FilesCount != 0 { + i = encodeVarintFile(dAtA, i, uint64(m.FilesCount)) + i-- + dAtA[i] = 0x20 + } + if m.CidsCount != 0 { + i = encodeVarintFile(dAtA, i, uint64(m.CidsCount)) + i-- + dAtA[i] = 0x18 + } + if m.UsageBytes != 0 { + i = encodeVarintFile(dAtA, i, uint64(m.UsageBytes)) + i-- + dAtA[i] = 0x10 + } + if m.LimitBytes != 0 { + i = encodeVarintFile(dAtA, i, uint64(m.LimitBytes)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + func encodeVarintFile(dAtA []byte, offset int, v uint64) int { offset -= sovFile(v) base := offset @@ -1249,6 +1920,10 @@ func (m *BlockPushRequest) Size() (n int) { if l > 0 { n += 1 + l + sovFile(uint64(l)) } + l = len(m.FileId) + if l > 0 { + n += 1 + l + sovFile(uint64(l)) + } l = len(m.Cid) if l > 0 { n += 1 + l + sovFile(uint64(l)) @@ -1357,6 +2032,10 @@ func (m *BlocksBindRequest) Size() (n int) { if l > 0 { n += 1 + l + sovFile(uint64(l)) } + l = len(m.FileId) + if l > 0 { + n += 1 + l + sovFile(uint64(l)) + } if len(m.Cids) > 0 { for _, b := range m.Cids { l = len(b) @@ -1375,6 +2054,87 @@ func (m *BlocksBindResponse) Size() (n int) { return n } +func (m *FilesDeleteRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.SpaceId) + if l > 0 { + n += 1 + l + sovFile(uint64(l)) + } + if len(m.FileIds) > 0 { + for _, s := range m.FileIds { + l = len(s) + n += 1 + l + sovFile(uint64(l)) + } + } + return n +} + +func (m *FilesDeleteResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *FilesInfoRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.SpaceId) + if l > 0 { + n += 1 + l + sovFile(uint64(l)) + } + if len(m.FileIds) > 0 { + for _, s := range m.FileIds { + l = len(s) + n += 1 + l + sovFile(uint64(l)) + } + } + return n +} + +func (m *FilesInfoResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.FilesInfo) > 0 { + for _, e := range m.FilesInfo { + l = e.Size() + n += 1 + l + sovFile(uint64(l)) + } + } + return n +} + +func (m *FileInfo) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.FileId) + if l > 0 { + n += 1 + l + sovFile(uint64(l)) + } + if m.UsageBytes != 0 { + n += 1 + sovFile(uint64(m.UsageBytes)) + } + if m.CidsCount != 0 { + n += 1 + sovFile(uint64(m.CidsCount)) + } + return n +} + func (m *CheckRequest) Size() (n int) { if m == nil { return 0 @@ -1402,6 +2162,40 @@ func (m *CheckResponse) Size() (n int) { return n } +func (m *SpaceInfoRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.SpaceId) + if l > 0 { + n += 1 + l + sovFile(uint64(l)) + } + return n +} + +func (m *SpaceInfoResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.LimitBytes != 0 { + n += 1 + sovFile(uint64(m.LimitBytes)) + } + if m.UsageBytes != 0 { + n += 1 + sovFile(uint64(m.UsageBytes)) + } + if m.CidsCount != 0 { + n += 1 + sovFile(uint64(m.CidsCount)) + } + if m.FilesCount != 0 { + n += 1 + sovFile(uint64(m.FilesCount)) + } + return n +} + func sovFile(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -1704,6 +2498,38 @@ func (m *BlockPushRequest) Unmarshal(dAtA []byte) error { m.SpaceId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FileId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFile + } + 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 ErrInvalidLengthFile + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthFile + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.FileId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Cid", wireType) } @@ -1737,7 +2563,7 @@ func (m *BlockPushRequest) Unmarshal(dAtA []byte) error { m.Cid = []byte{} } iNdEx = postIndex - case 3: + case 4: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) } @@ -2369,6 +3195,38 @@ func (m *BlocksBindRequest) Unmarshal(dAtA []byte) error { m.SpaceId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FileId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFile + } + 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 ErrInvalidLengthFile + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthFile + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.FileId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Cids", wireType) } @@ -2471,6 +3329,488 @@ func (m *BlocksBindResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *FilesDeleteRequest) 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 ErrIntOverflowFile + } + 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: FilesDeleteRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: FilesDeleteRequest: 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 ErrIntOverflowFile + } + 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 ErrInvalidLengthFile + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthFile + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SpaceId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FileIds", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFile + } + 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 ErrInvalidLengthFile + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthFile + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.FileIds = append(m.FileIds, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipFile(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthFile + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *FilesDeleteResponse) 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 ErrIntOverflowFile + } + 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: FilesDeleteResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: FilesDeleteResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipFile(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthFile + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *FilesInfoRequest) 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 ErrIntOverflowFile + } + 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: FilesInfoRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: FilesInfoRequest: 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 ErrIntOverflowFile + } + 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 ErrInvalidLengthFile + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthFile + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SpaceId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FileIds", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFile + } + 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 ErrInvalidLengthFile + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthFile + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.FileIds = append(m.FileIds, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipFile(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthFile + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *FilesInfoResponse) 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 ErrIntOverflowFile + } + 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: FilesInfoResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: FilesInfoResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FilesInfo", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFile + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthFile + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthFile + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.FilesInfo = append(m.FilesInfo, &FileInfo{}) + if err := m.FilesInfo[len(m.FilesInfo)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipFile(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthFile + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *FileInfo) 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 ErrIntOverflowFile + } + 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: FileInfo: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: FileInfo: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FileId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFile + } + 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 ErrInvalidLengthFile + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthFile + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.FileId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field UsageBytes", wireType) + } + m.UsageBytes = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFile + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.UsageBytes |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field CidsCount", wireType) + } + m.CidsCount = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFile + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.CidsCount |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipFile(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthFile + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *CheckRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -2623,6 +3963,214 @@ func (m *CheckResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *SpaceInfoRequest) 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 ErrIntOverflowFile + } + 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: SpaceInfoRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: SpaceInfoRequest: 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 ErrIntOverflowFile + } + 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 ErrInvalidLengthFile + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthFile + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SpaceId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipFile(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthFile + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *SpaceInfoResponse) 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 ErrIntOverflowFile + } + 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: SpaceInfoResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: SpaceInfoResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field LimitBytes", wireType) + } + m.LimitBytes = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFile + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.LimitBytes |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field UsageBytes", wireType) + } + m.UsageBytes = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFile + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.UsageBytes |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field CidsCount", wireType) + } + m.CidsCount = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFile + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.CidsCount |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field FilesCount", wireType) + } + m.FilesCount = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFile + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.FilesCount |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipFile(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthFile + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipFile(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/commonfile/fileproto/file_drpc.pb.go b/commonfile/fileproto/file_drpc.pb.go index fcc7d66a..2f9ee69d 100644 --- a/commonfile/fileproto/file_drpc.pb.go +++ b/commonfile/fileproto/file_drpc.pb.go @@ -44,8 +44,10 @@ type DRPCFileClient interface { BlockPush(ctx context.Context, in *BlockPushRequest) (*BlockPushResponse, error) BlocksCheck(ctx context.Context, in *BlocksCheckRequest) (*BlocksCheckResponse, error) BlocksBind(ctx context.Context, in *BlocksBindRequest) (*BlocksBindResponse, error) - BlocksDelete(ctx context.Context, in *BlocksDeleteRequest) (*BlocksDeleteResponse, error) + FilesDelete(ctx context.Context, in *FilesDeleteRequest) (*FilesDeleteResponse, error) + FilesInfo(ctx context.Context, in *FilesInfoRequest) (*FilesInfoResponse, error) Check(ctx context.Context, in *CheckRequest) (*CheckResponse, error) + SpaceInfo(ctx context.Context, in *SpaceInfoRequest) (*SpaceInfoResponse, error) } type drpcFileClient struct { @@ -94,9 +96,18 @@ func (c *drpcFileClient) BlocksBind(ctx context.Context, in *BlocksBindRequest) return out, nil } -func (c *drpcFileClient) BlocksDelete(ctx context.Context, in *BlocksDeleteRequest) (*BlocksDeleteResponse, error) { - out := new(BlocksDeleteResponse) - err := c.cc.Invoke(ctx, "/filesync.File/BlocksDelete", drpcEncoding_File_commonfile_fileproto_protos_file_proto{}, in, out) +func (c *drpcFileClient) FilesDelete(ctx context.Context, in *FilesDeleteRequest) (*FilesDeleteResponse, error) { + out := new(FilesDeleteResponse) + err := c.cc.Invoke(ctx, "/filesync.File/FilesDelete", drpcEncoding_File_commonfile_fileproto_protos_file_proto{}, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *drpcFileClient) FilesInfo(ctx context.Context, in *FilesInfoRequest) (*FilesInfoResponse, error) { + out := new(FilesInfoResponse) + err := c.cc.Invoke(ctx, "/filesync.File/FilesInfo", drpcEncoding_File_commonfile_fileproto_protos_file_proto{}, in, out) if err != nil { return nil, err } @@ -112,13 +123,24 @@ func (c *drpcFileClient) Check(ctx context.Context, in *CheckRequest) (*CheckRes return out, nil } +func (c *drpcFileClient) SpaceInfo(ctx context.Context, in *SpaceInfoRequest) (*SpaceInfoResponse, error) { + out := new(SpaceInfoResponse) + err := c.cc.Invoke(ctx, "/filesync.File/SpaceInfo", drpcEncoding_File_commonfile_fileproto_protos_file_proto{}, in, out) + if err != nil { + return nil, err + } + return out, nil +} + type DRPCFileServer interface { BlockGet(context.Context, *BlockGetRequest) (*BlockGetResponse, error) BlockPush(context.Context, *BlockPushRequest) (*BlockPushResponse, error) BlocksCheck(context.Context, *BlocksCheckRequest) (*BlocksCheckResponse, error) BlocksBind(context.Context, *BlocksBindRequest) (*BlocksBindResponse, error) - BlocksDelete(context.Context, *BlocksDeleteRequest) (*BlocksDeleteResponse, error) + FilesDelete(context.Context, *FilesDeleteRequest) (*FilesDeleteResponse, error) + FilesInfo(context.Context, *FilesInfoRequest) (*FilesInfoResponse, error) Check(context.Context, *CheckRequest) (*CheckResponse, error) + SpaceInfo(context.Context, *SpaceInfoRequest) (*SpaceInfoResponse, error) } type DRPCFileUnimplementedServer struct{} @@ -139,7 +161,11 @@ func (s *DRPCFileUnimplementedServer) BlocksBind(context.Context, *BlocksBindReq return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented) } -func (s *DRPCFileUnimplementedServer) BlocksDelete(context.Context, *BlocksDeleteRequest) (*BlocksDeleteResponse, error) { +func (s *DRPCFileUnimplementedServer) FilesDelete(context.Context, *FilesDeleteRequest) (*FilesDeleteResponse, error) { + return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented) +} + +func (s *DRPCFileUnimplementedServer) FilesInfo(context.Context, *FilesInfoRequest) (*FilesInfoResponse, error) { return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented) } @@ -147,9 +173,13 @@ func (s *DRPCFileUnimplementedServer) Check(context.Context, *CheckRequest) (*Ch return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented) } +func (s *DRPCFileUnimplementedServer) SpaceInfo(context.Context, *SpaceInfoRequest) (*SpaceInfoResponse, error) { + return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented) +} + type DRPCFileDescription struct{} -func (DRPCFileDescription) NumMethods() int { return 6 } +func (DRPCFileDescription) NumMethods() int { return 8 } func (DRPCFileDescription) Method(n int) (string, drpc.Encoding, drpc.Receiver, interface{}, bool) { switch n { @@ -190,15 +220,24 @@ func (DRPCFileDescription) Method(n int) (string, drpc.Encoding, drpc.Receiver, ) }, DRPCFileServer.BlocksBind, true case 4: - return "/filesync.File/BlocksDelete", drpcEncoding_File_commonfile_fileproto_protos_file_proto{}, + return "/filesync.File/FilesDelete", drpcEncoding_File_commonfile_fileproto_protos_file_proto{}, func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { return srv.(DRPCFileServer). - BlocksDelete( + FilesDelete( ctx, - in1.(*BlocksDeleteRequest), + in1.(*FilesDeleteRequest), ) - }, DRPCFileServer.BlocksDelete, true + }, DRPCFileServer.FilesDelete, true case 5: + return "/filesync.File/FilesInfo", drpcEncoding_File_commonfile_fileproto_protos_file_proto{}, + func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { + return srv.(DRPCFileServer). + FilesInfo( + ctx, + in1.(*FilesInfoRequest), + ) + }, DRPCFileServer.FilesInfo, true + case 6: return "/filesync.File/Check", drpcEncoding_File_commonfile_fileproto_protos_file_proto{}, func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { return srv.(DRPCFileServer). @@ -207,6 +246,15 @@ func (DRPCFileDescription) Method(n int) (string, drpc.Encoding, drpc.Receiver, in1.(*CheckRequest), ) }, DRPCFileServer.Check, true + case 7: + return "/filesync.File/SpaceInfo", drpcEncoding_File_commonfile_fileproto_protos_file_proto{}, + func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { + return srv.(DRPCFileServer). + SpaceInfo( + ctx, + in1.(*SpaceInfoRequest), + ) + }, DRPCFileServer.SpaceInfo, true default: return "", nil, nil, nil, false } @@ -280,16 +328,32 @@ func (x *drpcFile_BlocksBindStream) SendAndClose(m *BlocksBindResponse) error { return x.CloseSend() } -type DRPCFile_BlocksDeleteStream interface { +type DRPCFile_FilesDeleteStream interface { drpc.Stream - SendAndClose(*BlocksDeleteResponse) error + SendAndClose(*FilesDeleteResponse) error } -type drpcFile_BlocksDeleteStream struct { +type drpcFile_FilesDeleteStream struct { drpc.Stream } -func (x *drpcFile_BlocksDeleteStream) SendAndClose(m *BlocksDeleteResponse) error { +func (x *drpcFile_FilesDeleteStream) SendAndClose(m *FilesDeleteResponse) error { + if err := x.MsgSend(m, drpcEncoding_File_commonfile_fileproto_protos_file_proto{}); err != nil { + return err + } + return x.CloseSend() +} + +type DRPCFile_FilesInfoStream interface { + drpc.Stream + SendAndClose(*FilesInfoResponse) error +} + +type drpcFile_FilesInfoStream struct { + drpc.Stream +} + +func (x *drpcFile_FilesInfoStream) SendAndClose(m *FilesInfoResponse) error { if err := x.MsgSend(m, drpcEncoding_File_commonfile_fileproto_protos_file_proto{}); err != nil { return err } @@ -311,3 +375,19 @@ func (x *drpcFile_CheckStream) SendAndClose(m *CheckResponse) error { } return x.CloseSend() } + +type DRPCFile_SpaceInfoStream interface { + drpc.Stream + SendAndClose(*SpaceInfoResponse) error +} + +type drpcFile_SpaceInfoStream struct { + drpc.Stream +} + +func (x *drpcFile_SpaceInfoStream) SendAndClose(m *SpaceInfoResponse) error { + if err := x.MsgSend(m, drpcEncoding_File_commonfile_fileproto_protos_file_proto{}); err != nil { + return err + } + return x.CloseSend() +} diff --git a/commonfile/fileproto/fileprotoerr/fileprotoerr.go b/commonfile/fileproto/fileprotoerr/fileprotoerr.go index fc7dbb4e..5e2bf605 100644 --- a/commonfile/fileproto/fileprotoerr/fileprotoerr.go +++ b/commonfile/fileproto/fileprotoerr/fileprotoerr.go @@ -7,7 +7,11 @@ import ( ) var ( - errGroup = rpcerr.ErrGroup(fileproto.ErrCodes_ErrorOffset) - ErrUnexpected = errGroup.Register(fmt.Errorf("unexpected fileproto error"), uint64(fileproto.ErrCodes_Unexpected)) - ErrCIDNotFound = errGroup.Register(fmt.Errorf("CID not found"), uint64(fileproto.ErrCodes_CIDNotFound)) + errGroup = rpcerr.ErrGroup(fileproto.ErrCodes_ErrorOffset) + ErrUnexpected = errGroup.Register(fmt.Errorf("unexpected fileproto error"), uint64(fileproto.ErrCodes_Unexpected)) + ErrCIDNotFound = errGroup.Register(fmt.Errorf("CID not found"), uint64(fileproto.ErrCodes_CIDNotFound)) + ErrForbidden = errGroup.Register(fmt.Errorf("forbidden"), uint64(fileproto.ErrCodes_Forbidden)) + ErrSpaceLimitExceeded = errGroup.Register(fmt.Errorf("space limit exceeded"), uint64(fileproto.ErrCodes_SpaceLimitExceeded)) + ErrQuerySizeExceeded = errGroup.Register(fmt.Errorf("query size exceeded"), uint64(fileproto.ErrCodes_QuerySizeExceeded)) + ErrWrongHash = errGroup.Register(fmt.Errorf("wrong block hash"), uint64(fileproto.ErrCodes_WrongHash)) ) diff --git a/commonfile/fileproto/protos/file.proto b/commonfile/fileproto/protos/file.proto index e7610b83..5ebbb91f 100644 --- a/commonfile/fileproto/protos/file.proto +++ b/commonfile/fileproto/protos/file.proto @@ -6,6 +6,10 @@ option go_package = "commonfile/fileproto"; enum ErrCodes { Unexpected = 0; CIDNotFound = 1; + Forbidden = 2; + SpaceLimitExceeded = 3; + QuerySizeExceeded = 4; + WrongHash = 5; ErrorOffset = 200; } @@ -18,10 +22,14 @@ service File { rpc BlocksCheck(BlocksCheckRequest) returns (BlocksCheckResponse); // BlocksBind binds CIDs to space rpc BlocksBind(BlocksBindRequest) returns (BlocksBindResponse); - // BlocksDelete deletes block from space - rpc BlocksDelete(BlocksDeleteRequest) returns (BlocksDeleteResponse); + // FilesDelete deletes files by id + rpc FilesDelete(FilesDeleteRequest) returns (FilesDeleteResponse); + // FilesInfo return info by given files id + rpc FilesInfo(FilesInfoRequest) returns (FilesInfoResponse); // Check checks the connection and credentials rpc Check(CheckRequest) returns (CheckResponse); + // SpaceInfo returns usage, limit, etc about space + rpc SpaceInfo(SpaceInfoRequest) returns (SpaceInfoResponse); } message BlockGetRequest { @@ -36,8 +44,9 @@ message BlockGetResponse { message BlockPushRequest { string spaceId = 1; - bytes cid = 2; - bytes data = 3; + string fileId = 2; + bytes cid = 3; + bytes data = 4; } message BlockPushResponse {} @@ -72,14 +81,50 @@ enum AvailabilityStatus { message BlocksBindRequest { string spaceId = 1; - repeated bytes cids = 2; + string fileId = 2; + repeated bytes cids = 3; } message BlocksBindResponse {} + +message FilesDeleteRequest { + string spaceId = 1; + repeated string fileIds = 2; +} + +message FilesDeleteResponse {} + +message FilesInfoRequest { + string spaceId = 1; + repeated string fileIds = 2; +} + +message FilesInfoResponse { + repeated FileInfo filesInfo = 1; +} + +message FileInfo { + string fileId = 1; + uint64 usageBytes = 2; + uint32 cidsCount = 3; +} + message CheckRequest {} message CheckResponse { repeated string spaceIds = 1; bool allowWrite = 2; } + +message SpaceInfoRequest { + string spaceId = 1; +} + +message SpaceInfoResponse { + uint64 limitBytes = 1; + uint64 usageBytes = 2; + uint64 cidsCount = 3; + uint64 filesCount = 4; +} + diff --git a/commonfile/fileservice/fileservice.go b/commonfile/fileservice/fileservice.go index fabc70c3..c938ac08 100644 --- a/commonfile/fileservice/fileservice.go +++ b/commonfile/fileservice/fileservice.go @@ -22,6 +22,10 @@ const CName = "common.commonfile.fileservice" var log = logger.NewNamed(CName) +const ( + ChunkSize = 1 << 20 +) + func New() FileService { return &fileService{} } @@ -74,7 +78,7 @@ func (fs *fileService) AddFile(ctx context.Context, r io.Reader) (ipld.Node, err Maxlinks: helpers.DefaultLinksPerBlock, CidBuilder: &fs.prefix, } - dbh, err := dbp.New(chunker.DefaultSplitter(r)) + dbh, err := dbp.New(chunker.NewSizeSplitter(r, ChunkSize)) if err != nil { return nil, err } diff --git a/commonspace/object/acl/aclrecordproto/aclrecord.pb.go b/commonspace/object/acl/aclrecordproto/aclrecord.pb.go index c596996c..c77e7818 100644 --- a/commonspace/object/acl/aclrecordproto/aclrecord.pb.go +++ b/commonspace/object/acl/aclrecordproto/aclrecord.pb.go @@ -733,9 +733,10 @@ func (m *AclUserInvite) GetPermissions() AclUserPermissions { type AclUserJoin struct { Identity []byte `protobuf:"bytes,1,opt,name=identity,proto3" json:"identity,omitempty"` - AcceptSignature []byte `protobuf:"bytes,2,opt,name=acceptSignature,proto3" json:"acceptSignature,omitempty"` - AcceptPubKey []byte `protobuf:"bytes,3,opt,name=acceptPubKey,proto3" json:"acceptPubKey,omitempty"` - EncryptedReadKeys [][]byte `protobuf:"bytes,4,rep,name=encryptedReadKeys,proto3" json:"encryptedReadKeys,omitempty"` + EncryptionKey []byte `protobuf:"bytes,2,opt,name=encryptionKey,proto3" json:"encryptionKey,omitempty"` + AcceptSignature []byte `protobuf:"bytes,3,opt,name=acceptSignature,proto3" json:"acceptSignature,omitempty"` + AcceptPubKey []byte `protobuf:"bytes,4,opt,name=acceptPubKey,proto3" json:"acceptPubKey,omitempty"` + EncryptedReadKeys [][]byte `protobuf:"bytes,5,rep,name=encryptedReadKeys,proto3" json:"encryptedReadKeys,omitempty"` } func (m *AclUserJoin) Reset() { *m = AclUserJoin{} } @@ -778,6 +779,13 @@ func (m *AclUserJoin) GetIdentity() []byte { return nil } +func (m *AclUserJoin) GetEncryptionKey() []byte { + if m != nil { + return m.EncryptionKey + } + return nil +} + func (m *AclUserJoin) GetAcceptSignature() []byte { if m != nil { return m.AcceptSignature @@ -1144,65 +1152,66 @@ func init() { } var fileDescriptor_c8e9f754f34e929b = []byte{ - // 926 bytes of a gzipped FileDescriptorProto + // 943 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x56, 0x4f, 0x6f, 0x1b, 0x45, - 0x14, 0xf7, 0xd8, 0x49, 0x1c, 0x3f, 0x9b, 0xc4, 0x19, 0xa0, 0x5d, 0x45, 0xc5, 0x8a, 0x56, 0x42, + 0x14, 0xf7, 0xda, 0x49, 0x1c, 0x3f, 0xbb, 0x89, 0x33, 0x40, 0xbb, 0x8a, 0x8a, 0x15, 0xad, 0x40, 0x8a, 0xaa, 0xca, 0x11, 0x06, 0x29, 0x55, 0x84, 0xa8, 0xdc, 0x52, 0x64, 0xb7, 0x42, 0xaa, 0x26, - 0x40, 0x51, 0x39, 0x4d, 0x66, 0x47, 0xc9, 0x50, 0x7b, 0x77, 0x35, 0x33, 0x36, 0xf2, 0xa7, 0x80, - 0x1b, 0x57, 0x2e, 0x48, 0x7c, 0x14, 0x8e, 0xbd, 0x20, 0x71, 0x44, 0x89, 0xf8, 0x08, 0xdc, 0xd1, - 0xcc, 0xec, 0xff, 0x75, 0x2c, 0x38, 0xc0, 0x21, 0xf1, 0xce, 0x7b, 0xbf, 0x37, 0xf3, 0x7b, 0xbf, - 0x79, 0xef, 0xed, 0xc2, 0xc7, 0x2c, 0x9a, 0xcf, 0xa3, 0x50, 0xc5, 0x94, 0xf1, 0x93, 0xe8, 0xe2, - 0x5b, 0xce, 0xf4, 0x09, 0x65, 0x33, 0xf3, 0x27, 0x39, 0x8b, 0x64, 0x10, 0xcb, 0x48, 0x47, 0x27, - 0xf6, 0xbf, 0xca, 0xad, 0x43, 0x6b, 0xc0, 0x9d, 0xcc, 0xe0, 0xff, 0x84, 0xa0, 0x47, 0xe8, 0x77, - 0x63, 0x36, 0x23, 0xd6, 0x80, 0x3d, 0x68, 0xc7, 0x74, 0x35, 0x8b, 0x68, 0xe0, 0xa1, 0x23, 0x74, - 0xdc, 0x23, 0xe9, 0x12, 0x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0xec, 0x98, 0x9f, + 0x0f, 0xff, 0x0e, 0x00, 0x00, 0xff, 0xff, 0xca, 0x88, 0xea, 0x1c, 0x7b, 0x0a, 0x00, 0x00, } func (m *RawAclRecord) Marshal() (dAtA []byte, err error) { @@ -1805,7 +1814,7 @@ func (m *AclUserJoin) MarshalToSizedBuffer(dAtA []byte) (int, error) { copy(dAtA[i:], m.EncryptedReadKeys[iNdEx]) i = encodeVarintAclrecord(dAtA, i, uint64(len(m.EncryptedReadKeys[iNdEx]))) i-- - dAtA[i] = 0x22 + dAtA[i] = 0x2a } } if len(m.AcceptPubKey) > 0 { @@ -1813,13 +1822,20 @@ func (m *AclUserJoin) MarshalToSizedBuffer(dAtA []byte) (int, error) { copy(dAtA[i:], m.AcceptPubKey) i = encodeVarintAclrecord(dAtA, i, uint64(len(m.AcceptPubKey))) i-- - dAtA[i] = 0x1a + dAtA[i] = 0x22 } if len(m.AcceptSignature) > 0 { i -= len(m.AcceptSignature) copy(dAtA[i:], m.AcceptSignature) i = encodeVarintAclrecord(dAtA, i, uint64(len(m.AcceptSignature))) i-- + dAtA[i] = 0x1a + } + if len(m.EncryptionKey) > 0 { + i -= len(m.EncryptionKey) + copy(dAtA[i:], m.EncryptionKey) + i = encodeVarintAclrecord(dAtA, i, uint64(len(m.EncryptionKey))) + i-- dAtA[i] = 0x12 } if len(m.Identity) > 0 { @@ -2376,6 +2392,10 @@ func (m *AclUserJoin) Size() (n int) { if l > 0 { n += 1 + l + sovAclrecord(uint64(l)) } + l = len(m.EncryptionKey) + if l > 0 { + n += 1 + l + sovAclrecord(uint64(l)) + } l = len(m.AcceptSignature) if l > 0 { n += 1 + l + sovAclrecord(uint64(l)) @@ -4217,6 +4237,40 @@ func (m *AclUserJoin) Unmarshal(dAtA []byte) error { } iNdEx = postIndex case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field EncryptionKey", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAclrecord + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthAclrecord + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthAclrecord + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.EncryptionKey = append(m.EncryptionKey[:0], dAtA[iNdEx:postIndex]...) + if m.EncryptionKey == nil { + m.EncryptionKey = []byte{} + } + iNdEx = postIndex + case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field AcceptSignature", wireType) } @@ -4250,7 +4304,7 @@ func (m *AclUserJoin) Unmarshal(dAtA []byte) error { m.AcceptSignature = []byte{} } iNdEx = postIndex - case 3: + case 4: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field AcceptPubKey", wireType) } @@ -4284,7 +4338,7 @@ func (m *AclUserJoin) Unmarshal(dAtA []byte) error { m.AcceptPubKey = []byte{} } iNdEx = postIndex - case 4: + case 5: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field EncryptedReadKeys", wireType) } diff --git a/commonspace/object/acl/aclrecordproto/protos/aclrecord.proto b/commonspace/object/acl/aclrecordproto/protos/aclrecord.proto index aa81c3ec..72101d15 100644 --- a/commonspace/object/acl/aclrecordproto/protos/aclrecord.proto +++ b/commonspace/object/acl/aclrecordproto/protos/aclrecord.proto @@ -18,18 +18,17 @@ message AclRecord { string prevId = 1; bytes identity = 2; bytes data = 3; - uint64 currentReadKeyHash = 4; + string readKeyId = 4; int64 timestamp = 5; } message AclRoot { bytes identity = 1; - bytes encryptionKey = 2; - string spaceId = 3; - bytes encryptedReadKey = 4; - string derivationScheme = 5; - uint64 currentReadKeyHash = 6; - int64 timestamp = 7; + string spaceId = 2; + bytes encryptedReadKey = 3; + string derivationScheme = 4; + uint64 currentReadKeyHash = 5; + int64 timestamp = 6; } message AclContentValue { @@ -47,29 +46,26 @@ message AclData { } message AclState { - repeated uint64 readKeyHashes = 1; + repeated string readKeyIds = 1; repeated AclUserState userStates = 2; map invites = 3; } message AclUserState { bytes identity = 1; - bytes encryptionKey = 2; - AclUserPermissions permissions = 3; + AclUserPermissions permissions = 2; } message AclUserAdd { bytes identity = 1; - bytes encryptionKey = 2; - repeated bytes encryptedReadKeys = 3; - AclUserPermissions permissions = 4; + repeated bytes encryptedReadKeys = 2; + AclUserPermissions permissions = 3; } message AclUserInvite { bytes acceptPublicKey = 1; - uint64 encryptSymKeyHash = 2; - repeated bytes encryptedReadKeys = 3; - AclUserPermissions permissions = 4; + repeated bytes encryptedReadKeys = 2; + AclUserPermissions permissions = 3; } message AclUserJoin { @@ -86,8 +82,7 @@ message AclUserRemove { message AclReadKeyReplace { bytes identity = 1; - bytes encryptionKey = 2; - bytes encryptedReadKey = 3; + bytes encryptedReadKey = 2; } message AclUserPermissionChange { @@ -102,7 +97,7 @@ enum AclUserPermissions { } message AclSyncMessage { - AclSyncContentValue content = 2; + AclSyncContentValue content = 1; } // AclSyncContentValue provides different types for acl sync diff --git a/commonspace/object/acl/list/aclstate.go b/commonspace/object/acl/list/aclstate.go index e5922a56..a0426b42 100644 --- a/commonspace/object/acl/list/aclstate.go +++ b/commonspace/object/acl/list/aclstate.go @@ -4,8 +4,10 @@ import ( "bytes" "errors" "fmt" + "hash/fnv" + "github.com/anytypeio/any-sync/app/logger" - aclrecordproto "github.com/anytypeio/any-sync/commonspace/object/acl/aclrecordproto" + "github.com/anytypeio/any-sync/commonspace/object/acl/aclrecordproto" "github.com/anytypeio/any-sync/commonspace/object/keychain" "github.com/anytypeio/any-sync/util/crypto" "github.com/anytypeio/any-sync/util/keys" @@ -13,10 +15,9 @@ import ( "github.com/anytypeio/any-sync/util/keys/asymmetric/signingkey" "github.com/gogo/protobuf/proto" "go.uber.org/zap" - "hash/fnv" ) -var log = logger.NewNamed("acllist").Sugar() +var log = logger.NewNamedSugared("common.commonspace.acllist") var ( ErrNoSuchUser = errors.New("no such user") diff --git a/commonspace/object/tree/objecttree/treebuilder.go b/commonspace/object/tree/objecttree/treebuilder.go index 113b8381..edaa3ede 100644 --- a/commonspace/object/tree/objecttree/treebuilder.go +++ b/commonspace/object/tree/objecttree/treebuilder.go @@ -4,15 +4,16 @@ import ( "context" "errors" "fmt" + "time" + "github.com/anytypeio/any-sync/app/logger" "github.com/anytypeio/any-sync/commonspace/object/tree/treestorage" "github.com/anytypeio/any-sync/util/slice" "go.uber.org/zap" - "time" ) var ( - log = logger.NewNamed("acltree").Sugar() + log = logger.NewNamedSugared("common.commonspace.objecttree") ErrEmpty = errors.New("logs empty") ) diff --git a/commonspace/object/tree/treechangeproto/protos/treechange.proto b/commonspace/object/tree/treechangeproto/protos/treechange.proto index 2211f58f..dfc74a42 100644 --- a/commonspace/object/tree/treechangeproto/protos/treechange.proto +++ b/commonspace/object/tree/treechangeproto/protos/treechange.proto @@ -30,8 +30,8 @@ message TreeChange { string snapshotBaseId = 3; // ChangesData is an arbitrary payload to be read by the client bytes changesData = 4; - // CurrentReadKeyHash is the hash of the read key which is used to encrypt this change - uint64 currentReadKeyHash = 5; + // ReadKeyId is the id of the read key + string readKeyId = 5; // Timestamp is this change creation timestamp int64 timestamp = 6; // Identity is a public key with which the raw payload of this change is signed diff --git a/commonspace/object/tree/treechangeproto/treechange.pb.go b/commonspace/object/tree/treechangeproto/treechange.pb.go index da70a466..60eb619b 100644 --- a/commonspace/object/tree/treechangeproto/treechange.pb.go +++ b/commonspace/object/tree/treechangeproto/treechange.pb.go @@ -132,8 +132,8 @@ type TreeChange struct { SnapshotBaseId string `protobuf:"bytes,3,opt,name=snapshotBaseId,proto3" json:"snapshotBaseId,omitempty"` // ChangesData is an arbitrary payload to be read by the client ChangesData []byte `protobuf:"bytes,4,opt,name=changesData,proto3" json:"changesData,omitempty"` - // CurrentReadKeyHash is the hash of the read key which is used to encrypt this change - CurrentReadKeyHash uint64 `protobuf:"varint,5,opt,name=currentReadKeyHash,proto3" json:"currentReadKeyHash,omitempty"` + // ReadKeyId is the id of the read key + ReadKeyId string `protobuf:"bytes,5,opt,name=readKeyId,proto3" json:"readKeyId,omitempty"` // Timestamp is this change creation timestamp Timestamp int64 `protobuf:"varint,6,opt,name=timestamp,proto3" json:"timestamp,omitempty"` // Identity is a public key with which the raw payload of this change is signed @@ -203,11 +203,11 @@ func (m *TreeChange) GetChangesData() []byte { return nil } -func (m *TreeChange) GetCurrentReadKeyHash() uint64 { +func (m *TreeChange) GetReadKeyId() string { if m != nil { - return m.CurrentReadKeyHash + return m.ReadKeyId } - return 0 + return "" } func (m *TreeChange) GetTimestamp() int64 { @@ -806,51 +806,50 @@ func init() { } var fileDescriptor_5033f0301ef9b772 = []byte{ - // 690 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x55, 0xc1, 0x4e, 0xdb, 0x4a, - 0x14, 0xf5, 0x38, 0x01, 0xc3, 0x25, 0xc0, 0x7b, 0x03, 0x0b, 0x0b, 0xbd, 0xe7, 0x5a, 0x56, 0xd5, - 0xa6, 0x1b, 0x90, 0xe8, 0xaa, 0x55, 0x25, 0x54, 0x28, 0xd4, 0x11, 0x6a, 0x85, 0x06, 0x4a, 0xa5, - 0xee, 0x06, 0xfb, 0x42, 0x5c, 0x25, 0xb6, 0xeb, 0x99, 0x14, 0xe5, 0x03, 0xba, 0x69, 0xa5, 0xaa, - 0x9f, 0xd0, 0x5f, 0xe9, 0xae, 0x4b, 0x96, 0x2c, 0x2b, 0xf8, 0x91, 0xca, 0x63, 0x3b, 0xb1, 0x1d, - 0x2f, 0xd8, 0xb1, 0x71, 0x72, 0x8f, 0xef, 0x3d, 0x73, 0xee, 0xb9, 0x33, 0x63, 0xd8, 0xf1, 0xa2, - 0xe1, 0x30, 0x0a, 0x45, 0xcc, 0x3d, 0xdc, 0x8a, 0xce, 0x3e, 0xa2, 0x27, 0xb7, 0x64, 0x82, 0xa8, - 0x1e, 0x5e, 0x9f, 0x87, 0x17, 0x18, 0x27, 0x91, 0x8c, 0xb6, 0xd4, 0x53, 0x94, 0xe0, 0x4d, 0x85, - 0x50, 0x98, 0x22, 0xce, 0x35, 0x01, 0x60, 0x51, 0x24, 0xf7, 0x54, 0x48, 0xff, 0x83, 0x45, 0xee, - 0x0d, 0x5c, 0xe4, 0x7e, 0xcf, 0x37, 0x89, 0x4d, 0xba, 0x8b, 0x6c, 0x0a, 0x50, 0x13, 0x0c, 0xb5, - 0x6a, 0xcf, 0x37, 0x75, 0xf5, 0xae, 0x08, 0xa9, 0x05, 0x90, 0x11, 0x9e, 0x8c, 0x63, 0x34, 0x5b, - 0xea, 0x65, 0x09, 0x49, 0x79, 0x65, 0x30, 0x44, 0x21, 0xf9, 0x30, 0x36, 0xdb, 0x36, 0xe9, 0xb6, - 0xd8, 0x14, 0xa0, 0x14, 0xda, 0x02, 0xd1, 0x37, 0xe7, 0x6c, 0xd2, 0xed, 0x30, 0xf5, 0x9f, 0x6e, - 0xc0, 0x42, 0xe0, 0x63, 0x28, 0x03, 0x39, 0x36, 0xe7, 0x15, 0x3e, 0x89, 0xe9, 0x43, 0x58, 0xce, - 0xb8, 0x8f, 0xf8, 0x78, 0x10, 0x71, 0xdf, 0x34, 0x54, 0x42, 0x15, 0x74, 0x7e, 0xea, 0x00, 0x27, - 0x09, 0x62, 0xde, 0x9a, 0x0d, 0x4b, 0x69, 0xdf, 0x59, 0x2b, 0xc2, 0x24, 0x76, 0xab, 0xbb, 0xc8, - 0xca, 0x50, 0xb5, 0x79, 0xbd, 0xde, 0xfc, 0x23, 0x58, 0x11, 0x21, 0x8f, 0x45, 0x3f, 0x92, 0xbb, - 0x5c, 0xa4, 0x1e, 0x64, 0x6d, 0xd6, 0xd0, 0x74, 0x9d, 0x4c, 0x87, 0x78, 0xc5, 0x25, 0x57, 0xcd, - 0x76, 0x58, 0x19, 0xa2, 0x9b, 0x40, 0xbd, 0x51, 0x92, 0x60, 0x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6b, 0x69, 0x1f, 0x1e, 0xdf, 0xf1, 0x6b, 0x77, - 0x36, 0xaf, 0x7e, 0x9e, 0xfe, 0x0d, 0x00, 0x00, 0xff, 0xff, 0x24, 0x93, 0x3b, 0x00, 0x1f, 0x07, - 0x00, 0x00, + // 677 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x55, 0xcf, 0x4f, 0xd4, 0x40, + 0x14, 0xee, 0x74, 0x81, 0xb2, 0x8f, 0x05, 0x74, 0xe0, 0xd0, 0x10, 0xad, 0x4d, 0x63, 0x74, 0xbd, + 0x40, 0x82, 0x27, 0x8d, 0x09, 0x11, 0x04, 0x77, 0x43, 0x34, 0x64, 0x40, 0x4c, 0xbc, 0x0d, 0xed, + 0xc0, 0xd6, 0xec, 0x76, 0x6a, 0x67, 0x56, 0xb2, 0x7f, 0x80, 0x17, 0x4d, 0x88, 0xff, 0x92, 0x37, + 0x8f, 0x1c, 0x39, 0x1a, 0xf6, 0x1f, 0x31, 0x9d, 0x69, 0xb7, 0x3f, 0x76, 0x0f, 0xdc, 0xb8, 0x74, + 0xf7, 0x7d, 0x7d, 0xef, 0x7b, 0xdf, 0xfb, 0xe6, 0x47, 0x61, 0xc7, 0xe7, 0x83, 0x01, 0x8f, 0x44, + 0x4c, 0x7d, 0xb6, 0xc5, 0xcf, 0xbe, 0x32, 0x5f, 0x6e, 0xc9, 0x84, 0x31, 0xf5, 0xf0, 0x7b, 0x34, + 0xba, 0x60, 0x71, 0xc2, 0x25, 0xdf, 0x52, 0x4f, 0x51, 0x82, 0x37, 0x15, 0x82, 0xa1, 0x40, 0xbc, + 0x1b, 0x04, 0x40, 0x38, 0x97, 0x7b, 0x2a, 0xc4, 0x8f, 0xa0, 0x49, 0xfd, 0x7e, 0x87, 0xd1, 0xa0, + 0x1b, 0xd8, 0xc8, 0x45, 0xed, 0x26, 0x29, 0x00, 0x6c, 0x83, 0xa5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xd9, 0x7e, 0x39, 0xa9, 0x63, 0x90, + 0x6a, 0xd5, 0xae, 0x05, 0xf3, 0xdf, 0x53, 0xab, 0xbc, 0x1f, 0x08, 0x56, 0xaa, 0x6e, 0xe0, 0x75, + 0x98, 0x4f, 0xdd, 0xc8, 0x4f, 0x9c, 0x0e, 0xf0, 0x2b, 0xb0, 0xb2, 0x23, 0x61, 0x9b, 0x6e, 0xe3, + 0x2e, 0x4b, 0x95, 0xe7, 0x63, 0x0f, 0x5a, 0xf9, 0x91, 0x3b, 0xa2, 0xb2, 0x67, 0x37, 0x14, 0x6f, + 0x05, 0xf3, 0x7e, 0x22, 0x58, 0x9b, 0x61, 0xe9, 0xfd, 0x88, 0xf9, 0x85, 0xf4, 0xc6, 0xaa, 0xaf, + 0xc8, 0xfd, 0xa8, 0x79, 0x01, 0x0f, 0xa7, 0x56, 0x34, 0x55, 0xa2, 0x56, 0x34, 0xbb, 0xf3, 0x75, + 0xe0, 0x9d, 0xea, 0xc5, 0xd4, 0xbd, 0xba, 0xd1, 0x39, 0xaf, 0xdd, 0xf3, 0x68, 0xea, 0x9e, 0x9f, + 0xba, 0x99, 0xcd, 0x19, 0x37, 0xf3, 0xee, 0xdb, 0xbf, 0xb7, 0x0e, 0xba, 0xbe, 0x75, 0xd0, 0xbf, + 0x5b, 0x07, 0xfd, 0x1e, 0x3b, 0xc6, 0xf5, 0xd8, 0x31, 0x6e, 0xc6, 0x8e, 0xf1, 0xe5, 0xf9, 0x1d, + 0xbf, 0x6d, 0x67, 0x0b, 0xea, 0xe7, 0xe5, 0xff, 0x00, 0x00, 0x00, 0xff, 0xff, 0xbc, 0xc0, 0xf7, + 0x30, 0x0d, 0x07, 0x00, 0x00, } func (m *RootChange) Marshal() (dAtA []byte, err error) { @@ -965,10 +964,12 @@ func (m *TreeChange) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x30 } - if m.CurrentReadKeyHash != 0 { - i = encodeVarintTreechange(dAtA, i, uint64(m.CurrentReadKeyHash)) + if len(m.ReadKeyId) > 0 { + i -= len(m.ReadKeyId) + copy(dAtA[i:], m.ReadKeyId) + i = encodeVarintTreechange(dAtA, i, uint64(len(m.ReadKeyId))) i-- - dAtA[i] = 0x28 + dAtA[i] = 0x2a } if len(m.ChangesData) > 0 { i -= len(m.ChangesData) @@ -1543,8 +1544,9 @@ func (m *TreeChange) Size() (n int) { if l > 0 { n += 1 + l + sovTreechange(uint64(l)) } - if m.CurrentReadKeyHash != 0 { - n += 1 + sovTreechange(uint64(m.CurrentReadKeyHash)) + l = len(m.ReadKeyId) + if l > 0 { + n += 1 + l + sovTreechange(uint64(l)) } if m.Timestamp != 0 { n += 1 + sovTreechange(uint64(m.Timestamp)) @@ -2214,10 +2216,10 @@ func (m *TreeChange) Unmarshal(dAtA []byte) error { } iNdEx = postIndex case 5: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field CurrentReadKeyHash", wireType) + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ReadKeyId", wireType) } - m.CurrentReadKeyHash = 0 + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTreechange @@ -2227,11 +2229,24 @@ func (m *TreeChange) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.CurrentReadKeyHash |= uint64(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTreechange + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTreechange + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ReadKeyId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex case 6: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Timestamp", wireType) diff --git a/commonspace/space.go b/commonspace/space.go index ece7437d..f6de90ea 100644 --- a/commonspace/space.go +++ b/commonspace/space.go @@ -295,7 +295,13 @@ func (s *space) PutTree(ctx context.Context, payload treestorage.TreeStorageCrea SyncStatus: s.syncStatus, PeerGetter: s.peerManager, } - return synctree.PutSyncTree(ctx, payload, deps) + t, err = synctree.PutSyncTree(ctx, payload, deps) + if err != nil { + return + } + s.treesUsed.Add(1) + log.Debug("incrementing counter", zap.String("id", payload.RootRawChange.Id), zap.Int32("trees", s.treesUsed.Load()), zap.String("spaceId", s.id)) + return } type BuildTreeOpts struct { @@ -330,8 +336,8 @@ func (s *space) BuildTree(ctx context.Context, id string, opts BuildTreeOpts) (t if t, err = synctree.BuildSyncTreeOrGetRemote(ctx, id, deps); err != nil { return nil, err } - log.Debug("incrementing counter", zap.String("id", id), zap.String("spaceId", s.id)) s.treesUsed.Add(1) + log.Debug("incrementing counter", zap.String("id", id), zap.Int32("trees", s.treesUsed.Load()), zap.String("spaceId", s.id)) return } @@ -406,8 +412,8 @@ func (s *space) handleMessage(msg HandleMessage) { } func (s *space) onObjectClose(id string) { - log.Debug("decrementing counter", zap.String("id", id), zap.String("spaceId", s.id)) s.treesUsed.Add(-1) + log.Debug("decrementing counter", zap.String("id", id), zap.Int32("trees", s.treesUsed.Load()), zap.String("spaceId", s.id)) _ = s.handleQueue.CloseThread(id) } diff --git a/commonspace/spaceservice.go b/commonspace/spaceservice.go index 89e9283b..cf4a2710 100644 --- a/commonspace/spaceservice.go +++ b/commonspace/spaceservice.go @@ -17,6 +17,7 @@ import ( "github.com/anytypeio/any-sync/commonspace/syncstatus" "github.com/anytypeio/any-sync/net/peer" "github.com/anytypeio/any-sync/net/pool" + "github.com/anytypeio/any-sync/net/rpc/rpcerr" "github.com/anytypeio/any-sync/nodeconf" "sync/atomic" ) @@ -35,6 +36,7 @@ const AddSpaceCtxKey ctxKey = 0 type SpaceService interface { DeriveSpace(ctx context.Context, payload SpaceDerivePayload) (string, error) + DeriveId(ctx context.Context, payload SpaceDerivePayload) (string, error) CreateSpace(ctx context.Context, payload SpaceCreatePayload) (string, error) NewSpace(ctx context.Context, id string) (sp Space, err error) app.Component @@ -88,6 +90,15 @@ func (s *spaceService) CreateSpace(ctx context.Context, payload SpaceCreatePaylo return store.Id(), nil } +func (s *spaceService) DeriveId(ctx context.Context, payload SpaceDerivePayload) (id string, err error) { + storageCreate, err := storagePayloadForSpaceDerive(payload) + if err != nil { + return + } + id = storageCreate.SpaceHeaderWithId.Id + return +} + func (s *spaceService) DeriveSpace(ctx context.Context, payload SpaceDerivePayload) (id string, err error) { storageCreate, err := storagePayloadForSpaceDerive(payload) if err != nil { @@ -206,6 +217,7 @@ func (s *spaceService) getSpaceStorageFromRemote(ctx context.Context, id string) cl := spacesyncproto.NewDRPCSpaceSyncClient(p) res, err := cl.SpacePull(ctx, &spacesyncproto.SpacePullRequest{Id: id}) if err != nil { + err = rpcerr.Unwrap(err) return } diff --git a/go.mod b/go.mod index 980af79b..58598953 100644 --- a/go.mod +++ b/go.mod @@ -15,8 +15,8 @@ require ( github.com/huandu/skiplist v1.2.0 github.com/ipfs/go-block-format v0.1.1 github.com/ipfs/go-blockservice v0.5.0 - github.com/ipfs/go-cid v0.3.2 - github.com/ipfs/go-ipfs-blockstore v1.2.0 + github.com/ipfs/go-cid v0.4.0 + github.com/ipfs/go-ipfs-blockstore v1.3.0 github.com/ipfs/go-ipfs-chunker v0.0.5 github.com/ipfs/go-ipfs-exchange-interface v0.2.0 github.com/ipfs/go-ipld-format v0.4.0 @@ -25,7 +25,7 @@ require ( github.com/libp2p/go-libp2p v0.24.1 github.com/minio/sha256-simd v1.0.0 github.com/mr-tron/base58 v1.2.0 - github.com/multiformats/go-multibase v0.1.1 + github.com/multiformats/go-multibase v0.2.0 github.com/multiformats/go-multihash v0.2.1 github.com/prometheus/client_golang v1.14.0 github.com/stretchr/testify v1.8.2 diff --git a/go.sum b/go.sum index 5037014e..242ad87b 100644 --- a/go.sum +++ b/go.sum @@ -106,15 +106,15 @@ github.com/ipfs/go-cid v0.0.4/go.mod h1:4LLaPOQwmk5z9LBgQnpkivrx8BJjUyGwTXCd5Xfj github.com/ipfs/go-cid v0.0.5/go.mod h1:plgt+Y5MnOey4vO4UlUazGqdbEXuFYitED67FexhXog= github.com/ipfs/go-cid v0.0.6/go.mod h1:6Ux9z5e+HpkQdckYoX1PG/6xqKspzlEIR5SDmgqgC/I= github.com/ipfs/go-cid v0.0.7/go.mod h1:6Ux9z5e+HpkQdckYoX1PG/6xqKspzlEIR5SDmgqgC/I= -github.com/ipfs/go-cid v0.3.2 h1:OGgOd+JCFM+y1DjWPmVH+2/4POtpDzwcr7VgnB7mZXc= -github.com/ipfs/go-cid v0.3.2/go.mod h1:gQ8pKqT/sUxGY+tIwy1RPpAojYu7jAyCp5Tz1svoupw= +github.com/ipfs/go-cid v0.4.0 h1:a4pdZq0sx6ZSxbCizebnKiMCx/xI/aBBFlB73IgH4rA= +github.com/ipfs/go-cid v0.4.0/go.mod h1:uQHwDeX4c6CtyrFwdqyhpNcxVewur1M7l7fNU7LKwZk= github.com/ipfs/go-datastore v0.5.0/go.mod h1:9zhEApYMTl17C8YDp7JmU7sQZi2/wqiYh73hakZ90Bk= github.com/ipfs/go-datastore v0.6.0 h1:JKyz+Gvz1QEZw0LsX1IBn+JFCJQH4SJVFtM4uWU0Myk= github.com/ipfs/go-datastore v0.6.0/go.mod h1:rt5M3nNbSO/8q1t4LNkLyUwRs8HupMeN/8O4Vn9YAT8= github.com/ipfs/go-detect-race v0.0.1 h1:qX/xay2W3E4Q1U7d9lNs1sU9nvguX0a7319XbyQ6cOk= github.com/ipfs/go-detect-race v0.0.1/go.mod h1:8BNT7shDZPo99Q74BpGMK+4D8Mn4j46UU0LZ723meps= -github.com/ipfs/go-ipfs-blockstore v1.2.0 h1:n3WTeJ4LdICWs/0VSfjHrlqpPpl6MZ+ySd3j8qz0ykw= -github.com/ipfs/go-ipfs-blockstore v1.2.0/go.mod h1:eh8eTFLiINYNSNawfZOC7HOxNTxpB1PFuA5E1m/7exE= +github.com/ipfs/go-ipfs-blockstore v1.3.0 h1:m2EXaWgwTzAfsmt5UdJ7Is6l4gJcaM/A12XwJyvYvMM= +github.com/ipfs/go-ipfs-blockstore v1.3.0/go.mod h1:KgtZyc9fq+P2xJUiCAzbRdhhqJHvsw8u2Dlqy2MyRTE= github.com/ipfs/go-ipfs-blocksutil v0.0.1 h1:Eh/H4pc1hsvhzsQoMEP3Bke/aW5P5rVM1IWFJMcGIPQ= github.com/ipfs/go-ipfs-chunker v0.0.5 h1:ojCf7HV/m+uS2vhUGWcogIIxiO5ubl5O57Q7NapWLY8= github.com/ipfs/go-ipfs-chunker v0.0.5/go.mod h1:jhgdF8vxRHycr00k13FM8Y0E+6BoalYeobXmUyTreP8= @@ -136,7 +136,6 @@ github.com/ipfs/go-ipld-cbor v0.0.6 h1:pYuWHyvSpIsOOLw4Jy7NbBkCyzLDcl64Bf/LZW7eB github.com/ipfs/go-ipld-cbor v0.0.6/go.mod h1:ssdxxaLJPXH7OjF5V4NSjBbcfh+evoR4ukuru0oPXMA= github.com/ipfs/go-ipld-format v0.0.1/go.mod h1:kyJtbkDALmFHv3QR6et67i35QzO3S0dCDnkOJhcZkms= github.com/ipfs/go-ipld-format v0.2.0/go.mod h1:3l3C1uKoadTPbeNfrDi+xMInYKlx2Cvg1BuydPSdzQs= -github.com/ipfs/go-ipld-format v0.3.0/go.mod h1:co/SdBE8h99968X0hViiw1MNlh6fvxxnHpvVLnH7jSM= github.com/ipfs/go-ipld-format v0.4.0 h1:yqJSaJftjmjc9jEOFYlpkwOLVKv68OD27jFLlSghBlQ= github.com/ipfs/go-ipld-format v0.4.0/go.mod h1:co/SdBE8h99968X0hViiw1MNlh6fvxxnHpvVLnH7jSM= github.com/ipfs/go-ipld-legacy v0.1.1 h1:BvD8PEuqwBHLTKqlGFTHSwrwFOMkVESEvwIYwR2cdcc= @@ -236,8 +235,8 @@ github.com/multiformats/go-multiaddr-dns v0.3.1 h1:QgQgR+LQVt3NPTjbrLLpsaT2ufAA2 github.com/multiformats/go-multiaddr-fmt v0.1.0 h1:WLEFClPycPkp4fnIzoFoV9FVd49/eQsuaL3/CWe167E= github.com/multiformats/go-multibase v0.0.1/go.mod h1:bja2MqRZ3ggyXtZSEDKpl0uO/gviWFaSteVbWT51qgs= github.com/multiformats/go-multibase v0.0.3/go.mod h1:5+1R4eQrT3PkYZ24C3W2Ue2tPwIdYQD509ZjSb5y9Oc= -github.com/multiformats/go-multibase v0.1.1 h1:3ASCDsuLX8+j4kx58qnJ4YFq/JWTJpCyDW27ztsVTOI= -github.com/multiformats/go-multibase v0.1.1/go.mod h1:ZEjHE+IsUrgp5mhlEAYjMtZwK1k4haNkcaPg9aoe1a8= +github.com/multiformats/go-multibase v0.2.0 h1:isdYCVLvksgWlMW9OZRYJEa9pZETFivncJHmHnnd87g= +github.com/multiformats/go-multibase v0.2.0/go.mod h1:bFBZX4lKCA/2lyOFSAoKH5SS6oPyjtnzK/XTFDPkNuk= github.com/multiformats/go-multicodec v0.8.0 h1:evBmgkbSQux+Ds2IgfhkO38Dl2GDtRW8/Rp6YiSHX/Q= github.com/multiformats/go-multicodec v0.8.0/go.mod h1:GUC8upxSBE4oG+q3kWZRw/+6yC1BqO550bjhWsJbZlw= github.com/multiformats/go-multihash v0.0.1/go.mod h1:w/5tugSrLEbWqlcgJabL3oHFKTwfvkofsjW2Qa1ct4U= diff --git a/net/peer/peer.go b/net/peer/peer.go index c96cd4ba..92137930 100644 --- a/net/peer/peer.go +++ b/net/peer/peer.go @@ -2,15 +2,16 @@ package peer import ( "context" + "sync/atomic" + "time" + "github.com/anytypeio/any-sync/app/logger" "github.com/libp2p/go-libp2p/core/sec" "go.uber.org/zap" "storj.io/drpc" - "sync/atomic" - "time" ) -var log = logger.NewNamed("peer") +var log = logger.NewNamed("common.net.peer") func NewPeer(sc sec.SecureConn, conn drpc.Conn) Peer { return &peer{ diff --git a/net/pool/pool.go b/net/pool/pool.go index 287ab512..b2e4ae22 100644 --- a/net/pool/pool.go +++ b/net/pool/pool.go @@ -67,6 +67,7 @@ func (p *pool) GetOneOf(ctx context.Context, peerIds []string) (peer.Peer, error default: return pr, nil } + _, _ = p.cache.Remove(ctx, peerId) } } // shuffle ids for better consistency diff --git a/net/timeoutconn/conn.go b/net/timeoutconn/conn.go index 0f5c5d30..62917dbc 100644 --- a/net/timeoutconn/conn.go +++ b/net/timeoutconn/conn.go @@ -2,14 +2,15 @@ package timeoutconn import ( "errors" - "github.com/anytypeio/any-sync/app/logger" - "go.uber.org/zap" "net" "os" "time" + + "github.com/anytypeio/any-sync/app/logger" + "go.uber.org/zap" ) -var log = logger.NewNamed("net.timeoutconn") +var log = logger.NewNamed("common.net.timeoutconn") type Conn struct { net.Conn