weed mount add ttl option
This commit is contained in:
@@ -10,6 +10,7 @@ import (
|
||||
"github.com/chrislusf/seaweedfs/weed/pb/filer_pb"
|
||||
"path/filepath"
|
||||
"time"
|
||||
"github.com/chrislusf/seaweedfs/weed/filer2"
|
||||
)
|
||||
|
||||
type Dir struct {
|
||||
@@ -110,11 +111,14 @@ func (dir *Dir) Create(ctx context.Context, req *fuse.CreateRequest,
|
||||
Name: req.Name,
|
||||
IsDirectory: req.Mode&os.ModeDir > 0,
|
||||
Attributes: &filer_pb.FuseAttributes{
|
||||
Mtime: time.Now().Unix(),
|
||||
Crtime: time.Now().Unix(),
|
||||
FileMode: uint32(req.Mode),
|
||||
Uid: req.Uid,
|
||||
Gid: req.Gid,
|
||||
Mtime: time.Now().Unix(),
|
||||
Crtime: time.Now().Unix(),
|
||||
FileMode: uint32(req.Mode),
|
||||
Uid: req.Uid,
|
||||
Gid: req.Gid,
|
||||
Collection: dir.wfs.collection,
|
||||
Replication: dir.wfs.replication,
|
||||
TtlSec: dir.wfs.ttlSec,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -121,6 +121,7 @@ func (pages *ContinuousDirtyPages) saveToStorage(ctx context.Context, buf []byte
|
||||
Count: 1,
|
||||
Replication: pages.f.wfs.replication,
|
||||
Collection: pages.f.wfs.collection,
|
||||
TtlSec: pages.f.wfs.ttlSec,
|
||||
}
|
||||
|
||||
resp, err := client.AssignVolume(ctx, request)
|
||||
|
||||
@@ -16,6 +16,7 @@ type WFS struct {
|
||||
listDirectoryEntriesCache *ccache.Cache
|
||||
collection string
|
||||
replication string
|
||||
ttlSec int32
|
||||
chunkSizeLimit int64
|
||||
|
||||
// contains all open handles
|
||||
@@ -24,12 +25,13 @@ type WFS struct {
|
||||
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{
|
||||
filerGrpcAddress: filerGrpcAddress,
|
||||
listDirectoryEntriesCache: ccache.New(ccache.Configure().MaxSize(6000).ItemsToPrune(100)),
|
||||
collection: collection,
|
||||
replication: replication,
|
||||
ttlSec: ttlSec,
|
||||
chunkSizeLimit: int64(chunkSizeLimitMB) * 1024 * 1024,
|
||||
pathToHandleIndex: make(map[string]int),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user