longtailstorelib

package module
v0.0.0-...-be456c3 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2024 License: MIT Imports: 23 Imported by: 3

Documentation

Index

Constants

View Source
const NetworkPrefix = "\\"
View Source
const UNCPrefix = "\\\\?\\"

Variables

View Source
var ErrLocked error = trylockError("fslock is already locked")

ErrLocked indicates TryLock failed because the lock was already locked.

View Source
var ErrTimeout error = timeoutError("lock timeout exceeded")

ErrTimeout indicates that the lock attempt timed out.

Functions

func NormalizeFileSystemPath

func NormalizeFileSystemPath(path string) string

Types

type BlobClient

type BlobClient interface {
	NewObject(path string) (BlobObject, error)
	GetObjects(pathPrefix string) ([]BlobProperties, error)
	SupportsLocking() bool
	String() string
	Close()
}

BlobClient

type BlobObject

type BlobObject interface {
	// returns false, nil if the object does not exist
	// returns false, err on error
	// returns true, nil if the object exists
	Exists() (bool, error)

	// Locked the version for Write and Delete operations
	// If the underlying file has changed between the LockWriteVersion call
	// and a Write or Delete operation the operation will fail
	LockWriteVersion() (bool, error)

	// returns nil, error on error
	// returns []byte, nil on success
	// returns nil, nil if the underlying file no longer exists
	Read() ([]byte, error)

	// If no write condition is set:
	//   returns true, nil on success
	//   returns false, err on failure
	// If a write condition is set:
	//   returns true, nil if a version locked write succeeded
	//   returns false, nil if the write was prevented due to a version change
	//   returns false, err on error
	Write(data []byte) (bool, error)

	// Will return an error if a version lock is set with LockWriteVersion()
	// and the underlying file has changed
	Delete() error

	String() string
}

BlobObject

type BlobProperties

type BlobProperties struct {
	Size int64
	Name string
}

type BlobStore

type BlobStore interface {
	NewClient(ctx context.Context) (BlobClient, error)
	String() string
}

BlobStore

func CreateBlobStoreForURI

func CreateBlobStoreForURI(uri string, opts ...BlobStoreOption) (BlobStore, error)

func NewFSBlobStore

func NewFSBlobStore(prefix string, enableLocking bool) (BlobStore, error)

NewFSBlobStore ...

func NewGCSBlobStore

func NewGCSBlobStore(u *url.URL, disableLocking bool) (BlobStore, error)

NewGCSBlobStore ...

func NewMemBlobStore

func NewMemBlobStore(prefix string, supportsLocking bool) (BlobStore, error)

NewMemBlobStore ...

func NewS3BlobStore

func NewS3BlobStore(u *url.URL, opts ...BlobStoreOption) (BlobStore, error)

NewS3BlobStore ...

type BlobStoreOption

type BlobStoreOption func(options interface{})

type Lock

type Lock struct {
	// contains filtered or unexported fields
}

func NewFileLock

func NewFileLock(filename string) *Lock

func (*Lock) Lock

func (l *Lock) Lock() error

func (*Lock) LockWithTimeout

func (l *Lock) LockWithTimeout(timeout time.Duration) error

func (*Lock) Unlock

func (l *Lock) Unlock() error

type S3Options

type S3Options struct {
	EndpointResolverURI string
}

Jump to

Keyboard shortcuts

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