weed mount add ttl option

This commit is contained in:
Chris Lu 2018-06-11 23:13:33 -07:00
parent 98110c1697
commit 5bd72696ac
8 changed files with 94 additions and 68 deletions

View File

@ -6,6 +6,7 @@ type MountOptions struct {
dir *string dir *string
collection *string collection *string
replication *string replication *string
ttlSec *int
chunkSizeLimitMB *int chunkSizeLimitMB *int
} }
@ -20,6 +21,7 @@ func init() {
mountOptions.dir = cmdMount.Flag.String("dir", ".", "mount weed filer to this directory") mountOptions.dir = cmdMount.Flag.String("dir", ".", "mount weed filer to this directory")
mountOptions.collection = cmdMount.Flag.String("collection", "", "collection to create the files") mountOptions.collection = cmdMount.Flag.String("collection", "", "collection to create the files")
mountOptions.replication = cmdMount.Flag.String("replication", "000", "replication to create to files") mountOptions.replication = cmdMount.Flag.String("replication", "000", "replication to create to files")
mountOptions.ttlSec = cmdMount.Flag.Int("ttl", 0, "file ttl in seconds")
mountOptions.chunkSizeLimitMB = cmdMount.Flag.Int("chunkSizeLimitMB", 16, "local write buffer size, also chunk large files") mountOptions.chunkSizeLimitMB = cmdMount.Flag.Int("chunkSizeLimitMB", 16, "local write buffer size, also chunk large files")
} }

View File

@ -73,7 +73,8 @@ func runMount(cmd *Command, args []string) bool {
filerAddress := fmt.Sprintf("%s:%d", hostnameAndPort[0], filerGrpcPort) filerAddress := fmt.Sprintf("%s:%d", hostnameAndPort[0], filerGrpcPort)
err = fs.Serve(c, filesys.NewSeaweedFileSystem( err = fs.Serve(c, filesys.NewSeaweedFileSystem(
filerAddress, *mountOptions.collection, *mountOptions.replication, *mountOptions.chunkSizeLimitMB)) filerAddress, *mountOptions.collection, *mountOptions.replication, int32(*mountOptions.ttlSec),
*mountOptions.chunkSizeLimitMB))
if err != nil { if err != nil {
fuse.Unmount(*mountOptions.dir) fuse.Unmount(*mountOptions.dir)
} }

View File

@ -10,6 +10,7 @@ import (
"github.com/chrislusf/seaweedfs/weed/pb/filer_pb" "github.com/chrislusf/seaweedfs/weed/pb/filer_pb"
"path/filepath" "path/filepath"
"time" "time"
"github.com/chrislusf/seaweedfs/weed/filer2"
) )
type Dir struct { type Dir struct {
@ -110,11 +111,14 @@ func (dir *Dir) Create(ctx context.Context, req *fuse.CreateRequest,
Name: req.Name, Name: req.Name,
IsDirectory: req.Mode&os.ModeDir > 0, IsDirectory: req.Mode&os.ModeDir > 0,
Attributes: &filer_pb.FuseAttributes{ Attributes: &filer_pb.FuseAttributes{
Mtime: time.Now().Unix(), Mtime: time.Now().Unix(),
Crtime: time.Now().Unix(), Crtime: time.Now().Unix(),
FileMode: uint32(req.Mode), FileMode: uint32(req.Mode),
Uid: req.Uid, Uid: req.Uid,
Gid: req.Gid, Gid: req.Gid,
Collection: dir.wfs.collection,
Replication: dir.wfs.replication,
TtlSec: dir.wfs.ttlSec,
}, },
}, },
} }

View File

@ -121,6 +121,7 @@ func (pages *ContinuousDirtyPages) saveToStorage(ctx context.Context, buf []byte
Count: 1, Count: 1,
Replication: pages.f.wfs.replication, Replication: pages.f.wfs.replication,
Collection: pages.f.wfs.collection, Collection: pages.f.wfs.collection,
TtlSec: pages.f.wfs.ttlSec,
} }
resp, err := client.AssignVolume(ctx, request) resp, err := client.AssignVolume(ctx, request)

