You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

cache.go 1.4 kB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. package hubrpc
  2. /*
  3. import (
  4. "context"
  5. clitypes "gitlink.org.cn/cloudream/jcs-pub/client/types"
  6. "gitlink.org.cn/cloudream/jcs-pub/common/pkgs/rpc"
  7. )
  8. type CacheSvc interface {
  9. CheckCache(ctx context.Context, req *CheckCache) (*CheckCacheResp, *rpc.CodeError)
  10. CacheGC(ctx context.Context, req *CacheGC) (*CacheGCResp, *rpc.CodeError)
  11. }
  12. // 获取Cache中文件列表
  13. type CheckCache struct {
  14. UserSpace clitypes.UserSpaceDetail
  15. }
  16. type CheckCacheResp struct {
  17. FileHashes []clitypes.FileHash
  18. }
  19. func (c *Client) CheckCache(ctx context.Context, req *CheckCache) (*CheckCacheResp, *rpc.CodeError) {
  20. if c.fusedErr != nil {
  21. return nil, c.fusedErr
  22. }
  23. return rpc.UnaryClient[*CheckCacheResp](c.cli.CheckCache, ctx, req)
  24. }
  25. func (s *Server) CheckCache(ctx context.Context, req *rpc.Request) (*rpc.Response, error) {
  26. return rpc.UnaryServer(s.svrImpl.CheckCache, ctx, req)
  27. }
  28. // 清理Cache中不用的文件
  29. type CacheGC struct {
  30. UserSpace clitypes.UserSpaceDetail
  31. Availables []clitypes.FileHash
  32. }
  33. type CacheGCResp struct{}
  34. func (c *Client) CacheGC(ctx context.Context, req *CacheGC) (*CacheGCResp, *rpc.CodeError) {
  35. if c.fusedErr != nil {
  36. return nil, c.fusedErr
  37. }
  38. return rpc.UnaryClient[*CacheGCResp](c.cli.CacheGC, ctx, req)
  39. }
  40. func (s *Server) CacheGC(ctx context.Context, req *rpc.Request) (*rpc.Response, error) {
  41. return rpc.UnaryServer(s.svrImpl.CacheGC, ctx, req)
  42. }
  43. */

本项目旨在将云际存储公共基础设施化,使个人及企业可低门槛使用高效的云际存储服务(安装开箱即用云际存储客户端即可,无需关注其他组件的部署),同时支持用户灵活便捷定制云际存储的功能细节。