client

package
v0.0.0-...-a501900 Latest Latest
Warning

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

Go to latest
Published: May 16, 2025 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DirectoryProvider = "directory"
	S3Provider        = "s3"
	AzureProvider     = "azure"
)

Variables

View Source
var RevisionNotRequestedError = errors.New("revision not requested")

Functions

This section is empty.

Types

type Client

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

func New

func New(ctx context.Context, opts ...Options) (*Client, error)

func (*Client) Create

func (c *Client) Create(ctx context.Context, provider string, fromWorkspaces ...string) (string, error)

func (*Client) DeleteFile

func (c *Client) DeleteFile(ctx context.Context, id, file string) error

func (*Client) DeleteRevision

func (c *Client) DeleteRevision(ctx context.Context, id, fileName, revision string) error

func (*Client) GetRevision

func (c *Client) GetRevision(ctx context.Context, id, fileName, revision string) (*File, error)

func (*Client) ListRevisions

func (c *Client) ListRevisions(ctx context.Context, id, fileName string) ([]RevisionInfo, error)

func (*Client) Ls

func (c *Client) Ls(ctx context.Context, id, prefix string) ([]string, error)

func (*Client) OpenFile

func (c *Client) OpenFile(ctx context.Context, id, fileName string, opts ...OpenOptions) (*File, error)

func (*Client) Providers

func (c *Client) Providers() []string

func (*Client) RemoveAllWithPrefix

func (c *Client) RemoveAllWithPrefix(ctx context.Context, id, prefix string) error

func (*Client) Rm

func (c *Client) Rm(ctx context.Context, id string) error

func (*Client) StatFile

func (c *Client) StatFile(ctx context.Context, id, fileName string, opts ...StatOptions) (FileInfo, error)

func (*Client) WriteFile

func (c *Client) WriteFile(ctx context.Context, id, fileName string, reader io.Reader, opts ...WriteOptions) error

type ConflictError

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

func (*ConflictError) Error

func (e *ConflictError) Error() string

type File

type File struct {
	io.ReadCloser
	RevisionID string
}

func (*File) GetRevisionID

func (f *File) GetRevisionID() (string, error)

type FileExistsError

type FileExistsError ConflictError

func (*FileExistsError) Error

func (e *FileExistsError) Error() string

type FileInfo

type FileInfo struct {
	WorkspaceID string    `json:"workspaceID"`
	Name        string    `json:"name"`
	Size        int64     `json:"size"`
	ModTime     time.Time `json:"modTime"`
	MimeType    string    `json:"mimeType"`
	RevisionID  string    `json:"revisionID"`
}

func (*FileInfo) GetRevisionID

func (f *FileInfo) GetRevisionID() (string, error)

type NotFoundError

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

func (*NotFoundError) Error

func (e *NotFoundError) Error() string

type OpenOptions

type OpenOptions struct {
	WithLatestRevisionID bool
}

type Options

type Options struct {
	DirectoryDataHome     string
	S3BucketName          string
	S3BaseEndpoint        string
	S3UsePathStyle        bool
	AzureContainerName    string
	AzureConnectionString string
}

type RevisionInfo

type RevisionInfo struct {
	FileInfo
	RevisionID string `json:"revisionID"`
}

func (*RevisionInfo) GetRevisionID

func (r *RevisionInfo) GetRevisionID() (string, error)

type StatOptions

type StatOptions struct {
	WithLatestRevisionID bool
}

type WriteOptions

type WriteOptions struct {
	CreateRevision *bool
	// If LatestRevisionID is set, then a conflict error will be returned if that revision is not the latest.
	LatestRevisionID string
	// IfNotExists will only write if the file does not exist. Mutually exclusive with LatestRevisionID.
	IfNotExists bool
}

Jump to

Keyboard shortcuts

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