View File

@ -16,6 +16,7 @@ type WFS struct {
listDirectoryEntriesCache *ccache.Cache listDirectoryEntriesCache *ccache.Cache
collection string collection string
replication string replication string
ttlSec int32
chunkSizeLimit int64 chunkSizeLimit int64
// contains all open handles // contains all open handles
@ -24,12 +25,13 @@ type WFS struct {
pathToHandleLock sync.Mutex pathToHandleLock sync.Mutex
} }
func NewSeaweedFileSystem(filerGrpcAddress string, collection string, replication string, chunkSizeLimitMB int) *WFS { func NewSeaweedFileSystem(filerGrpcAddress string, collection string, replication string, ttlSec int32, chunkSizeLimitMB int) *WFS {
return &WFS{ return &WFS{
filerGrpcAddress: filerGrpcAddress, filerGrpcAddress: filerGrpcAddress,
listDirectoryEntriesCache: ccache.New(ccache.Configure().MaxSize(6000).ItemsToPrune(100)), listDirectoryEntriesCache: ccache.New(ccache.Configure().MaxSize(6000).ItemsToPrune(100)),
collection: collection, collection: collection,
replication: replication, replication: replication,
ttlSec: ttlSec,
chunkSizeLimit: int64(chunkSizeLimitMB) * 1024 * 1024, chunkSizeLimit: int64(chunkSizeLimitMB) * 1024 * 1024,
pathToHandleIndex: make(map[string]int), pathToHandleIndex: make(map[string]int),
} }

View File

@ -126,6 +126,7 @@ message AssignVolumeRequest {
int32 count = 1; int32 count = 1;
string collection = 2; string collection = 2;
string replication = 3; string replication = 3;
int32 ttl_sec = 4;
} }
message AssignVolumeResponse { message AssignVolumeResponse {

View File

@ -499,6 +499,7 @@ type AssignVolumeRequest struct {
Count int32 `protobuf:"varint,1,opt,name=count" json:"count,omitempty"` Count int32 `protobuf:"varint,1,opt,name=count" json:"count,omitempty"`
Collection string `protobuf:"bytes,2,opt,name=collection" json:"collection,omitempty"` Collection string `protobuf:"bytes,2,opt,name=collection" json:"collection,omitempty"`
Replication string `protobuf:"bytes,3,opt,name=replication" json:"replication,omitempty"` Replication string `protobuf:"bytes,3,opt,name=replication" json:"replication,omitempty"`
TtlSec int32 `protobuf:"varint,4,opt,name=ttl_sec,json=ttlSec" json:"ttl_sec,omitempty"`
} }
func (m *AssignVolumeRequest) Reset() { *m = AssignVolumeRequest{} } func (m *AssignVolumeRequest) Reset() { *m = AssignVolumeRequest{} }
@ -527,6 +528,13 @@ func (m *AssignVolumeRequest) GetReplication() string {
return "" return ""
} }
func (m *AssignVolumeRequest) GetTtlSec() int32 {
if m != nil {
return m.TtlSec
}
return 0
}
type AssignVolumeResponse struct { type AssignVolumeResponse struct {
FileId string `protobuf:"bytes,1,opt,name=file_id,json=fileId" json:"file_id,omitempty"` FileId string `protobuf:"bytes,1,opt,name=file_id,json=fileId" json:"file_id,omitempty"`
Url string `protobuf:"bytes,2,opt,name=url" json:"url,omitempty"` Url string `protobuf:"bytes,2,opt,name=url" json:"url,omitempty"`
@ -971,66 +979,66 @@ var _SeaweedFiler_serviceDesc = grpc.ServiceDesc{
func init() { proto.RegisterFile("filer.proto", fileDescriptor0) } func init() { proto.RegisterFile("filer.proto", fileDescriptor0) }
var fileDescriptor0 = []byte{ var fileDescriptor0 = []byte{
// 964 bytes of a gzipped FileDescriptorProto // 971 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xb4, 0x56, 0xdd, 0x6e, 0xdc, 0x44, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xb4, 0x56, 0xdd, 0x6e, 0xdc, 0x44,
0x14, 0x8e, 0xd7, 0xd9, 0xcd, 0xfa, 0xec, 0xa6, 0xc0, 0x6c, 0x5a, 0xcc, 0x36, 0xa9, 0x96, 0xa1, 0x14, 0x8e, 0xd7, 0xeb, 0xcd, 0xfa, 0xec, 0xa6, 0xc0, 0x6c, 0x5a, 0xcc, 0x36, 0xa9, 0x16, 0xd3,
0x45, 0xa9, 0x90, 0xa2, 0x28, 0x70, 0x51, 0x81, 0x90, 0xa8, 0x9a, 0x52, 0x55, 0x4a, 0x55, 0xc9, 0xa2, 0x54, 0x48, 0x51, 0x14, 0xb8, 0xa8, 0x40, 0x48, 0x54, 0x4d, 0xa9, 0x2a, 0xa5, 0xaa, 0xe4,
0x21, 0x48, 0x5c, 0xad, 0x1c, 0xfb, 0x64, 0x19, 0xc5, 0x6b, 0x1b, 0xcf, 0x38, 0x28, 0xdc, 0x72, 0x10, 0x24, 0xae, 0x56, 0x8e, 0x7d, 0x76, 0x19, 0xc5, 0x6b, 0x1b, 0xcf, 0x38, 0x28, 0xdc, 0x22,
0xc9, 0x05, 0x4f, 0xc1, 0x1b, 0xf0, 0x06, 0xbc, 0x18, 0x9a, 0x1f, 0x7b, 0xc7, 0x6b, 0x6f, 0x7f, 0x71, 0xc3, 0x05, 0x4f, 0xc1, 0x1b, 0xf0, 0x06, 0xbc, 0x18, 0x9a, 0x1f, 0x7b, 0xc7, 0x6b, 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4e, 0x59, 0x66, 0xb1, 0x2e, 0xba, 0xab, 0x53, 0x5e, 0x65, 0xe9, 0xa2, 0x81, 0xd2, 0x33, 0x50, 0xea, 0x94, 0x55, 0x16, 0xab, 0xa2, 0x7b, 0x2a, 0xe5, 0x55,
0x31, 0x92, 0x8f, 0xc1, 0x2d, 0x59, 0xac, 0xca, 0xee, 0x06, 0xf2, 0x28, 0x2d, 0x0b, 0x16, 0xfb, 0x16, 0x23, 0xf9, 0x10, 0xec, 0x92, 0xc6, 0xb2, 0xec, 0x5e, 0x20, 0x8e, 0xc2, 0xb2, 0xa4, 0xb1,
0x7d, 0x6d, 0x59, 0x30, 0xd5, 0x48, 0x54, 0x28, 0xdc, 0x81, 0x6e, 0x44, 0xdf, 0x64, 0x23, 0x4b, 0xe7, 0x28, 0xcb, 0x92, 0xca, 0x46, 0xa2, 0x42, 0xe2, 0x0e, 0x54, 0x23, 0xea, 0x26, 0x1a, 0x59,
0x69, 0xdd, 0xd1, 0x2f, 0x49, 0x9e, 0xc9, 0x0c, 0x46, 0x05, 0xe6, 0x09, 0x8b, 0x42, 0xc1, 0xb2, 0x09, 0xeb, 0xae, 0x7a, 0x49, 0xe2, 0x4c, 0x66, 0x30, 0x2a, 0x30, 0x4f, 0x68, 0x14, 0x72, 0x9a,
0xd4, 0x1f, 0x2a, 0x97, 0x6d, 0x22, 0x0f, 0x00, 0xa2, 0x2c, 0x49, 0x30, 0x52, 0x01, 0x9e, 0x0a, 0xa5, 0xde, 0x50, 0xba, 0x4c, 0x13, 0x79, 0x00, 0x10, 0x65, 0x49, 0x82, 0x91, 0x0c, 0x70, 0x65,
0xb0, 0x2c, 0xf2, 0x79, 0x0a, 0x91, 0xcc, 0x39, 0x46, 0x3e, 0xcc, 0x9c, 0xc3, 0x7e, 0x30, 0x10, 0x80, 0x61, 0x11, 0xcf, 0x93, 0xf3, 0x64, 0xce, 0x30, 0xf2, 0x60, 0x66, 0x1d, 0x39, 0xc1, 0x80,
0x22, 0x39, 0x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, 0x75, 0xc9, 0x9c, 0x44, 0x33,
0x75, 0x29, 0xce, 0x16, 0x79, 0x0d, 0x63, 0x5b, 0x04, 0x88, 0x95, 0xd0, 0xa1, 0x45, 0xd3, 0x07, 0x64, 0xc5, 0x44, 0x6b, 0xcb, 0x9f, 0x89, 0xd6, 0xa5, 0x45, 0x3b, 0xe4, 0x35, 0x8c, 0x4d, 0x11,
0x9b, 0xdc, 0x36, 0xa0, 0x3d, 0xf3, 0x36, 0x60, 0xc7, 0xd6, 0xdb, 0x80, 0x5d, 0xab, 0x42, 0xb7, 0x20, 0x46, 0x42, 0x87, 0x48, 0x4d, 0x1f, 0x6c, 0x73, 0x9b, 0x80, 0xe6, 0xcc, 0x9b, 0x80, 0x1d,
0x2e, 0x07, 0xea, 0xa7, 0xf9, 0xeb, 0xff, 0x03, 0x00, 0x00, 0xff, 0xff, 0x63, 0x17, 0x06, 0x1b, 0x5b, 0x6f, 0x02, 0x76, 0xad, 0x8a, 0xbf, 0x73, 0x35, 0x90, 0xbf, 0xd3, 0x5f, 0xfe, 0x17, 0x00,
0x43, 0x0b, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0xdc, 0x65, 0x5f, 0x5d, 0x0b, 0x00, 0x00,
} }

View File

@ -11,6 +11,7 @@ import (
"github.com/chrislusf/seaweedfs/weed/glog" "github.com/chrislusf/seaweedfs/weed/glog"
"github.com/chrislusf/seaweedfs/weed/operation" "github.com/chrislusf/seaweedfs/weed/operation"
"github.com/chrislusf/seaweedfs/weed/pb/filer_pb" "github.com/chrislusf/seaweedfs/weed/pb/filer_pb"
"strconv"
) )
func (fs *FilerServer) LookupDirectoryEntry(ctx context.Context, req *filer_pb.LookupDirectoryEntryRequest) (*filer_pb.LookupDirectoryEntryResponse, error) { func (fs *FilerServer) LookupDirectoryEntry(ctx context.Context, req *filer_pb.LookupDirectoryEntryRequest) (*filer_pb.LookupDirectoryEntryResponse, error) {
@ -167,10 +168,16 @@ func (fs *FilerServer) DeleteEntry(ctx context.Context, req *filer_pb.DeleteEntr
func (fs *FilerServer) AssignVolume(ctx context.Context, req *filer_pb.AssignVolumeRequest) (resp *filer_pb.AssignVolumeResponse, err error) { func (fs *FilerServer) AssignVolume(ctx context.Context, req *filer_pb.AssignVolumeRequest) (resp *filer_pb.AssignVolumeResponse, err error) {
ttlStr := ""
if req.TtlSec > 0 {
ttlStr = strconv.Itoa(int(req.TtlSec))
}
assignResult, err := operation.Assign(fs.filer.GetMaster(), &operation.VolumeAssignRequest{ assignResult, err := operation.Assign(fs.filer.GetMaster(), &operation.VolumeAssignRequest{
Count: uint64(req.Count), Count: uint64(req.Count),
Replication: req.Replication, Replication: req.Replication,
Collection: req.Collection, Collection: req.Collection,
Ttl: ttlStr,
}) })
if err != nil { if err != nil {
return nil, fmt.Errorf("assign volume: %v", err) return nil, fmt.Errorf("assign volume: %v", err)