Documentation ¶
Index ¶
- Constants
- Variables
- type Cache
- func (c *Cache) AddAll(container, path string, node Node, nodes map[string]Node)
- func (c *Cache) Delete(container, path, name string)
- func (c *Cache) DeleteAll(container, path string)
- func (c *Cache) Get(container, path, name string) Node
- func (c *Cache) GetAll(container, path string) (Node, map[string]Node)
- func (c *Cache) Peek(container, path string) (Node, bool)
- func (c *Cache) Set(container, path, name string, node Node)
- type CacheValue
- type Container
- type CryptoHandler
- type CryptoReadSeeker
- type CryptoWriter
- type Directory
- func (d *Directory) Attr(ctx context.Context, a *fuse.Attr) error
- func (d *Directory) Create(ctx context.Context, req *fuse.CreateRequest, resp *fuse.CreateResponse) (fs.Node, fs.Handle, error)
- func (d *Directory) Export() fuse.Dirent
- func (d *Directory) Lookup(ctx context.Context, req *fuse.LookupRequest, resp *fuse.LookupResponse) (fs.Node, error)
- func (d *Directory) Mkdir(ctx context.Context, req *fuse.MkdirRequest) (fs.Node, error)
- func (d *Directory) Name() string
- func (d *Directory) ReadDirAll(ctx context.Context) (direntries []fuse.Dirent, err error)
- func (d *Directory) Remove(ctx context.Context, req *fuse.RemoveRequest) error
- func (d *Directory) Rename(ctx context.Context, req *fuse.RenameRequest, newDir fs.Node) error
- func (d *Directory) Setattr(ctx context.Context, req *fuse.SetattrRequest, resp *fuse.SetattrResponse) error
- type HubicAuth
- type Lister
- type ListerTask
- type Node
- type Object
- func (o *Object) Attr(ctx context.Context, a *fuse.Attr) (err error)
- func (o *Object) Export() fuse.Dirent
- func (o *Object) Name() string
- func (o *Object) Open(ctx context.Context, req *fuse.OpenRequest, resp *fuse.OpenResponse) (fs.Handle, error)
- func (o *Object) Setattr(ctx context.Context, req *fuse.SetattrRequest, resp *fuse.SetattrResponse) error
- type ObjectHandle
- func (fh *ObjectHandle) Read(ctx context.Context, req *fuse.ReadRequest, resp *fuse.ReadResponse) (err error)
- func (fh *ObjectHandle) Release(ctx context.Context, req *fuse.ReleaseRequest) error
- func (fh *ObjectHandle) Write(ctx context.Context, req *fuse.WriteRequest, resp *fuse.WriteResponse) (err error)
- type Root
- func (r *Root) Create(ctx context.Context, req *fuse.CreateRequest, resp *fuse.CreateResponse) (fs.Node, fs.Handle, error)
- func (r *Root) Lookup(ctx context.Context, req *fuse.LookupRequest, resp *fuse.LookupResponse) (fs.Node, error)
- func (r *Root) Mkdir(ctx context.Context, req *fuse.MkdirRequest) (fs.Node, error)
- func (r *Root) ReadDirAll(ctx context.Context) (direntries []fuse.Dirent, err error)
- func (r *Root) Remove(ctx context.Context, req *fuse.RemoveRequest) error
- func (r *Root) Rename(ctx context.Context, req *fuse.RenameRequest, newDir fs.Node) error
- type SVFS
- type SimpleCache
Constants ¶
const ( DirContentType = "application/directory" ObjContentType = "application/octet-stream" AutoContent = "X-Detect-Content-Type" )
const ( ManifestHeader = "X-Object-Manifest" ObjectMetaHeader = "X-Object-Meta-" ObjectMtimeHeader = ObjectMetaHeader + "Mtime" ObjectSizeHeader = ObjectMetaHeader + "Crypto-Origin-Size" ObjectNonceHeader = ObjectMetaHeader + "Crypto-Nonce" )
const (
HubicEndpoint = "https://api.hubic.com"
)
const (
SegmentContainerSuffix = "_segments"
)
const Version = "0.6.0"
Variables ¶
var ( CacheTimeout time.Duration CacheMaxEntries int64 CacheMaxAccess int64 )
CacheConfig is the cache configuration.
var ( FolderRegex = regexp.MustCompile("^.+/$") SubdirRegex = regexp.MustCompile(".*/.*$") SegmentPathRegex = regexp.MustCompile("^([^/]+)/(.*)$") DirectoryCache = NewCache() ChangeCache = NewSimpleCache() DirectoryLister = new(Lister) )
var ( // Swift SwiftConnection = new(swift.Connection) TargetContainer string ExtraAttr bool SegmentSize uint64 // FS AllowRoot bool AllowOther bool DefaultGID uint64 DefaultUID uint64 DefaultMode uint64 DefaultPermissions bool ReadAheadSize uint // Encryption Cipher cipher.AEAD Encryption bool KeyFile string Key []byte BlockSize int64 )
var ( HubicRefreshToken string HubicAuthorization string )
var (
ListerConcurrency uint64
)
var SegmentRegex = regexp.MustCompile("^.+_segments$")
Functions ¶
This section is empty.
Types ¶
type Cache ¶ added in v0.2.6
type Cache struct {
// contains filtered or unexported fields
}
Cache holds a map of cache entries. Its size can be configured as well as cache entries access limit and expiration time.
func (*Cache) AddAll ¶ added in v0.3.0
AddAll creates a new cache entry with the key container:path and a map of nodes as a value. Node represents the parent node type. If the cache entry count limit is reached, it will be marked as temporary thus evicted after one read.
func (*Cache) DeleteAll ¶ added in v0.3.0
DeleteAll removes all nodes for the cache key container:path.
func (*Cache) Get ¶ added in v0.2.6
Get retrieves a specific node from the cache. It returns nil if the cache key container:path is missing.
func (*Cache) GetAll ¶ added in v0.3.0
GetAll retrieves all nodes for the cache key container:path. It returns the parent node and its children nodes. If the cache entry is not found or expired or access count exceeds the limit, both values will be nil.
type CacheValue ¶ added in v0.3.0
type CacheValue struct {
// contains filtered or unexported fields
}
CacheValue is the representation of a cache entry. It tracks expiration date, access count and holds a parent node with its children. It can be set as temporary, meaning that it will be stored within the cache but evicted on first access.
type Container ¶
type Container struct {
*Directory
}
Container is a node representing a directory entry bound to a Swift container.
type CryptoHandler ¶ added in v0.6.0
type CryptoHandler struct { Nonce []byte // contains filtered or unexported fields }
type CryptoReadSeeker ¶ added in v0.6.0
type CryptoReadSeeker struct { CryptoHandler // contains filtered or unexported fields }
CryptoReadSeeker reads encrypted swift objects. It supports seeking for a specific offset. It reads data produced with a static cipher block and padding size (i.e. overhead).
func NewCryptoReadSeeker ¶ added in v0.6.0
func NewCryptoReadSeeker(reader io.ReadSeeker, blockSize, overhead int64) *CryptoReadSeeker
NewCryptoReadSeeker returns a new CryptoReadSeeker.
func (*CryptoReadSeeker) Close ¶ added in v0.6.0
func (r *CryptoReadSeeker) Close() error
type CryptoWriter ¶ added in v0.6.0
type CryptoWriter struct { CryptoHandler // contains filtered or unexported fields }
func NewCryptoWriter ¶ added in v0.6.0
func NewCryptoWriter(writer io.WriteCloser, blockSize, overhead int64) *CryptoWriter
func (*CryptoWriter) Close ¶ added in v0.6.0
func (w *CryptoWriter) Close() error
Close tears down the writer, appending any pending data not forming a block with a sufficient size to be handled by previous write requests.
type Directory ¶
type Directory struct {
// contains filtered or unexported fields
}
Directory represents a standard directory entry.
func (*Directory) Create ¶
func (d *Directory) Create(ctx context.Context, req *fuse.CreateRequest, resp *fuse.CreateResponse) (fs.Node, fs.Handle, error)
Create makes a new object node represented by a file. It returns an object node and an opened file handle.
func (*Directory) Lookup ¶
func (d *Directory) Lookup(ctx context.Context, req *fuse.LookupRequest, resp *fuse.LookupResponse) (fs.Node, error)
Lookup gets a children node if its name matches the requested direntry name. If the cache is empty for the current directory, it will fill it and try to match the requested direnty after this operation. It returns ENOENT if not found.
func (*Directory) Mkdir ¶ added in v0.2.0
Mkdir creates a new directory node within the current directory. It is represented by an empty object ending with a slash in the Swift container.
func (*Directory) ReadDirAll ¶
ReadDirAll reads the content of a directory and returns a list of children nodes as direntries, using/filling the cache of nodes.
func (*Directory) Remove ¶
Remove deletes a direntry and relevant node. It is not supported on container nodes. It handles standard and segmented object deletion.
func (*Directory) Rename ¶
Rename moves a node from its current directory node to a new directory node and updates the cache.
func (*Directory) Setattr ¶ added in v0.5.2
func (d *Directory) Setattr(ctx context.Context, req *fuse.SetattrRequest, resp *fuse.SetattrResponse) error
type HubicAuth ¶ added in v0.5.0
type HubicAuth struct {
// contains filtered or unexported fields
}
HubicAuth is a swift-compliant authenticatior for hubic.
func (*HubicAuth) CdnUrl ¶ added in v0.5.0
CdnUrl retrieves the CDN URL from the authentication response.
func (*HubicAuth) StorageUrl ¶ added in v0.5.0
StorageUrl retrieves the swift's storage URL from the authentication response.
type Lister ¶ added in v0.5.2
type Lister struct {
// contains filtered or unexported fields
}
Lister is a concurrent processor of direntries. Its job is to get extra information about files.
type ListerTask ¶ added in v0.5.2
type ListerTask struct {
// contains filtered or unexported fields
}
ListerTask represents a manifest ready to be processed by the Lister. Every task must provide a manifest object and a result channel to which retrieved information will be sent.
type Object ¶
type Object struct {
// contains filtered or unexported fields
}
Object is a node representing a swift object. It belongs to a container and segmented objects are bound to a container of segments.
func (*Object) Open ¶
func (o *Object) Open(ctx context.Context, req *fuse.OpenRequest, resp *fuse.OpenResponse) (fs.Handle, error)
Open returns the file handle associated with this object node.
func (*Object) Setattr ¶ added in v0.5.2
func (o *Object) Setattr(ctx context.Context, req *fuse.SetattrRequest, resp *fuse.SetattrResponse) error
type ObjectHandle ¶
type ObjectHandle struct {
// contains filtered or unexported fields
}
ObjectHandle represents an open object handle, similarly to file handles.
func (*ObjectHandle) Read ¶
func (fh *ObjectHandle) Read(ctx context.Context, req *fuse.ReadRequest, resp *fuse.ReadResponse) (err error)
Read gets a swift object data for a request within the current context. The request size is always honored. We open the file on the first write.
func (*ObjectHandle) Release ¶
func (fh *ObjectHandle) Release(ctx context.Context, req *fuse.ReleaseRequest) error
Release frees the file handle, closing all readers/writers in use.
func (*ObjectHandle) Write ¶
func (fh *ObjectHandle) Write(ctx context.Context, req *fuse.WriteRequest, resp *fuse.WriteResponse) (err error)
Write pushes data to a swift object. If we detect that we are writing more data than the configured segment size, then the first object we were writing to is moved to the segment container and named accordingly to DLO conventions. Remaining data will be split into segments sequentially until file handle release is called. If we are overwriting an object we handle segment deletion, and object creation.
type Root ¶
type Root struct {
*Directory
}
Root is a fake root node used to hold a list of container nodes.
func (*Root) Create ¶
func (r *Root) Create(ctx context.Context, req *fuse.CreateRequest, resp *fuse.CreateResponse) (fs.Node, fs.Handle, error)
Create is not supported on a root node.
func (*Root) Lookup ¶ added in v0.2.5
func (r *Root) Lookup(ctx context.Context, req *fuse.LookupRequest, resp *fuse.LookupResponse) (fs.Node, error)
Lookup gets a container node if its name matches the request name within the current context.
func (*Root) ReadDirAll ¶
ReadDirAll retrieves all containers within the current Openstack tenant, as direntries. Segment containers are not shown and created if missing.
type SVFS ¶
type SVFS struct{}
SVFS implements the Swift Virtual File System.
type SimpleCache ¶ added in v0.5.2
type SimpleCache struct {
// contains filtered or unexported fields
}
SimpleCache is a simplistic caching implementation only relying on a hashmap with basic functions.
func NewSimpleCache ¶ added in v0.5.2
func NewSimpleCache() *SimpleCache
NewSimpleCache creates a new simplistic cache.
func (*SimpleCache) Add ¶ added in v0.5.2
func (c *SimpleCache) Add(container, path string, node Node)
Add pushes a new cache entry.
func (*SimpleCache) Exist ¶ added in v0.5.2
func (c *SimpleCache) Exist(container, path string) bool
Exist checks whether a cache key exist or not.
func (*SimpleCache) Get ¶ added in v0.5.2
func (c *SimpleCache) Get(container, path string) Node
Get retrieves a cache entry for the given key.
func (*SimpleCache) Remove ¶ added in v0.5.2
func (c *SimpleCache) Remove(container, path string)
Remove pops the cache entry at this key.