12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- package bokoworker
- import (
- "path/filepath"
- "strings"
- "imuslab.com/bokofs/bokofsd/mod/bokofs/bokofile"
- )
- type Worker struct {
-
- RootPath string
- DiskUUID string
- DiskPath string
- Subpath string
- ReadOnly bool
- AutoMount bool
-
- Filesystem *bokofile.RouterDir
- }
- func NewWorker(nodeName string, mountPath string) (*Worker, error) {
- if !strings.HasPrefix(nodeName, "/") {
- nodeName = "/" + nodeName
- }
- mountPath, _ = filepath.Abs(mountPath)
- fs, err := bokofile.CreateRouterFromDir(mountPath, nodeName, false)
- if err != nil {
- return nil, err
- }
- return &Worker{
- RootPath: nodeName,
- DiskUUID: "",
- DiskPath: "",
- Subpath: mountPath,
- ReadOnly: false,
- AutoMount: false,
- Filesystem: fs,
- }, nil
- }
|