diff options
Diffstat (limited to 'weed/server')
| -rw-r--r-- | weed/server/volume_grpc_tier.go | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/weed/server/volume_grpc_tier.go b/weed/server/volume_grpc_tier.go new file mode 100644 index 000000000..d910db740 --- /dev/null +++ b/weed/server/volume_grpc_tier.go @@ -0,0 +1,38 @@ +package weed_server + +import ( + "context" + "fmt" + "os" + + "github.com/chrislusf/seaweedfs/weed/pb/volume_server_pb" + "github.com/chrislusf/seaweedfs/weed/storage/backend" + "github.com/chrislusf/seaweedfs/weed/storage/needle" +) + +// VolumeTierCopyDatToRemote copy dat file to a remote tier +func (vs *VolumeServer) VolumeTierCopyDatToRemote(ctx context.Context, req *volume_server_pb.VolumeTierCopyDatToRemoteRequest) (*volume_server_pb.VolumeTierCopyDatToRemoteResponse, error) { + + v := vs.store.GetVolume(needle.VolumeId(req.VolumeId)) + if v == nil { + return nil, fmt.Errorf("volume %d not found", req.VolumeId) + } + + if v.Collection != req.Collection { + return nil, fmt.Errorf("existing collection:%v unexpected input: %v", v.Collection, req.Collection) + } + + diskFile, ok := v.DataBackend.(*backend.DiskFile) + if !ok { + return nil, fmt.Errorf("volume %d is not on local disk", req.VolumeId) + } + err := uploadFileToRemote(ctx, req, diskFile.File) + + return &volume_server_pb.VolumeTierCopyDatToRemoteResponse{}, err +} + +func uploadFileToRemote(ctx context.Context, req *volume_server_pb.VolumeTierCopyDatToRemoteRequest, f *os.File) error { + println("copying dat file of", f.Name(), "to remote") + + return nil +}
\ No newline at end of file |
