Documentation ¶
Overview ¶
Client for accessing Varasto server
Index ¶
- Constants
- func BlobIdxFromOffset(offset int64) (int, int64)
- func ConfigFilePath() (string, error)
- func DownloadChunk(ctx context.Context, ref stotypes.BlobRef, collectionId string, ...) (io.Reader, func(), error)
- func Entrypoints() []*cobra.Command
- func NewBackgroundUploader(ctx context.Context, n int, clientConfig ClientConfig, ...) *backgroundUploader
- func NewBlobDiscoveredAttrs(ref stotypes.BlobRef, collectionId string, content []byte, ...) blobDiscoveredAttrs
- func NewWorkdirLocation(path string) (*workdirLocation, error)
- func ScanAndDiscoverBlobs(ctx context.Context, relativePath string, file io.Reader, totalSize int64, ...) (*stotypes.File, error)
- func UploadBlob(ctx context.Context, blobRef stotypes.BlobRef, content io.Reader, ...) error
- func WriteConfig(conf *ClientConfig) error
- func WriteConfigWithPath(conf *ClientConfig, confPath string) error
- type BlobDiscoveredListener
- type BupManifest
- type Client
- func (c *Client) Commit(ctx context.Context, collectionId string, ...) (*stotypes.Collection, error)
- func (c *Client) Config() ClientConfig
- func (c *Client) DownloadOneFile(ctx context.Context, collectionId string, file stotypes.File, ...) error
- func (c *Client) FetchCollectionMetadata(ctx context.Context, id string) (*stotypes.Collection, error)
- type ClientConfig
- type UploadProgressListener
Constants ¶
View Source
const (
BackgroundUploaderConcurrency = 3
)
View Source
const (
LocalStatefile = ".varasto"
)
Variables ¶
This section is empty.
Functions ¶
func BlobIdxFromOffset ¶
func ConfigFilePath ¶
returns ~/.config/varasto/varastoclient-config.json
func DownloadChunk ¶
func DownloadChunk(ctx context.Context, ref stotypes.BlobRef, collectionId string, clientConfig ClientConfig) (io.Reader, func(), error)
verifies chunk integrity on-the-fly
func Entrypoints ¶
func NewBackgroundUploader ¶
func NewBackgroundUploader( ctx context.Context, n int, clientConfig ClientConfig, uploadProgress UploadProgressListener, ) *backgroundUploader
func NewBlobDiscoveredAttrs ¶
func NewWorkdirLocation ¶
func ScanAndDiscoverBlobs ¶
func ScanAndDiscoverBlobs( ctx context.Context, relativePath string, file io.Reader, totalSize int64, creationTime time.Time, modifiedTime time.Time, collectionId string, bdl BlobDiscoveredListener, ) (*stotypes.File, error)
- for when you don't have a file, but you have a stream - totalsize is used for progress calculation, but if you're not using progress UI you can set it to 0
func UploadBlob ¶
func WriteConfig ¶
func WriteConfig(conf *ClientConfig) error
func WriteConfigWithPath ¶
func WriteConfigWithPath(conf *ClientConfig, confPath string) error
used by bootstrap
Types ¶
type BlobDiscoveredListener ¶
type BlobDiscoveredListener interface { BlobDiscovered(blobDiscoveredAttrs) // listener (like backgroundUploader) will inform its producer (blob discoverer) that // uploads are erroring, to request that blob discovery should be stopped CancelCh() chan interface{} }
func NewBlobDiscoveredNoopListener ¶
func NewBlobDiscoveredNoopListener() BlobDiscoveredListener
new blob? didn't do nuffin
type BupManifest ¶
type BupManifest struct { ChangesetId string `json:"changeset_id"` Collection stotypes.Collection `json:"collection"` // snapshot at time of server fetch }
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func New ¶
func New(conf ClientConfig) *Client
func (*Client) Commit ¶
func (c *Client) Commit( ctx context.Context, collectionId string, changeset stotypes.CollectionChangeset, ) (*stotypes.Collection, error)
func (*Client) Config ¶
func (c *Client) Config() ClientConfig
func (*Client) DownloadOneFile ¶
func (*Client) FetchCollectionMetadata ¶
func (c *Client) FetchCollectionMetadata( ctx context.Context, id string, ) (*stotypes.Collection, error)
if collection doesn't exist: os.IsNotExist(err) will return true
type ClientConfig ¶
type ClientConfig struct { ServerAddr string `json:"server_addr"` // example: "https://localhost" AuthToken string `json:"auth_token"` FuseMountPath string `json:"fuse_mount_path"` TlsInsecureSkipValidation bool `json:"tls_insecure_skip_validation"` }
func ReadConfig ¶
func ReadConfig() (*ClientConfig, error)
func (*ClientConfig) Client ¶
func (c *ClientConfig) Client() *Client
TODO: this should be temporary
func (*ClientConfig) CommandClient ¶
func (c *ClientConfig) CommandClient() *httpcommandclient.Client
func (*ClientConfig) HttpClient ¶
func (c *ClientConfig) HttpClient() *http.Client
func (*ClientConfig) UrlBuilder ¶
func (c *ClientConfig) UrlBuilder() *stoservertypes.RestClientUrlBuilder
type UploadProgressListener ¶
type UploadProgressListener interface { ReportUploadProgress(fileProgressEvent) // it is not safe to call ReportUploadProgress after calling Close. // returns only after resources (like termbox) used by listener are freed. Close() }
func NewNullUploadProgressListener ¶
func NewNullUploadProgressListener() UploadProgressListener
Click to show internal directories.
Click to hide internal directories.