• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Golang fuse.Connection类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Golang中github.com/jacobsa/fuse.Connection的典型用法代码示例。如果您正苦于以下问题:Golang Connection类的具体用法?Golang Connection怎么用?Golang Connection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Connection类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。

示例1: ServeOps

func (s *fileSystemServer) ServeOps(c *fuse.Connection) {
	// When we are done, we clean up by waiting for all in-flight ops then
	// destroying the file system.
	defer func() {
		s.opsInFlight.Wait()
		s.fs.Destroy()
	}()

	for {
		op, err := c.ReadOp()
		if err == io.EOF {
			break
		}

		if err != nil {
			panic(err)
		}

		s.opsInFlight.Add(1)
		go s.handleOp(op)
	}
}
开发者ID:BanzaiMan,项目名称:gcsfuse,代码行数:22,代码来源:file_system.go


示例2: handleOp

func (s *fileSystemServer) handleOp(
	c *fuse.Connection,
	ctx context.Context,
	op interface{}) {
	defer s.opsInFlight.Done()

	// Dispatch to the appropriate method.
	var err error
	switch typed := op.(type) {
	default:
		err = fuse.ENOSYS

	case *fuseops.LookUpInodeOp:
		err = s.fs.LookUpInode(ctx, typed)

	case *fuseops.GetInodeAttributesOp:
		err = s.fs.GetInodeAttributes(ctx, typed)

	case *fuseops.SetInodeAttributesOp:
		err = s.fs.SetInodeAttributes(ctx, typed)

	case *fuseops.ForgetInodeOp:
		err = s.fs.ForgetInode(ctx, typed)

	case *fuseops.MkDirOp:
		err = s.fs.MkDir(ctx, typed)

	case *fuseops.CreateFileOp:
		err = s.fs.CreateFile(ctx, typed)

	case *fuseops.CreateSymlinkOp:
		err = s.fs.CreateSymlink(ctx, typed)

	case *fuseops.RenameOp:
		err = s.fs.Rename(ctx, typed)

	case *fuseops.RmDirOp:
		err = s.fs.RmDir(ctx, typed)

	case *fuseops.UnlinkOp:
		err = s.fs.Unlink(ctx, typed)

	case *fuseops.OpenDirOp:
		err = s.fs.OpenDir(ctx, typed)

	case *fuseops.ReadDirOp:
		err = s.fs.ReadDir(ctx, typed)

	case *fuseops.ReleaseDirHandleOp:
		err = s.fs.ReleaseDirHandle(ctx, typed)

	case *fuseops.OpenFileOp:
		err = s.fs.OpenFile(ctx, typed)

	case *fuseops.ReadFileOp:
		err = s.fs.ReadFile(ctx, typed)

	case *fuseops.WriteFileOp:
		err = s.fs.WriteFile(ctx, typed)

	case *fuseops.SyncFileOp:
		err = s.fs.SyncFile(ctx, typed)

	case *fuseops.FlushFileOp:
		err = s.fs.FlushFile(ctx, typed)

	case *fuseops.ReleaseFileHandleOp:
		err = s.fs.ReleaseFileHandle(ctx, typed)

	case *fuseops.ReadSymlinkOp:
		err = s.fs.ReadSymlink(ctx, typed)
	}

	c.Reply(ctx, err)
}
开发者ID:kahing,项目名称:gcsfuse,代码行数:75,代码来源:file_system.go



注:本文中的github.com/jacobsa/fuse.Connection类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Golang fuseops.DirOffset函数代码示例发布时间:2022-05-23
下一篇:
Golang fuse.Unmount函数代码示例发布时间:2022-05-23
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap