You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
820 B
26 lines
820 B
package remote_storage
|
|
|
|
import (
|
|
"fmt"
|
|
"github.com/chrislusf/seaweedfs/weed/filer"
|
|
"github.com/chrislusf/seaweedfs/weed/pb"
|
|
"github.com/chrislusf/seaweedfs/weed/pb/filer_pb"
|
|
"google.golang.org/grpc"
|
|
)
|
|
|
|
func ReadMountMappings(grpcDialOption grpc.DialOption, filerAddress string) (mappings *filer_pb.RemoteStorageMapping, readErr error) {
|
|
var oldContent []byte
|
|
if readErr = pb.WithFilerClient(filerAddress, grpcDialOption, func(client filer_pb.SeaweedFilerClient) error {
|
|
oldContent, readErr = filer.ReadInsideFiler(client, filer.DirectoryEtcRemote, filer.REMOTE_STORAGE_MOUNT_FILE)
|
|
return readErr
|
|
}); readErr != nil {
|
|
return nil, readErr
|
|
}
|
|
|
|
mappings, readErr = filer.UnmarshalRemoteStorageMappings(oldContent)
|
|
if readErr != nil {
|
|
return nil, fmt.Errorf("unmarshal mappings: %v", readErr)
|
|
}
|
|
|
|
return
|
|
}
|