本文整理汇总了Golang中github.com/jacobsa/fuse/fuseops.GetInodeAttributesOp.AttributesExpiration方法的典型用法代码示例。如果您正苦于以下问题:Golang GetInodeAttributesOp.AttributesExpiration方法的具体用法?Golang GetInodeAttributesOp.AttributesExpiration怎么用?Golang GetInodeAttributesOp.AttributesExpiration使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/jacobsa/fuse/fuseops.GetInodeAttributesOp
的用法示例。
在下文中一共展示了GetInodeAttributesOp.AttributesExpiration方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: GetInodeAttributes
// LOCKS_EXCLUDED(fs.mu)
func (fs *cachingFS) GetInodeAttributes(
ctx context.Context,
op *fuseops.GetInodeAttributesOp) (err error) {
fs.mu.Lock()
defer fs.mu.Unlock()
// Figure out which inode the request is for.
var attrs fuseops.InodeAttributes
switch {
case op.Inode == fuseops.RootInodeID:
attrs = fs.rootAttrs()
case op.Inode%numInodes == fooOffset:
attrs = fs.fooAttrs()
case op.Inode%numInodes == dirOffset:
attrs = fs.dirAttrs()
case op.Inode%numInodes == barOffset:
attrs = fs.barAttrs()
}
// Fill in the response.
op.Attributes = attrs
op.AttributesExpiration = time.Now().Add(fs.getattrTimeout)
return
}
示例2: GetInodeAttributes
func (fs *Goofys) GetInodeAttributes(
ctx context.Context,
op *fuseops.GetInodeAttributesOp) (err error) {
fs.mu.Lock()
inode := fs.getInodeOrDie(op.Inode)
fs.mu.Unlock()
attr, err := inode.GetAttributes(fs)
op.Attributes = *attr
op.AttributesExpiration = time.Now().Add(365 * 24 * time.Hour)
return
}
示例3: GetInodeAttributes
func (fs *memFS) GetInodeAttributes(
op *fuseops.GetInodeAttributesOp) (err error) {
fs.mu.Lock()
defer fs.mu.Unlock()
// Grab the inode.
inode := fs.getInodeOrDie(op.Inode)
// Fill in the response.
op.Attributes = inode.attrs
// We don't spontaneously mutate, so the kernel can cache as long as it wants
// (since it also handles invalidation).
op.AttributesExpiration = fs.clock.Now().Add(365 * 24 * time.Hour)
return
}