dbfactory

package
v0.40.4 Latest Latest
Warning

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

Go to latest
Published: May 19, 2022 License: Apache-2.0 Imports: 25 Imported by: 2

Documentation

Index

Constants

View Source
const (
	// AWSRegionParam is a creation parameter that can be used to set the AWS region
	AWSRegionParam = "aws-region"

	// AWSCredsTypeParam is a creation parameter that can be used to set the type of credentials that should be used.
	// valid values are role, env, auto, and file
	AWSCredsTypeParam = "aws-creds-type"

	// AWSCredsFileParam is a creation parameter that can be used to specify a credential file to use.
	AWSCredsFileParam = "aws-creds-file"

	//AWSCredsProfile is a creation parameter that can be used to specify which AWS profile to use.
	AWSCredsProfile = "aws-creds-profile"
)
View Source
const (
	// AWSScheme
	AWSScheme = "aws"

	// GSScheme
	GSScheme = "gs"

	// FileScheme
	FileScheme = "file"

	// MemScheme
	MemScheme = "mem"

	// HTTPSScheme
	HTTPSScheme = "https"

	// HTTPScheme
	HTTPScheme = "http"

	// InMemBlobstore Scheme
	LocalBSScheme = "localbs"
)
View Source
const (
	// DoltDir defines the directory used to hold the dolt repo data within the filesys
	DoltDir = ".dolt"

	// DataDir is the directory internal to the DoltDir which holds the noms files.
	DataDir = "noms"
)

Variables

View Source
var AWSCredTypes = []string{RoleCS.String(), EnvCS.String(), FileCS.String()}

DBFactories is a map from url scheme name to DBFactory. Additional factories can be added to the DBFactories map from external packages.

View Source
var DoltDataDir = filepath.Join(DoltDir, DataDir)

DoltDataDir is the directory where noms files will be stored

View Source
var GRPCDialProviderParam = "__DOLT__grpc_dial_provider"
View Source
var NoCachingParameter = "__dolt__NO_CACHING"

Functions

func CreateDB

func CreateDB(ctx context.Context, nbf *types.NomsBinFormat, urlStr string, params map[string]interface{}) (datas.Database, types.ValueReadWriter, error)

CreateDB creates a database based on the supplied urlStr, and creation params. The DBFactory used for creation is determined by the scheme of the url. Naked urls will use https by default.

Types

type AWSCredentialSource

type AWSCredentialSource int

AWSCredentialSource is an enum type representing the different credential sources (auto, role, env, file, or invalid)

const (
	InvalidCS AWSCredentialSource = iota - 1

	// Auto will try env first and fall back to role (This is the default)
	AutoCS

	// Role Uses the AWS IAM role of the instance for auth
	RoleCS

	// Env uses the credentials stored in the environment variables AWS_ACCESS_KEY_ID, and AWS_SECRET_ACCESS_KEY
	EnvCS

	// Uses credentials stored in a file
	FileCS
)

func AWSCredentialSourceFromStr

func AWSCredentialSourceFromStr(str string) AWSCredentialSource

AWSCredentialSourceFromStr converts a string to an AWSCredentialSource

func (AWSCredentialSource) String

func (ct AWSCredentialSource) String() string

String returns the string representation of the of an AWSCredentialSource

type AWSFactory

type AWSFactory struct {
}

AWSFactory is a DBFactory implementation for creating AWS backed databases

func (AWSFactory) CreateDB

func (fact AWSFactory) CreateDB(ctx context.Context, nbf *types.NomsBinFormat, urlObj *url.URL, params map[string]interface{}) (datas.Database, types.ValueReadWriter, error)

CreateDB creates an AWS backed database

type DBFactory

type DBFactory interface {
	CreateDB(ctx context.Context, nbf *types.NomsBinFormat, urlObj *url.URL, params map[string]interface{}) (datas.Database, types.ValueReadWriter, error)
}

DBFactory is an interface for creating concrete datas.Database instances which may have different backing stores.

type DoltRemoteFactory

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

DoldRemoteFactory is a DBFactory implementation for creating databases backed by a remote server that implements the GRPC rpcs defined by remoteapis.ChunkStoreServiceClient

func NewDoltRemoteFactory

func NewDoltRemoteFactory(insecure bool) DoltRemoteFactory

NewDoltRemoteFactory creates a DoltRemoteFactory instance using the given GRPCConnectionProvider, and insecure setting

func (DoltRemoteFactory) CreateDB

func (fact DoltRemoteFactory) CreateDB(ctx context.Context, nbf *types.NomsBinFormat, urlObj *url.URL, params map[string]interface{}) (datas.Database, types.ValueReadWriter, error)

CreateDB creates a database backed by a remote server that implements the GRPC rpcs defined by remoteapis.ChunkStoreServiceClient

type FileFactory

type FileFactory struct {
}

FileFactory is a DBFactory implementation for creating local filesys backed databases

func (FileFactory) CreateDB

func (fact FileFactory) CreateDB(ctx context.Context, nbf *types.NomsBinFormat, urlObj *url.URL, params map[string]interface{}) (datas.Database, types.ValueReadWriter, error)

CreateDB creates an local filesys backed database

type GRPCDialProvider

type GRPCDialProvider interface {
	GetGRPCDialParams(grpcendpoint.Config) (string, []grpc.DialOption, error)
}

GRPCDialProvider is an interface for getting a *grpc.ClientConn.

type GSFactory

type GSFactory struct {
}

GSFactory is a DBFactory implementation for creating GCS backed databases

func (GSFactory) CreateDB

func (fact GSFactory) CreateDB(ctx context.Context, nbf *types.NomsBinFormat, urlObj *url.URL, params map[string]interface{}) (datas.Database, types.ValueReadWriter, error)

CreateDB creates an GCS backed database

type LocalBSFactory

type LocalBSFactory struct {
}

LocalBSFactory is a DBFactory implementation for creating a local filesystem blobstore backed databases for testing

func (LocalBSFactory) CreateDB

func (fact LocalBSFactory) CreateDB(ctx context.Context, nbf *types.NomsBinFormat, urlObj *url.URL, params map[string]interface{}) (datas.Database, types.ValueReadWriter, error)

CreateDB creates a local filesystem blobstore backed database

type MemFactory

type MemFactory struct {
}

MemFactory is a DBFactory implementation for creating in memory backed databases

func (MemFactory) CreateDB

func (fact MemFactory) CreateDB(ctx context.Context, nbf *types.NomsBinFormat, urlObj *url.URL, params map[string]interface{}) (datas.Database, types.ValueReadWriter, error)

CreateDB creates an in memory backed database

Jump to

Keyboard shortcuts

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