mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
remove deprecated code
This commit is contained in:
parent
df95ce0b6c
commit
19728fe3f6
|
@ -2,12 +2,8 @@ package operation
|
|||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"github.com/chrislusf/seaweedfs/weed/pb/volume_server_pb"
|
||||
. "github.com/chrislusf/seaweedfs/weed/storage/types"
|
||||
"github.com/chrislusf/seaweedfs/weed/util"
|
||||
"google.golang.org/grpc"
|
||||
"io"
|
||||
)
|
||||
|
||||
func GetVolumeSyncStatus(server string, grpcDialOption grpc.DialOption, vid uint32) (resp *volume_server_pb.VolumeSyncStatusResponse, err error) {
|
||||
|
@ -22,40 +18,3 @@ func GetVolumeSyncStatus(server string, grpcDialOption grpc.DialOption, vid uint
|
|||
|
||||
return
|
||||
}
|
||||
|
||||
func GetVolumeIdxEntries(server string, grpcDialOption grpc.DialOption, vid uint32, eachEntryFn func(key NeedleId, offset Offset, size uint32)) error {
|
||||
|
||||
return WithVolumeServerClient(server, grpcDialOption, func(client volume_server_pb.VolumeServerClient) error {
|
||||
stream, err := client.VolumeSyncIndex(context.Background(), &volume_server_pb.VolumeSyncIndexRequest{
|
||||
VolumeId: vid,
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
var indexFileContent []byte
|
||||
|
||||
for {
|
||||
resp, err := stream.Recv()
|
||||
if err == io.EOF {
|
||||
break
|
||||
}
|
||||
if err != nil {
|
||||
return fmt.Errorf("read index entries: %v", err)
|
||||
}
|
||||
indexFileContent = append(indexFileContent, resp.IndexFileContent...)
|
||||
}
|
||||
|
||||
dataSize := len(indexFileContent)
|
||||
|
||||
for idx := 0; idx+NeedleEntrySize <= dataSize; idx += NeedleEntrySize {
|
||||
line := indexFileContent[idx : idx+NeedleEntrySize]
|
||||
key := BytesToNeedleId(line[:NeedleIdSize])
|
||||
offset := BytesToOffset(line[NeedleIdSize : NeedleIdSize+OffsetSize])
|
||||
size := util.BytesToUint32(line[NeedleIdSize+OffsetSize : NeedleIdSize+OffsetSize+SizeSize])
|
||||
eachEntryFn(key, offset, size)
|
||||
}
|
||||
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
|
|
@ -26,10 +26,6 @@ service VolumeServer {
|
|||
}
|
||||
rpc VolumeFollow (VolumeFollowRequest) returns (stream VolumeFollowResponse) {
|
||||
}
|
||||
rpc VolumeSyncIndex (VolumeSyncIndexRequest) returns (stream VolumeSyncIndexResponse) {
|
||||
}
|
||||
rpc VolumeSyncData (VolumeSyncDataRequest) returns (stream VolumeSyncDataResponse) {
|
||||
}
|
||||
|
||||
rpc VolumeMount (VolumeMountRequest) returns (VolumeMountResponse) {
|
||||
}
|
||||
|
@ -129,24 +125,6 @@ message VolumeFollowResponse {
|
|||
bytes file_content = 1;
|
||||
}
|
||||
|
||||
message VolumeSyncIndexRequest {
|
||||
uint32 volume_id = 1;
|
||||
}
|
||||
message VolumeSyncIndexResponse {
|
||||
bytes index_file_content = 1;
|
||||
}
|
||||
|
||||
message VolumeSyncDataRequest {
|
||||
uint32 volume_id = 1;
|
||||
uint32 revision = 2;
|
||||
uint32 offset = 3;
|
||||
uint32 size = 4;
|
||||
string needle_id = 5;
|
||||
}
|
||||
message VolumeSyncDataResponse {
|
||||
bytes file_content = 1;
|
||||
}
|
||||
|
||||
message VolumeMountRequest {
|
||||
uint32 volume_id = 1;
|
||||
}
|
||||
|
|
|
@ -29,10 +29,6 @@ It has these top-level messages:
|
|||
VolumeSyncStatusResponse
|
||||
VolumeFollowRequest
|
||||
VolumeFollowResponse
|
||||
VolumeSyncIndexRequest
|
||||
VolumeSyncIndexResponse
|
||||
VolumeSyncDataRequest
|
||||
VolumeSyncDataResponse
|
||||
VolumeMountRequest
|
||||
VolumeMountResponse
|
||||
VolumeUnmountRequest
|
||||
|
@ -462,102 +458,6 @@ func (m *VolumeFollowResponse) GetFileContent() []byte {
|
|||
return nil
|
||||
}
|
||||
|
||||
type VolumeSyncIndexRequest struct {
|
||||
VolumeId uint32 `protobuf:"varint,1,opt,name=volume_id,json=volumeId" json:"volume_id,omitempty"`
|
||||
}
|
||||
|
||||
func (m *VolumeSyncIndexRequest) Reset() { *m = VolumeSyncIndexRequest{} }
|
||||
func (m *VolumeSyncIndexRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*VolumeSyncIndexRequest) ProtoMessage() {}
|
||||
func (*VolumeSyncIndexRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{20} }
|
||||
|
||||
func (m *VolumeSyncIndexRequest) GetVolumeId() uint32 {
|
||||
if m != nil {
|
||||
return m.VolumeId
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
type VolumeSyncIndexResponse struct {
|
||||
IndexFileContent []byte `protobuf:"bytes,1,opt,name=index_file_content,json=indexFileContent,proto3" json:"index_file_content,omitempty"`
|
||||
}
|
||||
|
||||
func (m *VolumeSyncIndexResponse) Reset() { *m = VolumeSyncIndexResponse{} }
|
||||
func (m *VolumeSyncIndexResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*VolumeSyncIndexResponse) ProtoMessage() {}
|
||||
func (*VolumeSyncIndexResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{21} }
|
||||
|
||||
func (m *VolumeSyncIndexResponse) GetIndexFileContent() []byte {
|
||||
if m != nil {
|
||||
return m.IndexFileContent
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type VolumeSyncDataRequest struct {
|
||||
VolumeId uint32 `protobuf:"varint,1,opt,name=volume_id,json=volumeId" json:"volume_id,omitempty"`
|
||||
Revision uint32 `protobuf:"varint,2,opt,name=revision" json:"revision,omitempty"`
|
||||
Offset uint32 `protobuf:"varint,3,opt,name=offset" json:"offset,omitempty"`
|
||||
Size uint32 `protobuf:"varint,4,opt,name=size" json:"size,omitempty"`
|
||||
NeedleId string `protobuf:"bytes,5,opt,name=needle_id,json=needleId" json:"needle_id,omitempty"`
|
||||
}
|
||||
|
||||
func (m *VolumeSyncDataRequest) Reset() { *m = VolumeSyncDataRequest{} }
|
||||
func (m *VolumeSyncDataRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*VolumeSyncDataRequest) ProtoMessage() {}
|
||||
func (*VolumeSyncDataRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{22} }
|
||||
|
||||
func (m *VolumeSyncDataRequest) GetVolumeId() uint32 {
|
||||
if m != nil {
|
||||
return m.VolumeId
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *VolumeSyncDataRequest) GetRevision() uint32 {
|
||||
if m != nil {
|
||||
return m.Revision
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *VolumeSyncDataRequest) GetOffset() uint32 {
|
||||
if m != nil {
|
||||
return m.Offset
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *VolumeSyncDataRequest) GetSize() uint32 {
|
||||
if m != nil {
|
||||
return m.Size
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *VolumeSyncDataRequest) GetNeedleId() string {
|
||||
if m != nil {
|
||||
return m.NeedleId
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type VolumeSyncDataResponse struct {
|
||||
FileContent []byte `protobuf:"bytes,1,opt,name=file_content,json=fileContent,proto3" json:"file_content,omitempty"`
|
||||
}
|
||||
|
||||
func (m *VolumeSyncDataResponse) Reset() { *m = VolumeSyncDataResponse{} }
|
||||
func (m *VolumeSyncDataResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*VolumeSyncDataResponse) ProtoMessage() {}
|
||||
func (*VolumeSyncDataResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{23} }
|
||||
|
||||
func (m *VolumeSyncDataResponse) GetFileContent() []byte {
|
||||
if m != nil {
|
||||
return m.FileContent
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type VolumeMountRequest struct {
|
||||
VolumeId uint32 `protobuf:"varint,1,opt,name=volume_id,json=volumeId" json:"volume_id,omitempty"`
|
||||
}
|
||||
|
@ -565,7 +465,7 @@ type VolumeMountRequest struct {
|
|||
func (m *VolumeMountRequest) Reset() { *m = VolumeMountRequest{} }
|
||||
func (m *VolumeMountRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*VolumeMountRequest) ProtoMessage() {}
|
||||
func (*VolumeMountRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{24} }
|
||||
func (*VolumeMountRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{20} }
|
||||
|
||||
func (m *VolumeMountRequest) GetVolumeId() uint32 {
|
||||
if m != nil {
|
||||
|
@ -580,7 +480,7 @@ type VolumeMountResponse struct {
|
|||
func (m *VolumeMountResponse) Reset() { *m = VolumeMountResponse{} }
|
||||
func (m *VolumeMountResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*VolumeMountResponse) ProtoMessage() {}
|
||||
func (*VolumeMountResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{25} }
|
||||
func (*VolumeMountResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{21} }
|
||||
|
||||
type VolumeUnmountRequest struct {
|
||||
VolumeId uint32 `protobuf:"varint,1,opt,name=volume_id,json=volumeId" json:"volume_id,omitempty"`
|
||||
|
@ -589,7 +489,7 @@ type VolumeUnmountRequest struct {
|
|||
func (m *VolumeUnmountRequest) Reset() { *m = VolumeUnmountRequest{} }
|
||||
func (m *VolumeUnmountRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*VolumeUnmountRequest) ProtoMessage() {}
|
||||
func (*VolumeUnmountRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{26} }
|
||||
func (*VolumeUnmountRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{22} }
|
||||
|
||||
func (m *VolumeUnmountRequest) GetVolumeId() uint32 {
|
||||
if m != nil {
|
||||
|
@ -604,7 +504,7 @@ type VolumeUnmountResponse struct {
|
|||
func (m *VolumeUnmountResponse) Reset() { *m = VolumeUnmountResponse{} }
|
||||
func (m *VolumeUnmountResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*VolumeUnmountResponse) ProtoMessage() {}
|
||||
func (*VolumeUnmountResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{27} }
|
||||
func (*VolumeUnmountResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{23} }
|
||||
|
||||
type VolumeDeleteRequest struct {
|
||||
VolumeId uint32 `protobuf:"varint,1,opt,name=volume_id,json=volumeId" json:"volume_id,omitempty"`
|
||||
|
@ -613,7 +513,7 @@ type VolumeDeleteRequest struct {
|
|||
func (m *VolumeDeleteRequest) Reset() { *m = VolumeDeleteRequest{} }
|
||||
func (m *VolumeDeleteRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*VolumeDeleteRequest) ProtoMessage() {}
|
||||
func (*VolumeDeleteRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{28} }
|
||||
func (*VolumeDeleteRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{24} }
|
||||
|
||||
func (m *VolumeDeleteRequest) GetVolumeId() uint32 {
|
||||
if m != nil {
|
||||
|
@ -628,7 +528,7 @@ type VolumeDeleteResponse struct {
|
|||
func (m *VolumeDeleteResponse) Reset() { *m = VolumeDeleteResponse{} }
|
||||
func (m *VolumeDeleteResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*VolumeDeleteResponse) ProtoMessage() {}
|
||||
func (*VolumeDeleteResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{29} }
|
||||
func (*VolumeDeleteResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{25} }
|
||||
|
||||
type ReplicateVolumeRequest struct {
|
||||
VolumeId uint32 `protobuf:"varint,1,opt,name=volume_id,json=volumeId" json:"volume_id,omitempty"`
|
||||
|
@ -641,7 +541,7 @@ type ReplicateVolumeRequest struct {
|
|||
func (m *ReplicateVolumeRequest) Reset() { *m = ReplicateVolumeRequest{} }
|
||||
func (m *ReplicateVolumeRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*ReplicateVolumeRequest) ProtoMessage() {}
|
||||
func (*ReplicateVolumeRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{30} }
|
||||
func (*ReplicateVolumeRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{26} }
|
||||
|
||||
func (m *ReplicateVolumeRequest) GetVolumeId() uint32 {
|
||||
if m != nil {
|
||||
|
@ -684,7 +584,7 @@ type ReplicateVolumeResponse struct {
|
|||
func (m *ReplicateVolumeResponse) Reset() { *m = ReplicateVolumeResponse{} }
|
||||
func (m *ReplicateVolumeResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*ReplicateVolumeResponse) ProtoMessage() {}
|
||||
func (*ReplicateVolumeResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{31} }
|
||||
func (*ReplicateVolumeResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{27} }
|
||||
|
||||
type CopyFileRequest struct {
|
||||
VolumeId uint32 `protobuf:"varint,1,opt,name=volume_id,json=volumeId" json:"volume_id,omitempty"`
|
||||
|
@ -695,7 +595,7 @@ type CopyFileRequest struct {
|
|||
func (m *CopyFileRequest) Reset() { *m = CopyFileRequest{} }
|
||||
func (m *CopyFileRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*CopyFileRequest) ProtoMessage() {}
|
||||
func (*CopyFileRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{32} }
|
||||
func (*CopyFileRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{28} }
|
||||
|
||||
func (m *CopyFileRequest) GetVolumeId() uint32 {
|
||||
if m != nil {
|
||||
|
@ -725,7 +625,7 @@ type CopyFileResponse struct {
|
|||
func (m *CopyFileResponse) Reset() { *m = CopyFileResponse{} }
|
||||
func (m *CopyFileResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*CopyFileResponse) ProtoMessage() {}
|
||||
func (*CopyFileResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{33} }
|
||||
func (*CopyFileResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{29} }
|
||||
|
||||
func (m *CopyFileResponse) GetFileContent() []byte {
|
||||
if m != nil {
|
||||
|
@ -741,7 +641,7 @@ type ReadVolumeFileStatusRequest struct {
|
|||
func (m *ReadVolumeFileStatusRequest) Reset() { *m = ReadVolumeFileStatusRequest{} }
|
||||
func (m *ReadVolumeFileStatusRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*ReadVolumeFileStatusRequest) ProtoMessage() {}
|
||||
func (*ReadVolumeFileStatusRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{34} }
|
||||
func (*ReadVolumeFileStatusRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{30} }
|
||||
|
||||
func (m *ReadVolumeFileStatusRequest) GetVolumeId() uint32 {
|
||||
if m != nil {
|
||||
|
@ -761,7 +661,7 @@ type ReadVolumeFileStatusResponse struct {
|
|||
func (m *ReadVolumeFileStatusResponse) Reset() { *m = ReadVolumeFileStatusResponse{} }
|
||||
func (m *ReadVolumeFileStatusResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*ReadVolumeFileStatusResponse) ProtoMessage() {}
|
||||
func (*ReadVolumeFileStatusResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{35} }
|
||||
func (*ReadVolumeFileStatusResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{31} }
|
||||
|
||||
func (m *ReadVolumeFileStatusResponse) GetVolumeId() uint32 {
|
||||
if m != nil {
|
||||
|
@ -808,7 +708,7 @@ type DiskStatus struct {
|
|||
func (m *DiskStatus) Reset() { *m = DiskStatus{} }
|
||||
func (m *DiskStatus) String() string { return proto.CompactTextString(m) }
|
||||
func (*DiskStatus) ProtoMessage() {}
|
||||
func (*DiskStatus) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{36} }
|
||||
func (*DiskStatus) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{32} }
|
||||
|
||||
func (m *DiskStatus) GetDir() string {
|
||||
if m != nil {
|
||||
|
@ -851,7 +751,7 @@ type MemStatus struct {
|
|||
func (m *MemStatus) Reset() { *m = MemStatus{} }
|
||||
func (m *MemStatus) String() string { return proto.CompactTextString(m) }
|
||||
func (*MemStatus) ProtoMessage() {}
|
||||
func (*MemStatus) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{37} }
|
||||
func (*MemStatus) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{33} }
|
||||
|
||||
func (m *MemStatus) GetGoroutines() int32 {
|
||||
if m != nil {
|
||||
|
@ -923,10 +823,6 @@ func init() {
|
|||
proto.RegisterType((*VolumeSyncStatusResponse)(nil), "volume_server_pb.VolumeSyncStatusResponse")
|
||||
proto.RegisterType((*VolumeFollowRequest)(nil), "volume_server_pb.VolumeFollowRequest")
|
||||
proto.RegisterType((*VolumeFollowResponse)(nil), "volume_server_pb.VolumeFollowResponse")
|
||||
proto.RegisterType((*VolumeSyncIndexRequest)(nil), "volume_server_pb.VolumeSyncIndexRequest")
|
||||
proto.RegisterType((*VolumeSyncIndexResponse)(nil), "volume_server_pb.VolumeSyncIndexResponse")
|
||||
proto.RegisterType((*VolumeSyncDataRequest)(nil), "volume_server_pb.VolumeSyncDataRequest")
|
||||
proto.RegisterType((*VolumeSyncDataResponse)(nil), "volume_server_pb.VolumeSyncDataResponse")
|
||||
proto.RegisterType((*VolumeMountRequest)(nil), "volume_server_pb.VolumeMountRequest")
|
||||
proto.RegisterType((*VolumeMountResponse)(nil), "volume_server_pb.VolumeMountResponse")
|
||||
proto.RegisterType((*VolumeUnmountRequest)(nil), "volume_server_pb.VolumeUnmountRequest")
|
||||
|
@ -964,8 +860,6 @@ type VolumeServerClient interface {
|
|||
AssignVolume(ctx context.Context, in *AssignVolumeRequest, opts ...grpc.CallOption) (*AssignVolumeResponse, error)
|
||||
VolumeSyncStatus(ctx context.Context, in *VolumeSyncStatusRequest, opts ...grpc.CallOption) (*VolumeSyncStatusResponse, error)
|
||||
VolumeFollow(ctx context.Context, in *VolumeFollowRequest, opts ...grpc.CallOption) (VolumeServer_VolumeFollowClient, error)
|
||||
VolumeSyncIndex(ctx context.Context, in *VolumeSyncIndexRequest, opts ...grpc.CallOption) (VolumeServer_VolumeSyncIndexClient, error)
|
||||
VolumeSyncData(ctx context.Context, in *VolumeSyncDataRequest, opts ...grpc.CallOption) (VolumeServer_VolumeSyncDataClient, error)
|
||||
VolumeMount(ctx context.Context, in *VolumeMountRequest, opts ...grpc.CallOption) (*VolumeMountResponse, error)
|
||||
VolumeUnmount(ctx context.Context, in *VolumeUnmountRequest, opts ...grpc.CallOption) (*VolumeUnmountResponse, error)
|
||||
VolumeDelete(ctx context.Context, in *VolumeDeleteRequest, opts ...grpc.CallOption) (*VolumeDeleteResponse, error)
|
||||
|
@ -1086,70 +980,6 @@ func (x *volumeServerVolumeFollowClient) Recv() (*VolumeFollowResponse, error) {
|
|||
return m, nil
|
||||
}
|
||||
|
||||
func (c *volumeServerClient) VolumeSyncIndex(ctx context.Context, in *VolumeSyncIndexRequest, opts ...grpc.CallOption) (VolumeServer_VolumeSyncIndexClient, error) {
|
||||
stream, err := grpc.NewClientStream(ctx, &_VolumeServer_serviceDesc.Streams[1], c.cc, "/volume_server_pb.VolumeServer/VolumeSyncIndex", opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
x := &volumeServerVolumeSyncIndexClient{stream}
|
||||
if err := x.ClientStream.SendMsg(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err := x.ClientStream.CloseSend(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return x, nil
|
||||
}
|
||||
|
||||
type VolumeServer_VolumeSyncIndexClient interface {
|
||||
Recv() (*VolumeSyncIndexResponse, error)
|
||||
grpc.ClientStream
|
||||
}
|
||||
|
||||
type volumeServerVolumeSyncIndexClient struct {
|
||||
grpc.ClientStream
|
||||
}
|
||||
|
||||
func (x *volumeServerVolumeSyncIndexClient) Recv() (*VolumeSyncIndexResponse, error) {
|
||||
m := new(VolumeSyncIndexResponse)
|
||||
if err := x.ClientStream.RecvMsg(m); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return m, nil
|
||||
}
|
||||
|
||||
func (c *volumeServerClient) VolumeSyncData(ctx context.Context, in *VolumeSyncDataRequest, opts ...grpc.CallOption) (VolumeServer_VolumeSyncDataClient, error) {
|
||||
stream, err := grpc.NewClientStream(ctx, &_VolumeServer_serviceDesc.Streams[2], c.cc, "/volume_server_pb.VolumeServer/VolumeSyncData", opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
x := &volumeServerVolumeSyncDataClient{stream}
|
||||
if err := x.ClientStream.SendMsg(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err := x.ClientStream.CloseSend(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return x, nil
|
||||
}
|
||||
|
||||
type VolumeServer_VolumeSyncDataClient interface {
|
||||
Recv() (*VolumeSyncDataResponse, error)
|
||||
grpc.ClientStream
|
||||
}
|
||||
|
||||
type volumeServerVolumeSyncDataClient struct {
|
||||
grpc.ClientStream
|
||||
}
|
||||
|
||||
func (x *volumeServerVolumeSyncDataClient) Recv() (*VolumeSyncDataResponse, error) {
|
||||
m := new(VolumeSyncDataResponse)
|
||||
if err := x.ClientStream.RecvMsg(m); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return m, nil
|
||||
}
|
||||
|
||||
func (c *volumeServerClient) VolumeMount(ctx context.Context, in *VolumeMountRequest, opts ...grpc.CallOption) (*VolumeMountResponse, error) {
|
||||
out := new(VolumeMountResponse)
|
||||
err := grpc.Invoke(ctx, "/volume_server_pb.VolumeServer/VolumeMount", in, out, c.cc, opts...)
|
||||
|
@ -1196,7 +1026,7 @@ func (c *volumeServerClient) ReadVolumeFileStatus(ctx context.Context, in *ReadV
|
|||
}
|
||||
|
||||
func (c *volumeServerClient) CopyFile(ctx context.Context, in *CopyFileRequest, opts ...grpc.CallOption) (VolumeServer_CopyFileClient, error) {
|
||||
stream, err := grpc.NewClientStream(ctx, &_VolumeServer_serviceDesc.Streams[3], c.cc, "/volume_server_pb.VolumeServer/CopyFile", opts...)
|
||||
stream, err := grpc.NewClientStream(ctx, &_VolumeServer_serviceDesc.Streams[1], c.cc, "/volume_server_pb.VolumeServer/CopyFile", opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -1240,8 +1070,6 @@ type VolumeServerServer interface {
|
|||
AssignVolume(context.Context, *AssignVolumeRequest) (*AssignVolumeResponse, error)
|
||||
VolumeSyncStatus(context.Context, *VolumeSyncStatusRequest) (*VolumeSyncStatusResponse, error)
|
||||
VolumeFollow(*VolumeFollowRequest, VolumeServer_VolumeFollowServer) error
|
||||
VolumeSyncIndex(*VolumeSyncIndexRequest, VolumeServer_VolumeSyncIndexServer) error
|
||||
VolumeSyncData(*VolumeSyncDataRequest, VolumeServer_VolumeSyncDataServer) error
|
||||
VolumeMount(context.Context, *VolumeMountRequest) (*VolumeMountResponse, error)
|
||||
VolumeUnmount(context.Context, *VolumeUnmountRequest) (*VolumeUnmountResponse, error)
|
||||
VolumeDelete(context.Context, *VolumeDeleteRequest) (*VolumeDeleteResponse, error)
|
||||
|
@ -1419,48 +1247,6 @@ func (x *volumeServerVolumeFollowServer) Send(m *VolumeFollowResponse) error {
|
|||
return x.ServerStream.SendMsg(m)
|
||||
}
|
||||
|
||||
func _VolumeServer_VolumeSyncIndex_Handler(srv interface{}, stream grpc.ServerStream) error {
|
||||
m := new(VolumeSyncIndexRequest)
|
||||
if err := stream.RecvMsg(m); err != nil {
|
||||
return err
|
||||
}
|
||||
return srv.(VolumeServerServer).VolumeSyncIndex(m, &volumeServerVolumeSyncIndexServer{stream})
|
||||
}
|
||||
|
||||
type VolumeServer_VolumeSyncIndexServer interface {
|
||||
Send(*VolumeSyncIndexResponse) error
|
||||
grpc.ServerStream
|
||||
}
|
||||
|
||||
type volumeServerVolumeSyncIndexServer struct {
|
||||
grpc.ServerStream
|
||||
}
|
||||
|
||||
func (x *volumeServerVolumeSyncIndexServer) Send(m *VolumeSyncIndexResponse) error {
|
||||
return x.ServerStream.SendMsg(m)
|
||||
}
|
||||
|
||||
func _VolumeServer_VolumeSyncData_Handler(srv interface{}, stream grpc.ServerStream) error {
|
||||
m := new(VolumeSyncDataRequest)
|
||||
if err := stream.RecvMsg(m); err != nil {
|
||||
return err
|
||||
}
|
||||
return srv.(VolumeServerServer).VolumeSyncData(m, &volumeServerVolumeSyncDataServer{stream})
|
||||
}
|
||||
|
||||
type VolumeServer_VolumeSyncDataServer interface {
|
||||
Send(*VolumeSyncDataResponse) error
|
||||
grpc.ServerStream
|
||||
}
|
||||
|
||||
type volumeServerVolumeSyncDataServer struct {
|
||||
grpc.ServerStream
|
||||
}
|
||||
|
||||
func (x *volumeServerVolumeSyncDataServer) Send(m *VolumeSyncDataResponse) error {
|
||||
return x.ServerStream.SendMsg(m)
|
||||
}
|
||||
|
||||
func _VolumeServer_VolumeMount_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(VolumeMountRequest)
|
||||
if err := dec(in); err != nil {
|
||||
|
@ -1635,16 +1421,6 @@ var _VolumeServer_serviceDesc = grpc.ServiceDesc{
|
|||
Handler: _VolumeServer_VolumeFollow_Handler,
|
||||
ServerStreams: true,
|
||||
},
|
||||
{
|
||||
StreamName: "VolumeSyncIndex",
|
||||
Handler: _VolumeServer_VolumeSyncIndex_Handler,
|
||||
ServerStreams: true,
|
||||
},
|
||||
{
|
||||
StreamName: "VolumeSyncData",
|
||||
Handler: _VolumeServer_VolumeSyncData_Handler,
|
||||
ServerStreams: true,
|
||||
},
|
||||
{
|
||||
StreamName: "CopyFile",
|
||||
Handler: _VolumeServer_CopyFile_Handler,
|
||||
|
@ -1657,86 +1433,79 @@ var _VolumeServer_serviceDesc = grpc.ServiceDesc{
|
|||
func init() { proto.RegisterFile("volume_server.proto", fileDescriptor0) }
|
||||
|
||||
var fileDescriptor0 = []byte{
|
||||
// 1296 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xac, 0x58, 0x5f, 0x73, 0xdb, 0x44,
|
||||
0x10, 0x8f, 0x62, 0x3b, 0x71, 0xd6, 0x4e, 0x62, 0x2e, 0x69, 0xe2, 0x28, 0x25, 0xb8, 0x07, 0x6d,
|
||||
0x9d, 0x36, 0x0d, 0x90, 0x4e, 0xa1, 0x85, 0x17, 0x20, 0x21, 0x90, 0x87, 0xd2, 0x19, 0x85, 0x76,
|
||||
0x98, 0xa1, 0x33, 0x9a, 0x8b, 0x74, 0x49, 0x44, 0x64, 0x49, 0x95, 0x4e, 0x69, 0xc2, 0x57, 0xe0,
|
||||
0x13, 0xf0, 0xcc, 0x0b, 0xef, 0x7c, 0x20, 0x3e, 0x08, 0x2f, 0xcc, 0xfd, 0x91, 0xac, 0x7f, 0x8e,
|
||||
0xc5, 0x9f, 0xb7, 0xd3, 0xde, 0xee, 0x6f, 0x77, 0x6f, 0x6f, 0xf7, 0x7e, 0x36, 0xac, 0x5c, 0xfa,
|
||||
0x6e, 0x3c, 0xa2, 0x66, 0x44, 0xc3, 0x4b, 0x1a, 0xee, 0x06, 0xa1, 0xcf, 0x7c, 0xd4, 0xcb, 0x09,
|
||||
0xcd, 0xe0, 0x04, 0x7f, 0x08, 0xe8, 0x2b, 0xc2, 0xac, 0xf3, 0x03, 0xea, 0x52, 0x46, 0x0d, 0xfa,
|
||||
0x26, 0xa6, 0x11, 0x43, 0x1b, 0xd0, 0x3e, 0x75, 0x5c, 0x6a, 0x3a, 0x76, 0xd4, 0xd7, 0x06, 0x8d,
|
||||
0xe1, 0x82, 0x31, 0xcf, 0xbf, 0x8f, 0xec, 0x08, 0xbf, 0x80, 0x95, 0x9c, 0x41, 0x14, 0xf8, 0x5e,
|
||||
0x44, 0xd1, 0x53, 0x98,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 0x51, 0x9a, 0x82,
|
||||
0x1c, 0x31, 0x39, 0x9f, 0x0c, 0x62, 0x53, 0x22, 0xda, 0xf2, 0x9c, 0x72, 0x88, 0xa9, 0xb6, 0x40,
|
||||
0x6c, 0x49, 0x44, 0xa5, 0x28, 0xe6, 0xea, 0x0f, 0x00, 0x07, 0x4e, 0x74, 0x21, 0xd3, 0xe2, 0x37,
|
||||
0xc5, 0x76, 0x42, 0xf5, 0x26, 0xf3, 0x25, 0x97, 0x10, 0xd7, 0x55, 0x41, 0xf3, 0x25, 0x9f, 0x0c,
|
||||
0x71, 0x44, 0x6d, 0x15, 0x9e, 0x58, 0x73, 0xd9, 0x69, 0x48, 0xa9, 0x8a, 0x44, 0xac, 0xf1, 0x6f,
|
||||
0x1a, 0x2c, 0x3c, 0xa7, 0x23, 0x85, 0xbc, 0x05, 0x70, 0xe6, 0x87, 0x7e, 0xcc, 0x1c, 0x8f, 0x46,
|
||||
0xc2, 0x41, 0xcb, 0xc8, 0x48, 0xfe, 0xbd, 0x1f, 0x31, 0xa9, 0xa8, 0x7b, 0xaa, 0x92, 0x13, 0x6b,
|
||||
0x2e, 0x3b, 0xa7, 0x24, 0x50, 0xcf, 0x92, 0x58, 0x8b, 0xd7, 0x80, 0x11, 0xeb, 0x42, 0xbc, 0x42,
|
||||
0xfc, 0x35, 0xe0, 0x1f, 0x7b, 0xbf, 0x2c, 0x41, 0x57, 0xcd, 0x2d, 0x41, 0x77, 0xd1, 0x6b, 0xe8,
|
||||
0x64, 0x68, 0x32, 0xfa, 0xa0, 0xcc, 0x86, 0xcb, 0xb4, 0x5b, 0xbf, 0x3b, 0x45, 0x4b, 0x75, 0xcc,
|
||||
0x0c, 0xf2, 0xe0, 0x9d, 0x12, 0x0d, 0x45, 0x0f, 0xca, 0xd6, 0x93, 0x48, 0xae, 0xfe, 0xb0, 0x96,
|
||||
0x6e, 0xea, 0x8f, 0xc1, 0x4a, 0x05, 0xaf, 0x44, 0x3b, 0x53, 0x50, 0x72,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 0x7b, 0x9c, 0x25, 0x48, 0x93, 0x2b,
|
||||
0x9f, 0x9f, 0xb1, 0xf7, 0xa6, 0xa9, 0xa5, 0x0e, 0xce, 0x61, 0xb9, 0xc0, 0x59, 0xaa, 0xea, 0x5e,
|
||||
0xcd, 0xc5, 0xaa, 0xea, 0x3e, 0x89, 0x00, 0xcd, 0xa0, 0xb7, 0xb0, 0x5a, 0x45, 0x0f, 0xd0, 0xa3,
|
||||
0x2a, 0x90, 0x89, 0x1c, 0x44, 0xdf, 0xad, 0xab, 0x9e, 0x3a, 0x7e, 0x09, 0xed, 0x84, 0x0b, 0xa1,
|
||||
0x3b, 0x65, 0xeb, 0x02, 0x2f, 0xd3, 0xf1, 0x4d, 0x2a, 0xe3, 0xcb, 0x75, 0x32, 0x27, 0xfe, 0x6d,
|
||||
0x7a, 0xfc, 0x77, 0x00, 0x00, 0x00, 0xff, 0xff, 0x7d, 0xe2, 0xb6, 0x81, 0x84, 0x12, 0x00, 0x00,
|
||||
// 1169 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xac, 0x58, 0xdd, 0x6f, 0xdc, 0x44,
|
||||
0x10, 0x8f, 0x7b, 0x77, 0xf9, 0x98, 0xbb, 0xd0, 0x63, 0x93, 0x26, 0x57, 0xb7, 0x84, 0xeb, 0x42,
|
||||
0xcb, 0xa5, 0x4d, 0x03, 0xa4, 0x02, 0x5a, 0x9e, 0x80, 0x84, 0x8a, 0x3c, 0x94, 0x4a, 0x0e, 0xad,
|
||||
0x90, 0x40, 0xb2, 0x36, 0xf6, 0x26, 0xb1, 0xe2, 0xf3, 0xba, 0xde, 0x75, 0xda, 0xf0, 0xef, 0xf0,
|
||||
0xc2, 0x3b, 0x12, 0xff, 0x0e, 0x7f, 0x08, 0x2f, 0x68, 0x3f, 0xec, 0xf8, 0xeb, 0x7a, 0xe6, 0xe3,
|
||||
0x6d, 0x3d, 0x3b,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7f, 0x46, 0xbd, 0xf3, 0x2c, 0xf7, 0x5b, 0xb0, 0x62, 0x22, 0x37, 0x11, 0xac, 0x3a, 0xcb,
|
||||
0x5a, 0x70, 0xe8, 0xe3, 0xaf, 0xe0, 0x66, 0x83, 0xa1, 0x39, 0x83, 0x0f, 0x60, 0xf5, 0x94, 0x24,
|
||||
0xc7, 0xe4, 0x94, 0xba, 0x09, 0x11, 0x01, 0x53, 0xd6, 0x96, 0x33, 0x30, 0x42, 0x47, 0xca, 0xf0,
|
||||
0x4f, 0x60, 0x97, 0x10, 0xd8, 0x34, 0x26, 0x9e, 0x68, 0xe3, 0x1c, 0x8d, 0xa1, 0x1f, 0x27, 0x94,
|
||||
0x84, 0x21, 0xf3, 0x88, 0xa0, 0xea, 0x14, 0x3a, 0x4e, 0x51, 0x84, 0xdf, 0x83, 0x5b, 0x8d, 0xe0,
|
||||
0x3a, 0x40, 0xfc, 0xb8, 0x12, 0x3d, 0x9b, 0x4e, 0x83, 0x56, 0xae, 0xf1, 0xed, 0x5a, 0xd4, 0xca,
|
||||
0xd2, 0xe0, 0x3e, 0xa9, 0xec, 0x86, 0x94, 0x44, 0x69, 0xdc, 0x0a, 0xb8, 0x1a, 0x71, 0x66, 0x9a,
|
||||
0x23, 0x6f, 0xea, 0xe2, 0xd8, 0x67, 0x61, 0x48, 0x3d, 0x11, 0xb0, 0x28, 0x83, 0xdd, 0x02, 0xf0,
|
||||
0x72, 0xa1, 0x29, 0x95, 0x82, 0x04, 0xdb, 0x30, 0xaa, 0x9b, 0x1a, 0xd8, 0xdf, 0x2c, 0x58, 0xfb,
|
||||
0x9a, 0xf3, 0xe0, 0x34, 0xd2, 0x6e, 0x5b, 0x1d, 0x7f, 0xd9, 0xe1, 0xb5, 0xaa, 0xc3, 0xea, 0xf5,
|
||||
0x74, 0x6a, 0xd7, 0x23, 0x35, 0x12, 0x1a, 0x87, 0x81, 0x47, 0x14, 0x44, 0x57, 0x41, 0x14, 0x45,
|
||||
0x68, 0x08, 0x1d, 0x21, 0xc2, 0x51, 0x4f, 0xed, 0xc8, 0x25, 0xde, 0x80, 0xf5, 0x72, 0xa4, 0x26,
|
||||
0x85, 0xcf, 0x61, 0x53, 0x4b, 0x8e, 0x2e, 0x23, 0xef, 0x48, 0x75, 0x42, 0xab, 0x03, 0xff, 0xcb,
|
||||
0x82, 0x51, 0xdd, 0xd0, 0x54, 0xf0, 0x7f, 0xcd, 0xff, 0x9f, 0x66, 0x87, 0xde, 0x87, 0xbe, 0x20,
|
||||
0x41, 0xe8, 0xb2, 0x93, 0x13, 0x4e, 0xc5, 0x68, 0x71, 0x6c, 0x4d, 0xba, 0x0e, 0x48, 0xd1, 0x73,
|
||||
0x25, 0x41, 0xdb, 0x30, 0xf4, 0x74, 0x15, 0xbb, 0x09, 0xbd, 0x08, 0xb8, 0x44, 0x5e, 0x52, 0x81,
|
||||
0x5d, 0xf7, 0xb2, 0xea, 0xd6, 0x62, 0x84, 0x61, 0x35, 0xf0, 0xdf, 0xb8, 0x6a, 0x78, 0xa8, 0xd6,
|
||||
0x5f, 0x56, 0x68, 0xfd, 0xc0, 0x7f, 0xf3, 0x34, 0x08, 0xe9, 0x91, 0x9c, 0x00, 0xdf, 0xc1, 0x9a,
|
||||
0x4e, 0xfe, 0x29, 0x0b, 0x43, 0xf6, 0xba, 0xd5, 0xbd, 0xaf, 0x43, 0x8f, 0x07, 0x91, 0xa7, 0x1b,
|
||||
0xae, 0xeb, 0xe8, 0x0f, 0xfc, 0x04, 0xd6, 0xcb, 0x48, 0xe6, 0x08, 0xef, 0xc0, 0x40, 0x45, 0xe0,
|
||||
0xb1, 0x48, 0xd0, 0x48, 0x28, 0xb4, 0x81, 0xd3, 0x97, 0xb2, 0x7d, 0x2d, 0xc2, 0x9f, 0x02, 0xd2,
|
||||
0xa6, 0xcf, 0x58, 0x1a, 0xb5, 0xeb, 0xbf, 0x1b, 0x59, 0xdc, 0xc6, 0xc4, 0x14, 0xc1, 0xa3, 0x2c,
|
||||
0x88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
|
||||
0x3e, 0xa7, 0x12, 0x62, 0xae, 0xad, 0x10, 0x7b, 0x1a, 0xd1, 0x28, 0xaa, 0xf6, 0xff, 0x11, 0xe0,
|
||||
0x20, 0xe0, 0xe7, 0x3a, 0x2d, 0x59, 0x29, 0x7e, 0x90, 0x98, 0xa7, 0x43, 0x2e, 0xa5, 0x84, 0x84,
|
||||
0xa1, 0x09, 0x5a, 0x2e, 0x25, 0x8d, 0x48, 0x39, 0xf5, 0x4d, 0x78, 0x6a, 0x2d, 0x65, 0x27, 0x09,
|
||||
0xa5, 0x26, 0x12, 0xb5, 0xc6, 0xbf, 0x5a, 0xb0, 0xf2, 0x8c, 0x4e, 0x0d, 0xf2, 0x16, 0xc0, 0x29,
|
||||
0x4b, 0x58, 0x2a, 0x82, 0x88, 0x72, 0xe5, 0xa0, 0xe7, 0x14, 0x24, 0xff, 0xde, 0x8f, 0xa2, 0x35,
|
||||
0x34, 0x3c, 0x31, 0xc9, 0xa9, 0xb5, 0x94, 0x9d, 0x51, 0x12, 0x9b, 0xe9, 0xa9, 0xd6, 0x6a, 0x68,
|
||||
0x09, 0xe2, 0x9d, 0xab, 0x61, 0x29, 0x87, 0x96, 0xfc, 0xd8, 0xfb, 0x63, 0x00, 0x03, 0x33, 0xfc,
|
||||
0x15, 0x2b, 0x43, 0x3f, 0x43, 0xbf, 0xc0, 0xe6, 0xd0, 0x87, 0x75, 0xd2, 0x56, 0x67, 0x87, 0xf6,
|
||||
0xdd, 0x39, 0x5a, 0xa6, 0x63, 0x16, 0x50, 0x04, 0xef, 0xd6, 0xd8, 0x12, 0xba, 0x5f, 0xb7, 0x9e,
|
||||
0xc5, 0xc5, 0xec, 0x07, 0xad, 0x74, 0x73, 0x7f, 0x02, 0xd6, 0x1a, 0xe8, 0x0f, 0xda, 0x99, 0x83,
|
||||
0x52, 0xa2, 0x60, 0xf6, 0xc3, 0x96, 0xda, 0xb9, 0xd7, 0x57, 0x80, 0xea, 0xdc, 0x08, 0x3d, 0x98,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 0x33, 0xda,
|
||||
0x80, 0xee, 0xd4, 0xad, 0x2b, 0x14, 0xc6, 0xc6, 0x6f, 0x53, 0xb9, 0x2a, 0xae, 0xe3, 0x45, 0xf5,
|
||||
0xff, 0xe0, 0xd1, 0xdf, 0x01, 0x00, 0x00, 0xff, 0xff, 0x13, 0x86, 0xf1, 0x0f, 0x56, 0x10, 0x00,
|
||||
0x00,
|
||||
}
|
||||
|
|
|
@ -7,7 +7,6 @@ import (
|
|||
"github.com/chrislusf/seaweedfs/weed/glog"
|
||||
"github.com/chrislusf/seaweedfs/weed/pb/volume_server_pb"
|
||||
"github.com/chrislusf/seaweedfs/weed/storage"
|
||||
"github.com/chrislusf/seaweedfs/weed/storage/types"
|
||||
)
|
||||
|
||||
func (vs *VolumeServer) VolumeSyncStatus(ctx context.Context, req *volume_server_pb.VolumeSyncStatusRequest) (*volume_server_pb.VolumeSyncStatusResponse, error) {
|
||||
|
@ -24,78 +23,3 @@ func (vs *VolumeServer) VolumeSyncStatus(ctx context.Context, req *volume_server
|
|||
return resp, nil
|
||||
|
||||
}
|
||||
|
||||
func (vs *VolumeServer) VolumeSyncIndex(req *volume_server_pb.VolumeSyncIndexRequest, stream volume_server_pb.VolumeServer_VolumeSyncIndexServer) error {
|
||||
|
||||
v := vs.store.GetVolume(storage.VolumeId(req.VolumeId))
|
||||
if v == nil {
|
||||
return fmt.Errorf("not found volume id %d", req.VolumeId)
|
||||
}
|
||||
|
||||
content, err := v.IndexFileContent()
|
||||
|
||||
if err != nil {
|
||||
glog.Errorf("sync volume %d index: %v", req.VolumeId, err)
|
||||
} else {
|
||||
glog.V(2).Infof("sync volume %d index", req.VolumeId)
|
||||
}
|
||||
|
||||
const blockSizeLimit = 1024 * 1024 * 2
|
||||
for i := 0; i < len(content); i += blockSizeLimit {
|
||||
blockSize := len(content) - i
|
||||
if blockSize > blockSizeLimit {
|
||||
blockSize = blockSizeLimit
|
||||
}
|
||||
resp := &volume_server_pb.VolumeSyncIndexResponse{}
|
||||
resp.IndexFileContent = content[i : i+blockSize]
|
||||
stream.Send(resp)
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
}
|
||||
|
||||
func (vs *VolumeServer) VolumeSyncData(req *volume_server_pb.VolumeSyncDataRequest, stream volume_server_pb.VolumeServer_VolumeSyncDataServer) error {
|
||||
|
||||
v := vs.store.GetVolume(storage.VolumeId(req.VolumeId))
|
||||
if v == nil {
|
||||
return fmt.Errorf("not found volume id %d", req.VolumeId)
|
||||
}
|
||||
|
||||
if uint32(v.SuperBlock.CompactRevision) != req.Revision {
|
||||
return fmt.Errorf("requested volume revision is %d, but current revision is %d", req.Revision, v.SuperBlock.CompactRevision)
|
||||
}
|
||||
|
||||
content, err := storage.ReadNeedleBlob(v.DataFile(), int64(req.Offset)*types.NeedlePaddingSize, req.Size, v.Version())
|
||||
if err != nil {
|
||||
return fmt.Errorf("read offset:%d size:%d", req.Offset, req.Size)
|
||||
}
|
||||
|
||||
id, err := types.ParseNeedleId(req.NeedleId)
|
||||
if err != nil {
|
||||
return fmt.Errorf("parsing needle id %s: %v", req.NeedleId, err)
|
||||
}
|
||||
n := new(storage.Needle)
|
||||
n.ParseNeedleHeader(content)
|
||||
if id != n.Id {
|
||||
return fmt.Errorf("expected file entry id %d, but found %d", id, n.Id)
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
glog.Errorf("sync volume %d data: %v", req.VolumeId, err)
|
||||
}
|
||||
|
||||
const blockSizeLimit = 1024 * 1024 * 2
|
||||
for i := 0; i < len(content); i += blockSizeLimit {
|
||||
blockSize := len(content) - i
|
||||
if blockSize > blockSizeLimit {
|
||||
blockSize = blockSizeLimit
|
||||
}
|
||||
resp := &volume_server_pb.VolumeSyncDataResponse{}
|
||||
resp.FileContent = content[i : i+blockSize]
|
||||
stream.Send(resp)
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
}
|
||||
|
|
|
@ -1,160 +1,9 @@
|
|||
package storage
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"google.golang.org/grpc"
|
||||
"io"
|
||||
"os"
|
||||
"sort"
|
||||
|
||||
"github.com/chrislusf/seaweedfs/weed/glog"
|
||||
"github.com/chrislusf/seaweedfs/weed/operation"
|
||||
"github.com/chrislusf/seaweedfs/weed/pb/volume_server_pb"
|
||||
"github.com/chrislusf/seaweedfs/weed/storage/needle"
|
||||
. "github.com/chrislusf/seaweedfs/weed/storage/types"
|
||||
)
|
||||
|
||||
// The volume sync with a master volume via 2 steps:
|
||||
// 1. The slave checks master side to find subscription checkpoint
|
||||
// to setup the replication.
|
||||
// 2. The slave receives the updates from master
|
||||
|
||||
/*
|
||||
Assume the slave volume needs to follow the master volume.
|
||||
|
||||
The master volume could be compacted, and could be many files ahead of
|
||||
slave volume.
|
||||
|
||||
Step 0:
|
||||
If slave compact version is less than the master, do a local compaction.
|
||||
If the slave size is still less than the master, discard local copy and do a full copy.
|
||||
|
||||
Step 1:
|
||||
The slave volume ask the master by the last modification time t.
|
||||
The master do a binary search in volume (use .idx as an array, and check the appendAtNs in .dat file),
|
||||
to find the first entry with appendAtNs > t.
|
||||
|
||||
Step 2:
|
||||
The master iterate following entries (including the first one) and send it to the follower.
|
||||
|
||||
*/
|
||||
|
||||
func (v *Volume) Synchronize(volumeServer string, grpcDialOption grpc.DialOption) (err error) {
|
||||
var lastCompactRevision uint16 = 0
|
||||
var compactRevision uint16 = 0
|
||||
var masterMap *needle.CompactMap
|
||||
for i := 0; i < 3; i++ {
|
||||
if masterMap, _, compactRevision, err = fetchVolumeFileEntries(volumeServer, grpcDialOption, v.Id); err != nil {
|
||||
return fmt.Errorf("Failed to sync volume %d entries with %s: %v", v.Id, volumeServer, err)
|
||||
}
|
||||
if lastCompactRevision != compactRevision && lastCompactRevision != 0 {
|
||||
if err = v.Compact(0); err != nil {
|
||||
return fmt.Errorf("Compact Volume before synchronizing %v", err)
|
||||
}
|
||||
if err = v.CommitCompact(); err != nil {
|
||||
return fmt.Errorf("Commit Compact before synchronizing %v", err)
|
||||
}
|
||||
}
|
||||
lastCompactRevision = compactRevision
|
||||
if err = v.trySynchronizing(volumeServer, grpcDialOption, masterMap, compactRevision); err == nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
type ByOffset []needle.NeedleValue
|
||||
|
||||
func (a ByOffset) Len() int { return len(a) }
|
||||
func (a ByOffset) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
|
||||
func (a ByOffset) Less(i, j int) bool { return a[i].Offset < a[j].Offset }
|
||||
|
||||
// trySynchronizing sync with remote volume server incrementally by
|
||||
// make up the local and remote delta.
|
||||
func (v *Volume) trySynchronizing(volumeServer string, grpcDialOption grpc.DialOption, masterMap *needle.CompactMap, compactRevision uint16) error {
|
||||
slaveIdxFile, err := os.Open(v.nm.IndexFileName())
|
||||
if err != nil {
|
||||
return fmt.Errorf("Open volume %d index file: %v", v.Id, err)
|
||||
}
|
||||
defer slaveIdxFile.Close()
|
||||
slaveMap, err := LoadBtreeNeedleMap(slaveIdxFile)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Load volume %d index file: %v", v.Id, err)
|
||||
}
|
||||
var delta []needle.NeedleValue
|
||||
if err := masterMap.Visit(func(needleValue needle.NeedleValue) error {
|
||||
if needleValue.Key == NeedleIdEmpty {
|
||||
return nil
|
||||
}
|
||||
if _, ok := slaveMap.Get(needleValue.Key); ok {
|
||||
return nil // skip intersection
|
||||
}
|
||||
delta = append(delta, needleValue)
|
||||
return nil
|
||||
}); err != nil {
|
||||
return fmt.Errorf("Add master entry: %v", err)
|
||||
}
|
||||
if err := slaveMap.m.Visit(func(needleValue needle.NeedleValue) error {
|
||||
if needleValue.Key == NeedleIdEmpty {
|
||||
return nil
|
||||
}
|
||||
if _, ok := masterMap.Get(needleValue.Key); ok {
|
||||
return nil // skip intersection
|
||||
}
|
||||
needleValue.Size = 0
|
||||
delta = append(delta, needleValue)
|
||||
return nil
|
||||
}); err != nil {
|
||||
return fmt.Errorf("Remove local entry: %v", err)
|
||||
}
|
||||
|
||||
// simulate to same ordering of remote .dat file needle entries
|
||||
sort.Sort(ByOffset(delta))
|
||||
|
||||
// make up the delta
|
||||
fetchCount := 0
|
||||
for _, needleValue := range delta {
|
||||
if needleValue.Size == 0 {
|
||||
// remove file entry from local
|
||||
v.removeNeedle(needleValue.Key)
|
||||
continue
|
||||
}
|
||||
// add master file entry to local data file
|
||||
if err := v.fetchNeedle(volumeServer, grpcDialOption, needleValue, compactRevision); err != nil {
|
||||
glog.V(0).Infof("Fetch needle %v from %s: %v", needleValue, volumeServer, err)
|
||||
return err
|
||||
}
|
||||
fetchCount++
|
||||
}
|
||||
glog.V(1).Infof("Fetched %d needles from %s", fetchCount, volumeServer)
|
||||
return nil
|
||||
}
|
||||
|
||||
func fetchVolumeFileEntries(volumeServer string, grpcDialOption grpc.DialOption, vid VolumeId) (m *needle.CompactMap, lastOffset uint64, compactRevision uint16, err error) {
|
||||
m = needle.NewCompactMap()
|
||||
|
||||
syncStatus, err := operation.GetVolumeSyncStatus(volumeServer, grpcDialOption, uint32(vid))
|
||||
if err != nil {
|
||||
return m, 0, 0, err
|
||||
}
|
||||
|
||||
total := 0
|
||||
err = operation.GetVolumeIdxEntries(volumeServer, grpcDialOption, uint32(vid), func(key NeedleId, offset Offset, size uint32) {
|
||||
// println("remote key", key, "offset", offset*NeedlePaddingSize, "size", size)
|
||||
if offset > 0 && size != TombstoneFileSize {
|
||||
m.Set(NeedleId(key), offset, size)
|
||||
} else {
|
||||
m.Delete(NeedleId(key))
|
||||
}
|
||||
total++
|
||||
})
|
||||
|
||||
glog.V(2).Infof("server %s volume %d, entries %d, last offset %d, revision %d", volumeServer, vid, total, syncStatus.TailOffset, syncStatus.CompactRevision)
|
||||
return m, syncStatus.TailOffset, uint16(syncStatus.CompactRevision), err
|
||||
|
||||
}
|
||||
|
||||
func (v *Volume) GetVolumeSyncStatus() *volume_server_pb.VolumeSyncStatusResponse {
|
||||
var syncStatus = &volume_server_pb.VolumeSyncStatusResponse{}
|
||||
if stat, err := v.dataFile.Stat(); err == nil {
|
||||
|
@ -167,53 +16,3 @@ func (v *Volume) GetVolumeSyncStatus() *volume_server_pb.VolumeSyncStatusRespons
|
|||
syncStatus.Replication = v.SuperBlock.ReplicaPlacement.String()
|
||||
return syncStatus
|
||||
}
|
||||
|
||||
func (v *Volume) IndexFileContent() ([]byte, error) {
|
||||
return v.nm.IndexFileContent()
|
||||
}
|
||||
|
||||
// removeNeedle removes one needle by needle key
|
||||
func (v *Volume) removeNeedle(key NeedleId) {
|
||||
n := new(Needle)
|
||||
n.Id = key
|
||||
v.deleteNeedle(n)
|
||||
}
|
||||
|
||||
// fetchNeedle fetches a remote volume needle by vid, id, offset
|
||||
// The compact revision is checked first in case the remote volume
|
||||
// is compacted and the offset is invalid any more.
|
||||
func (v *Volume) fetchNeedle(volumeServer string, grpcDialOption grpc.DialOption, needleValue needle.NeedleValue, compactRevision uint16) error {
|
||||
|
||||
return operation.WithVolumeServerClient(volumeServer, grpcDialOption, func(client volume_server_pb.VolumeServerClient) error {
|
||||
stream, err := client.VolumeSyncData(context.Background(), &volume_server_pb.VolumeSyncDataRequest{
|
||||
VolumeId: uint32(v.Id),
|
||||
Revision: uint32(compactRevision),
|
||||
Offset: uint32(needleValue.Offset),
|
||||
Size: uint32(needleValue.Size),
|
||||
NeedleId: needleValue.Key.String(),
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
var fileContent []byte
|
||||
for {
|
||||
resp, err := stream.Recv()
|
||||
if err == io.EOF {
|
||||
break
|
||||
}
|
||||
if err != nil {
|
||||
return fmt.Errorf("read needle %v: %v", needleValue.Key.String(), err)
|
||||
}
|
||||
fileContent = append(fileContent, resp.FileContent...)
|
||||
}
|
||||
|
||||
offset, err := v.AppendBlob(fileContent)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Appending volume %d error: %v", v.Id, err)
|
||||
}
|
||||
// println("add key", needleValue.Key, "offset", offset, "size", needleValue.Size)
|
||||
v.nm.Put(needleValue.Key, Offset(offset/NeedlePaddingSize), needleValue.Size)
|
||||
return nil
|
||||
})
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue