本文整理汇总了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;未经允许,请勿转载。 |
请发表评论