當前位置: 首頁>>代碼示例>>Golang>>正文


Golang nodefs.Node類代碼示例

本文整理匯總了Golang中github.com/hanwen/go-fuse/fuse/nodefs.Node的典型用法代碼示例。如果您正苦於以下問題:Golang Node類的具體用法?Golang Node怎麽用?Golang Node使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Node類的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: Link

func (me *memNode) Link(name string, existing nodefs.Node, context *fuse.Context) (*nodefs.Inode, fuse.Status) {
	me.Inode().AddChild(name, existing.Inode())
	me.mutex.Lock()
	defer me.mutex.Unlock()
	me.touch()
	return existing.Inode(), fuse.OK
}
開發者ID:hanwen,項目名稱:termite,代碼行數:7,代碼來源:memunionfs.go

示例2: Link

func (node *inMemNode) Link(name string, existing nodefs.Node, context *fuse.Context) (newNode *nodefs.Inode, code fuse.Status) {
	if node.Inode().GetChild(name) != nil {
		return nil, fuse.Status(syscall.EEXIST)
	}
	node.Inode().AddChild(name, existing.Inode())
	if inMemChild, ok := existing.(*inMemNode); ok {
		inMemChild.incrementLinks()
	}
	return existing.Inode(), fuse.OK
}
開發者ID:e-tothe-ipi,項目名稱:inmemfs,代碼行數:10,代碼來源:main.go

示例3: Rename

func (parent *inMemNode) Rename(oldName string, newParent nodefs.Node, newName string, context *fuse.Context) (code fuse.Status) {
	child := parent.Inode().GetChild(oldName)
	if child == nil {
		return fuse.ENOENT
	}
	parent.Inode().RmChild(oldName)
	parent.decrementLinks()
	newParent.Inode().RmChild(newName)
	newParent.Inode().AddChild(newName, child)
	if inMemNewParent, ok := newParent.(*inMemNode); ok {
		inMemNewParent.incrementLinks()
	}
	return fuse.OK
}
開發者ID:e-tothe-ipi,項目名稱:inmemfs,代碼行數:14,代碼來源:main.go

示例4: Lookup

func (f *p4Folder) Lookup(out *fuse.Attr, name string, context *fuse.Context) (*nodefs.Inode, fuse.Status) {
	f.fetch()

	var node nodefs.Node
	if st := f.files[name]; st != nil {
		node = f.fs.newFile(st)
	} else if f.folders[name] {
		node = f.fs.newFolder(filepath.Join(f.path, name), f.change)
	} else {
		return nil, fuse.ENOENT
	}

	node.GetAttr(out, nil, context)
	return f.Inode().NewChild(name, true, node), fuse.OK
}
開發者ID:hanwen,項目名稱:p4fuse,代碼行數:15,代碼來源:fs.go

示例5: recurse

func (t *treeFS) recurse(tree *git.Tree, n nodefs.Node) error {
	for i := uint64(0); ; i++ {
		e := tree.EntryByIndex(i)
		if e == nil {
			break
		}
		isdir := e.Filemode&syscall.S_IFDIR != 0
		var chNode nodefs.Node
		if isdir {
			chNode = t.newDirNode(e.Id)
		} else if e.Filemode&^07777 == syscall.S_IFLNK {
			l, err := t.newLinkNode(e.Id)
			if err != nil {
				return err
			}
			chNode = l
		} else if e.Filemode&^07777 == syscall.S_IFREG {
			b, err := t.newBlobNode(e.Id, e.Filemode)
			if err != nil {
				return err
			}
			chNode = b
		} else {
			panic(e)
		}
		n.Inode().NewChild(e.Name, isdir, chNode)
		if isdir {
			tree, err := t.repo.LookupTree(e.Id)
			if err != nil {
				return err
			}

			if err := t.recurse(tree, chNode); err != nil {
				return nil
			}
		}
	}
	return nil
}
開發者ID:hanwen,項目名稱:gitfs,代碼行數:39,代碼來源:fs.go

示例6: Rename

func (me *memNode) Rename(oldName string, newParent nodefs.Node, newName string, context *fuse.Context) (code fuse.Status) {
	me.mutex.Lock()
	defer me.mutex.Unlock()
	ch := me.Inode().RmChild(oldName)
	if ch == nil {
		return fuse.ENOENT
	}

	if me.original != "" || me == me.fs.root {
		me.fs.deleted[fastpath.Join(me.original, oldName)] = true
	}

	childNode := ch.Node().(*memNode)
	if childNode.original != "" || childNode == me.fs.root {
		childNode.materialize()
		childNode.markChanged()
	}

	newParent.Inode().RmChild(newName)
	newParent.Inode().AddChild(newName, ch)
	me.touch()
	return fuse.OK
}
開發者ID:hanwen,項目名稱:termite,代碼行數:23,代碼來源:memunionfs.go


注:本文中的github.com/hanwen/go-fuse/fuse/nodefs.Node類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。