varasto: github.com/function61/varasto/pkg/stoclient Index | Files

package stoclient

import "github.com/function61/varasto/pkg/stoclient"

Client for accessing Varasto server

Index

Package Files

adopt.go backgrounduploader.go bulkuploadscript.go clone.go config.go entrypoints.go localstate.go push.go rm.go uploadprogessui.go utils.go

Constants

const (
    BackgroundUploaderConcurrency = 3
)

func BlobIdxFromOffset Uses

func BlobIdxFromOffset(offset int64) (int, int64)

func Commit Uses

func Commit(
    changeset stotypes.CollectionChangeset,
    collectionId string,
    clientConfig ClientConfig,
) (*stotypes.Collection, error)

func ConfigFilePath Uses

func ConfigFilePath() (string, error)

func DownloadChunk Uses

func DownloadChunk(ctx context.Context, ref stotypes.BlobRef, collectionId string, clientConfig ClientConfig) (io.Reader, func(), error)

verifies chunk integrity on-the-fly

func DownloadOneFile Uses

func DownloadOneFile(
    ctx context.Context,
    file stotypes.File,
    collectionId string,
    destination io.Writer,
    config ClientConfig,
) error

func Entrypoints Uses

func Entrypoints() []*cobra.Command

func FetchCollectionMetadata Uses

func FetchCollectionMetadata(clientConfig ClientConfig, id string) (*stotypes.Collection, error)

func NewBackgroundUploader Uses

func NewBackgroundUploader(
    ctx context.Context,
    n int,
    clientConfig ClientConfig,
    uploadProgress UploadProgressListener,
) *backgroundUploader

func NewBlobDiscoveredAttrs Uses

func NewBlobDiscoveredAttrs(
    ref stotypes.BlobRef,
    collectionId string,
    content []byte,
    maybeCompressible bool,
    filePath string,
    size int64,
) blobDiscoveredAttrs

func NewWorkdirLocation Uses

func NewWorkdirLocation(path string) (*workdirLocation, error)

func ScanAndDiscoverBlobs Uses

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 Uses

func UploadBlob(
    ctx context.Context,
    blobRef stotypes.BlobRef,
    content io.Reader,
    collectionId string,
    maybeCompressible bool,
    clientConfig ClientConfig,
) error

func WriteConfig Uses

func WriteConfig(conf *ClientConfig) error

func WriteConfigWithPath Uses

func WriteConfigWithPath(conf *ClientConfig, confPath string) error

used by bootstrap

type BlobDiscoveredListener Uses

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 Uses

func NewBlobDiscoveredNoopListener() BlobDiscoveredListener

new blob? didn't do nuffin

type BupManifest Uses

type BupManifest struct {
    ChangesetId string              `json:"changeset_id"`
    Collection  stotypes.Collection `json:"collection"` // snapshot at time of server fetch
}

type ClientConfig Uses

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 Uses

func ReadConfig() (*ClientConfig, error)

func (*ClientConfig) CommandClient Uses

func (c *ClientConfig) CommandClient() *httpcommandclient.Client

func (*ClientConfig) HttpClient Uses

func (c *ClientConfig) HttpClient() *http.Client

func (*ClientConfig) UrlBuilder Uses

func (c *ClientConfig) UrlBuilder() *stoservertypes.RestClientUrlBuilder

type UploadProgressListener Uses

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 Uses

func NewNullUploadProgressListener() UploadProgressListener

Package stoclient imports 34 packages (graph) and is imported by 3 packages. Updated 2020-11-24. Refresh now. Tools for package owners.