51 lines
1.4 KiB
Go
51 lines
1.4 KiB
Go
package hubrpc
|
|
|
|
/*
|
|
import (
|
|
"context"
|
|
|
|
jcstypes "gitlink.org.cn/cloudream/jcs-pub/common/types"
|
|
"gitlink.org.cn/cloudream/jcs-pub/common/pkgs/rpc"
|
|
)
|
|
|
|
type CacheSvc interface {
|
|
CheckCache(ctx context.Context, req *CheckCache) (*CheckCacheResp, *rpc.CodeError)
|
|
CacheGC(ctx context.Context, req *CacheGC) (*CacheGCResp, *rpc.CodeError)
|
|
}
|
|
|
|
// 获取Cache中文件列表
|
|
type CheckCache struct {
|
|
UserSpace jcstypes.UserSpaceDetail
|
|
}
|
|
type CheckCacheResp struct {
|
|
FileHashes []jcstypes.FileHash
|
|
}
|
|
|
|
func (c *Client) CheckCache(ctx context.Context, req *CheckCache) (*CheckCacheResp, *rpc.CodeError) {
|
|
if c.fusedErr != nil {
|
|
return nil, c.fusedErr
|
|
}
|
|
return rpc.UnaryClient[*CheckCacheResp](c.cli.CheckCache, ctx, req)
|
|
}
|
|
func (s *Server) CheckCache(ctx context.Context, req *rpc.Request) (*rpc.Response, error) {
|
|
return rpc.UnaryServer(s.svrImpl.CheckCache, ctx, req)
|
|
}
|
|
|
|
// 清理Cache中不用的文件
|
|
type CacheGC struct {
|
|
UserSpace jcstypes.UserSpaceDetail
|
|
Availables []jcstypes.FileHash
|
|
}
|
|
type CacheGCResp struct{}
|
|
|
|
func (c *Client) CacheGC(ctx context.Context, req *CacheGC) (*CacheGCResp, *rpc.CodeError) {
|
|
if c.fusedErr != nil {
|
|
return nil, c.fusedErr
|
|
}
|
|
return rpc.UnaryClient[*CacheGCResp](c.cli.CacheGC, ctx, req)
|
|
}
|
|
func (s *Server) CacheGC(ctx context.Context, req *rpc.Request) (*rpc.Response, error) {
|
|
return rpc.UnaryServer(s.svrImpl.CacheGC, ctx, req)
|
|
}
|
|
*/
|