attr_cache

package
v1.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 8, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AttrFlagUnknown uint16 = iota
	AttrFlagExists
	AttrFlagValid
	// when using S3, directories with no objects are not represented in cloud storage
	AttrFlagNotInCloud
)

Flags represented in BitMap for various flags in the attr cache item

Variables

This section is empty.

Functions

func NewAttrCacheComponent

func NewAttrCacheComponent() internal.Component

Pipeline will call this method to create your object, initialize your variables here << DO NOT DELETE ANY AUTO GENERATED CODE HERE >>

Types

type AttrCache

type AttrCache struct {
	internal.BaseComponent
	// contains filtered or unexported fields
}

Common structure for AttrCache Component

func (*AttrCache) Chmod

func (ac *AttrCache) Chmod(options internal.ChmodOptions) error

Chmod : Update the file with its new permissions

func (*AttrCache) Chown

func (ac *AttrCache) Chown(options internal.ChownOptions) error

Chown : Update the file with its new owner and group (when datalake chown is implemented)

func (*AttrCache) CommitData added in v1.1.0

func (ac *AttrCache) CommitData(options internal.CommitDataOptions) error

func (*AttrCache) Configure

func (ac *AttrCache) Configure(_ bool) error

Configure : Pipeline will call this method after constructor so that you can read config and initialize yourself

Return failure if any config is not valid to exit the process

func (*AttrCache) CopyFromFile

func (ac *AttrCache) CopyFromFile(options internal.CopyFromFileOptions) error

CopyFromFile : Upload file and update cache entry

func (*AttrCache) CopyToFile added in v1.2.0

func (ac *AttrCache) CopyToFile(options internal.CopyToFileOptions) error

Update attribute cache when CopyToFile returns that a file doesn't exist

func (*AttrCache) CreateDir

func (ac *AttrCache) CreateDir(options internal.CreateDirOptions) error

------------------------- Methods implemented by this component ------------------------------------------- CreateDir: Mark the directory invalid, or insert the dir item into cache when cacheDirs is true.

func (*AttrCache) CreateFile

func (ac *AttrCache) CreateFile(options internal.CreateFileOptions) (*handlemap.Handle, error)

CreateFile: Cache a new entry for the file

func (ac *AttrCache) CreateLink(options internal.CreateLinkOptions) error

CreateLink : Mark the new link invalid

func (*AttrCache) DeleteDir

func (ac *AttrCache) DeleteDir(options internal.DeleteDirOptions) error

DeleteDir: Mark the directory deleted and mark all it's children deleted

func (*AttrCache) DeleteFile

func (ac *AttrCache) DeleteFile(options internal.DeleteFileOptions) error

DeleteFile : Mark the file deleted

func (*AttrCache) FlushFile

func (ac *AttrCache) FlushFile(options internal.FlushFileOptions) error

FlushFile : flush file

func (*AttrCache) GetAttr

func (ac *AttrCache) GetAttr(options internal.GetAttrOptions) (*internal.ObjAttr, error)

GetAttr : Try to serve the request from the attribute cache, otherwise cache attributes of the path returned by next component

func (*AttrCache) IsDirEmpty

func (ac *AttrCache) IsDirEmpty(options internal.IsDirEmptyOptions) bool

IsDirEmpty: Whether or not the directory is empty

func (*AttrCache) Name

func (ac *AttrCache) Name() string

func (*AttrCache) OnConfigChange

func (ac *AttrCache) OnConfigChange()

OnConfigChange : If component has registered, on config file change this method is called

func (*AttrCache) OpenFile added in v1.1.3

func (ac *AttrCache) OpenFile(options internal.OpenFileOptions) (*handlemap.Handle, error)

OpenFile: Update cache with Open results from cloud

func (*AttrCache) Priority

func (ac *AttrCache) Priority() internal.ComponentPriority

func (*AttrCache) RenameDir

func (ac *AttrCache) RenameDir(options internal.RenameDirOptions) error

RenameDir : Mark the source directory and all its contents deleted. Invalidate the destination since we may have overwritten it.

func (*AttrCache) RenameFile

func (ac *AttrCache) RenameFile(options internal.RenameFileOptions) error

RenameFile : Move item in cache

func (*AttrCache) SetName

func (ac *AttrCache) SetName(name string)

func (*AttrCache) SetNextComponent

func (ac *AttrCache) SetNextComponent(nc internal.Component)

func (*AttrCache) Start

func (ac *AttrCache) Start(ctx context.Context) error

Start : Pipeline calls this method to start the component functionality

this shall not block the call otherwise pipeline will not start

func (*AttrCache) Stop

func (ac *AttrCache) Stop() error

Stop : Stop the component functionality and kill all threads started

func (*AttrCache) StreamDir

func (ac *AttrCache) StreamDir(options internal.StreamDirOptions) ([]*internal.ObjAttr, string, error)

StreamDir : Optionally cache attributes of paths returned by next component

func (*AttrCache) SyncDir

func (ac *AttrCache) SyncDir(options internal.SyncDirOptions) error

SyncDir : Refresh attributes from storage

func (*AttrCache) SyncFile

func (ac *AttrCache) SyncFile(options internal.SyncFileOptions) error

SyncFile : Refresh attributes from storage

func (*AttrCache) TruncateFile

func (ac *AttrCache) TruncateFile(options internal.TruncateFileOptions) error

TruncateFile : Update the file with its truncated size

func (*AttrCache) WriteFile

func (ac *AttrCache) WriteFile(options internal.WriteFileOptions) (int, error)

WriteFile : Mark the file invalid

type AttrCacheOptions

type AttrCacheOptions struct {
	Timeout        uint32 `config:"timeout-sec" yaml:"timeout-sec,omitempty"`
	NoCacheOnList  bool   `config:"no-cache-on-list" yaml:"no-cache-on-list,omitempty"`
	EnableSymlinks bool   `config:"enable-symlinks" yaml:"enable-symlinks,omitempty"`
	NoCacheDirs    bool   `config:"no-cache-dirs" yaml:"no-cache-dirs,omitempty"`
	// hidden option for backward compatibility
	NoSymlinks bool `config:"no-symlinks" yaml:"no-symlinks,omitempty"`

	//maximum file attributes overall to be cached
	MaxFiles int `config:"max-files" yaml:"max-files,omitempty"`

	// support v1
	CacheOnList bool `config:"cache-on-list"`
}

Structure defining your config parameters

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL