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

package filetable

import "github.com/cockroachdb/cockroach/pkg/storage/cloudimpl/filetable"

Index

Package Files

file_table_read_writer.go

Constants

const ChunkDefaultSize = 1024 * 1024 * 4 // 4 Mib

ChunkDefaultSize is the default size of each chunk a file will be broken into before being written to the Payload table.

func DestroyUserFileSystem Uses

func DestroyUserFileSystem(ctx context.Context, f *FileToTableSystem) error

DestroyUserFileSystem drops the user scoped tables effectively deleting the blobs and metadata of every file. The FileToTableSystem object is unusable after this method returns.

type FileToTableExecutorRows Uses

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

FileToTableExecutorRows encompasses the two formats in which the InternalFileToTableExecutor and SQLConnFileToTableExecutor output their rows.

type FileToTableSystem Uses

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

FileToTableSystem can be used to store, retrieve and delete the blobs and metadata of files, from user scoped tables. Access to these tables is restricted to the root/admin user and the user responsible for triggering table creation in the first place. All methods operate within the scope of the provided database db, as the user with the provided username.

Refer to the method headers for more details about the user scoped tables.

func NewFileToTableSystem Uses

func NewFileToTableSystem(
    ctx context.Context,
    qualifiedTableName string,
    executor FileToTableSystemExecutor,
    username string,
) (*FileToTableSystem, error)

NewFileToTableSystem returns a FileToTableSystem object. It creates the File and Payload user tables, grants the current user all read/edit privileges on the tables and revokes access of every other user and role (except root/admin).

func (*FileToTableSystem) DeleteFile Uses

func (f *FileToTableSystem) DeleteFile(ctx context.Context, filename string) error

DeleteFile deletes the blobs and metadata of filename from the user scoped tables.

func (*FileToTableSystem) FileSize Uses

func (f *FileToTableSystem) FileSize(ctx context.Context, filename string) (int64, error)

FileSize returns the size of the filename blob in bytes.

func (*FileToTableSystem) GetDatabaseAndSchema Uses

func (f *FileToTableSystem) GetDatabaseAndSchema() (string, error)

GetDatabaseAndSchema returns the database.schema of the current FileToTableSystem.

func (*FileToTableSystem) GetFQFileTableName Uses

func (f *FileToTableSystem) GetFQFileTableName() string

GetFQFileTableName returns the qualified File table name.

func (*FileToTableSystem) GetFQPayloadTableName Uses

func (f *FileToTableSystem) GetFQPayloadTableName() string

GetFQPayloadTableName returns the qualified Payload table name.

func (*FileToTableSystem) GetSimpleFileTableName Uses

func (f *FileToTableSystem) GetSimpleFileTableName(prefix string) (string, error)

GetSimpleFileTableName returns the non-qualified File table name.

func (*FileToTableSystem) GetSimplePayloadTableName Uses

func (f *FileToTableSystem) GetSimplePayloadTableName(prefix string) (string, error)

GetSimplePayloadTableName returns the non-qualified Payload table name.

func (*FileToTableSystem) GetTableName Uses

func (f *FileToTableSystem) GetTableName() (string, error)

GetTableName returns the table name from the passed FQN.

func (*FileToTableSystem) ListFiles Uses

func (f *FileToTableSystem) ListFiles(ctx context.Context, pattern string) ([]string, error)

ListFiles returns a list of all the files which are currently stored in the user scoped tables.

func (*FileToTableSystem) NewFileWriter Uses

func (f *FileToTableSystem) NewFileWriter(
    ctx context.Context, filename string, chunkSize int,
) (io.WriteCloser, error)

NewFileWriter returns a io.WriteCloser which can be used to write files to the user File and Payload tables. The io.WriteCloser must be closed to flush the last chunk and commit the txn within which all writes occur.

func (*FileToTableSystem) ReadFile Uses

func (f *FileToTableSystem) ReadFile(ctx context.Context, filename string) (io.ReadCloser, error)

ReadFile returns the blob for filename using a FileTableReader. TODO(adityamaru): Reading currently involves aggregating all chunks of a file from the Payload table. In the future we might want to implement a pull x rows system, or a scan based interface.

type FileToTableSystemExecutor Uses

type FileToTableSystemExecutor interface {
    Query(ctx context.Context, opName, query, username string,
        qargs ...interface{}) (*FileToTableExecutorRows, error)
    Exec(ctx context.Context, opName, query, username string,
        qargs ...interface{}) error
}

FileToTableSystemExecutor is the interface which defines the methods for the SQL query executor used by the FileToTableSystem

type InternalFileToTableExecutor Uses

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

InternalFileToTableExecutor is the SQL query executor which uses an internal SQL connection to interact with the database.

func MakeInternalFileToTableExecutor Uses

func MakeInternalFileToTableExecutor(
    ie *sql.InternalExecutor, db *kv.DB,
) *InternalFileToTableExecutor

MakeInternalFileToTableExecutor returns an instance of a InternalFileToTableExecutor.

func (*InternalFileToTableExecutor) Exec Uses

func (i *InternalFileToTableExecutor) Exec(
    ctx context.Context, opName, query, username string, qargs ...interface{},
) error

Exec implements the FileToTableSystemExecutor interface.

func (*InternalFileToTableExecutor) Query Uses

func (i *InternalFileToTableExecutor) Query(
    ctx context.Context, opName, query, username string, qargs ...interface{},
) (*FileToTableExecutorRows, error)

Query implements the FileToTableSystemExecutor interface.

type SQLConnFileToTableExecutor Uses

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

SQLConnFileToTableExecutor is the SQL query executor which uses a network backed SQL connection to interact with the database.

func MakeSQLConnFileToTableExecutor Uses

func MakeSQLConnFileToTableExecutor(executor cloud.SQLConnI) *SQLConnFileToTableExecutor

MakeSQLConnFileToTableExecutor returns an instance of a SQLConnFileToTableExecutor.

func (*SQLConnFileToTableExecutor) Exec Uses

func (i *SQLConnFileToTableExecutor) Exec(
    ctx context.Context, _, query, _ string, qargs ...interface{},
) error

Exec implements the FileToTableSystemExecutor interface.

func (*SQLConnFileToTableExecutor) Query Uses

func (i *SQLConnFileToTableExecutor) Query(
    ctx context.Context, _, query, _ string, qargs ...interface{},
) (*FileToTableExecutorRows, error)

Query implements the FileToTableSystemExecutor interface.

Package filetable imports 15 packages (graph) and is imported by 1 packages. Updated 2020-09-25. Refresh now. Tools for package owners.