cockroach: github.com/cockroachdb/cockroach/pkg/storage/cloud Index | Files

package cloud

import "github.com/cockroachdb/cockroach/pkg/storage/cloud"

Index

Package Files

external_storage.go kms.go

func RegisterKMSFromURIFactory Uses

func RegisterKMSFromURIFactory(factory KMSFromURIFactory, scheme string)

RegisterKMSFromURIFactory is used by every concrete KMS implementation to register its factory method.

type ExternalStorage Uses

type ExternalStorage interface {
    io.Closer

    // Conf should return the serializable configuration required to reconstruct
    // this ExternalStorage implementation.
    Conf() roachpb.ExternalStorage

    // ExternalIOConf should return the configuration containing several server
    // configured options pertaining to an ExternalStorage implementation.
    ExternalIOConf() base.ExternalIODirConfig

    // Settings should return the cluster settings used to configure the
    // ExternalStorage implementation.
    Settings() *cluster.Settings

    // ReadFile should return a Reader for requested name.
    // ErrFileDoesNotExist is raised if `basename` cannot be located in storage.
    // This can be leveraged for an existence check.
    ReadFile(ctx context.Context, basename string) (io.ReadCloser, error)

    // WriteFile should write the content to requested name.
    WriteFile(ctx context.Context, basename string, content io.ReadSeeker) error

    // ListFiles returns files that match a globs-style pattern. The returned
    // results are usually relative to the base path, meaning an ExternalStorage
    // instance can be initialized with some base path, used to query for files,
    // then pass those results to its other methods.
    //
    // As a special-case, if the passed patternSuffix is empty, the base path used
    // to initialize the storage connection is treated as a pattern. In this case,
    // as the connection is not really reusable for interacting with other files
    // and there is no clear definition of what it would mean to be relative to
    // that, the results are fully-qualified absolute URIs. The base URI is *only*
    // allowed to contain globs-patterns when the explicit patternSuffix is "".
    ListFiles(ctx context.Context, patternSuffix string) ([]string, error)

    // Delete removes the named file from the store.
    Delete(ctx context.Context, basename string) error

    // Size returns the length of the named file in bytes.
    Size(ctx context.Context, basename string) (int64, error)
}

ExternalStorage provides an API to read and write files in some storage, namely various cloud storage providers, for example to store backups. Generally an implementation is instantiated pointing to some base path or prefix and then gets and puts files using the various methods to interact with individual files contained within that path or prefix. However, implementations must also allow callers to provide the full path to a given file as the "base" path, and then read or write it with the methods below by simply passing an empty filename. Implementations that use stdlib's `filepath.Join` to concatenate their base path with the provided filename will find its semantics well suited to this -- it elides empty components and does not append surplus slashes.

type ExternalStorageFactory Uses

type ExternalStorageFactory func(ctx context.Context, dest roachpb.ExternalStorage) (ExternalStorage, error)

ExternalStorageFactory describes a factory function for ExternalStorage.

type ExternalStorageFromURIFactory Uses

type ExternalStorageFromURIFactory func(ctx context.Context, uri string,
    user string) (ExternalStorage, error)

ExternalStorageFromURIFactory describes a factory function for ExternalStorage given a URI.

type KMS Uses

type KMS interface {
    // MasterKeyID will return the identifier used to reference the master key
    // associated with the KMS object.
    MasterKeyID() (string, error)
    // Encrypt returns the ciphertext version of data after encrypting it using
    // the KMS.
    Encrypt(ctx context.Context, data []byte) ([]byte, error)
    // Decrypt returns the plaintext version of data after decrypting it using the
    // KMS.
    Decrypt(ctx context.Context, data []byte) ([]byte, error)
    // Close may be used to perform the necessary cleanup and shutdown of the
    // KMS connection.
    Close() error
}

KMS provides an API to interact with a KMS service.

func KMSFromURI Uses

func KMSFromURI(uri string, env KMSEnv) (KMS, error)

KMSFromURI is the method used to create a KMS instance from the provided URI.

type KMSEnv Uses

type KMSEnv interface {
    ClusterSettings() *cluster.Settings
    KMSConfig() *base.ExternalIODirConfig
}

KMSEnv is the environment in which a KMS is configured and used.

type KMSFromURIFactory Uses

type KMSFromURIFactory func(uri string, env KMSEnv) (KMS, error)

KMSFromURIFactory describes a factory function for KMS given a URI.

type SQLConnI Uses

type SQLConnI interface {
    driver.QueryerContext
    driver.ExecerContext
}

SQLConnI encapsulates the interfaces which will be implemented by the network backed SQLConn which is used to interact with the userfile tables.

Package cloud imports 8 packages (graph) and is imported by 35 packages. Updated 2020-08-12. Refresh now. Tools for package owners.