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.

bucket.go 2.1 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. package coordinator
  2. import (
  3. "gitlink.org.cn/cloudream/common/pkg/mq"
  4. "gitlink.org.cn/cloudream/storage-common/pkgs/db/model"
  5. )
  6. type GetUserBuckets struct {
  7. UserID int64 `json:"userID"`
  8. }
  9. func NewGetUserBuckets(userID int64) GetUserBuckets {
  10. return GetUserBuckets{
  11. UserID: userID,
  12. }
  13. }
  14. type GetUserBucketsResp struct {
  15. Buckets []model.Bucket `json:"buckets"`
  16. }
  17. func NewGetUserBucketsResp(buckets []model.Bucket) GetUserBucketsResp {
  18. return GetUserBucketsResp{
  19. Buckets: buckets,
  20. }
  21. }
  22. type GetBucketObjects struct {
  23. UserID int64 `json:"userID"`
  24. BucketID int64 `json:"bucketID"`
  25. }
  26. func NewGetBucketObjects(userID int64, bucketID int64) GetBucketObjects {
  27. return GetBucketObjects{
  28. UserID: userID,
  29. BucketID: bucketID,
  30. }
  31. }
  32. type GetBucketObjectsResp struct {
  33. Objects []model.Object `json:"objects"`
  34. }
  35. func NewGetBucketObjectsResp(objects []model.Object) GetBucketObjectsResp {
  36. return GetBucketObjectsResp{
  37. Objects: objects,
  38. }
  39. }
  40. type CreateBucket struct {
  41. UserID int64 `json:"userID"`
  42. BucketName string `json:"bucketName"`
  43. }
  44. func NewCreateBucket(userID int64, bucketName string) CreateBucket {
  45. return CreateBucket{
  46. UserID: userID,
  47. BucketName: bucketName,
  48. }
  49. }
  50. type CreateBucketResp struct {
  51. BucketID int64 `json:"bucketID"`
  52. }
  53. func NewCreateBucketResp(bucketID int64) CreateBucketResp {
  54. return CreateBucketResp{
  55. BucketID: bucketID,
  56. }
  57. }
  58. type DeleteBucket struct {
  59. UserID int64 `json:"userID"`
  60. BucketID int64 `json:"bucketID"`
  61. }
  62. func NewDeleteBucket(userID int64, bucketID int64) DeleteBucket {
  63. return DeleteBucket{
  64. UserID: userID,
  65. BucketID: bucketID,
  66. }
  67. }
  68. type DeleteBucketResp struct{}
  69. func NewDeleteBucketResp() DeleteBucketResp {
  70. return DeleteBucketResp{}
  71. }
  72. func init() {
  73. mq.RegisterMessage[GetUserBuckets]()
  74. mq.RegisterMessage[GetUserBucketsResp]()
  75. mq.RegisterMessage[GetBucketObjects]()
  76. mq.RegisterMessage[GetBucketObjectsResp]()
  77. mq.RegisterMessage[CreateBucket]()
  78. mq.RegisterMessage[CreateBucketResp]()
  79. mq.RegisterMessage[DeleteBucket]()
  80. mq.RegisterMessage[DeleteBucketResp]()
  81. }

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