Skip to content

Commit

Permalink
rename space -> store
Browse files Browse the repository at this point in the history
  • Loading branch information
cheggaaa committed Sep 15, 2023
1 parent 94c2c99 commit b6a6ce1
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
12 changes: 6 additions & 6 deletions filenode/filenode.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func (fn *fileNode) Get(ctx context.Context, k cid.Cid) (blocks.Block, error) {
}

func (fn *fileNode) Add(ctx context.Context, spaceId string, fileId string, bs []blocks.Block) error {
storeKey, err := fn.ValidateSpaceId(ctx, spaceId, true)
storeKey, err := fn.StoreKey(ctx, spaceId, true)
if err != nil {
return err
}
Expand All @@ -92,7 +92,7 @@ func (fn *fileNode) Add(ctx context.Context, spaceId string, fileId string, bs [
func (fn *fileNode) Check(ctx context.Context, spaceId string, cids ...cid.Cid) (result []*fileproto.BlockAvailability, err error) {
var storeKey string
if spaceId != "" {
if storeKey, err = fn.ValidateSpaceId(ctx, spaceId, false); err != nil {
if storeKey, err = fn.StoreKey(ctx, spaceId, false); err != nil {
return
}
}
Expand Down Expand Up @@ -128,7 +128,7 @@ func (fn *fileNode) Check(ctx context.Context, spaceId string, cids ...cid.Cid)
}

func (fn *fileNode) BlocksBind(ctx context.Context, spaceId, fileId string, cids ...cid.Cid) (err error) {
storeKey, err := fn.ValidateSpaceId(ctx, spaceId, true)
storeKey, err := fn.StoreKey(ctx, spaceId, true)
if err != nil {
return err
}
Expand All @@ -140,7 +140,7 @@ func (fn *fileNode) BlocksBind(ctx context.Context, spaceId, fileId string, cids
return fn.index.BindCids(ctx, storeKey, fileId, cids)
}

func (fn *fileNode) ValidateSpaceId(ctx context.Context, spaceId string, checkLimit bool) (storageKey string, err error) {
func (fn *fileNode) StoreKey(ctx context.Context, spaceId string, checkLimit bool) (storageKey string, err error) {
if spaceId == "" {
return "", fileprotoerr.ErrForbidden
}
Expand Down Expand Up @@ -182,7 +182,7 @@ func (fn *fileNode) SpaceInfo(ctx context.Context, spaceId string) (info *filepr
}

func (fn *fileNode) FilesDelete(ctx context.Context, spaceId string, fileIds []string) (err error) {
storeKey, err := fn.ValidateSpaceId(ctx, spaceId, false)
storeKey, err := fn.StoreKey(ctx, spaceId, false)
if err != nil {
return
}
Expand All @@ -195,7 +195,7 @@ func (fn *fileNode) FilesDelete(ctx context.Context, spaceId string, fileIds []s
}

func (fn *fileNode) FileInfo(ctx context.Context, spaceId, fileId string) (info *fileproto.FileInfo, err error) {
storeKey, err := fn.ValidateSpaceId(ctx, spaceId, false)
storeKey, err := fn.StoreKey(ctx, spaceId, false)
if err != nil {
return
}
Expand Down
2 changes: 1 addition & 1 deletion filenode/rpchandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ func (r rpcHandler) FilesInfo(ctx context.Context, req *fileproto.FilesInfoReque
resp = &fileproto.FilesInfoResponse{
FilesInfo: make([]*fileproto.FileInfo, len(req.FileIds)),
}
_, err = r.f.ValidateSpaceId(ctx, req.SpaceId, false)
_, err = r.f.StoreKey(ctx, req.SpaceId, false)
if err != nil {
return nil, err
}
Expand Down
4 changes: 2 additions & 2 deletions index/redisindex/redisindex.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ import (
CIDS:
c:{cid}: proto(Entry)
SPACES:
s:{spaceId}: map
STORES:
s:{storeKey}: map
f:{fileId} -> snappy(proto(CidList))
{cid} -> int(refCount)
size -> int(summarySize)
Expand Down

0 comments on commit b6a6ce1

Please sign in to comment.