MCPcopy Create free account
hub / github.com/nutsdb/nutsdb / GetFileRWManager

Method GetFileRWManager

file_manager.go:75–86  ·  view source on GitHub ↗

GetFileRWManager will return a FileIORWManager Object

(path string, capacity int64, segmentSize int64, readOnly bool)

Source from the content-addressed store, hash-verified

73
74// GetFileRWManager will return a FileIORWManager Object
75func (fm *FileManager) GetFileRWManager(path string, capacity int64, segmentSize int64, readOnly bool) (*fileio.FileIORWManager, error) {
76 fd, err := fm.fdm.GetFd(path)
77 if err != nil {
78 return nil, err
79 }
80 err = fileio.Truncate(path, capacity, fd, readOnly)
81 if err != nil {
82 return nil, err
83 }
84
85 return &fileio.FileIORWManager{Fd: fd, Path: path, Fdm: fm.fdm, SegmentSize: segmentSize}, nil
86}
87
88// GetMMapRWManager will return a MMapRWManager Object
89func (fm *FileManager) GetMMapRWManager(path string, capacity int64, segmentSize int64, readOnly bool) (*fileio.MMapRWManager, error) {

Callers 1

getDataFileWithModeMethod · 0.95

Calls 2

TruncateFunction · 0.92
GetFdMethod · 0.80

Tested by

no test coverage detected