doltswarm

package module
v0.0.0-...-73074a3 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2024 License: MIT Imports: 42 Imported by: 2

README

doltswarm

Documentation

Index

Constants

View Source
const (
	MaxFetchSize           = 128 * 1024 * 1024
	HedgeDownloadSizeLimit = 4 * 1024 * 1024
)
View Source
const (
	ExternalHeadEvent = "new_head"
)
View Source
const (
	FactorySwarm = "swarm"
)
View Source
const RepoPathField = "repo_path"

Variables

View Source
var ErrUnimplemented = errors.New("unimplemented")

Functions

func ValidateAddTableFilesRequest

func ValidateAddTableFilesRequest(req *remotesapi.AddTableFilesRequest) error

func ValidateCommitRequest

func ValidateCommitRequest(req *remotesapi.CommitRequest) error

func ValidateGetDownloadLocsRequest

func ValidateGetDownloadLocsRequest(req *remotesapi.GetDownloadLocsRequest) error

func ValidateGetRepoMetadataRequest

func ValidateGetRepoMetadataRequest(req *remotesapi.GetRepoMetadataRequest) error

func ValidateGetUploadLocsRequest

func ValidateGetUploadLocsRequest(req *remotesapi.GetUploadLocsRequest) error

func ValidateHasChunksRequest

func ValidateHasChunksRequest(req *remotesapi.HasChunksRequest) error

func ValidateListTableFilesRequest

func ValidateListTableFilesRequest(req *remotesapi.ListTableFilesRequest) error

func ValidateRebaseRequest

func ValidateRebaseRequest(req *remotesapi.RebaseRequest) error

func ValidateRefreshTableFileUrlRequest

func ValidateRefreshTableFileUrlRequest(req *remotesapi.RefreshTableFileUrlRequest) error

func ValidateRootRequest

func ValidateRootRequest(req *remotesapi.RootRequest) error

Types

type ClientRetriever

type ClientRetriever interface {
	GetClient(peerID string) (*DBClient, error)
}

type Commit

type Commit struct {
	Hash      string
	Committer string
	Email     string
	Date      time.Time
	Message   string
}

type ConcurrencyParams

type ConcurrencyParams struct {
	ConcurrentSmallFetches int
	ConcurrentLargeFetches int
	LargeFetchSize         int
}

type DB

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

func Open

func Open(dir string, name string, logger *logrus.Entry, signer Signer) (*DB, error)

func (*DB) AddPeer

func (db *DB) AddPeer(peerID string, conn *grpc.ClientConn) error

func (*DB) AdvertiseHead

func (db *DB) AdvertiseHead()

func (*DB) BeginTx

func (db *DB) BeginTx(ctx context.Context, opts *sql.TxOptions) (*sql.Tx, error)

func (*DB) CheckIfCommitPresent

func (db *DB) CheckIfCommitPresent(commitHash string) (bool, error)

func (*DB) Close

func (db *DB) Close() error

func (*DB) Commit

func (db *DB) Commit(commitMsg string) (string, error)

Commit

func (*DB) DatabaseExists

func (db *DB) DatabaseExists(name string) (bool, error)

func (*DB) EnableGRPCServers

func (db *DB) EnableGRPCServers(server *grpc.Server) error

func (*DB) ExecAndCommit

func (db *DB) ExecAndCommit(execFunc ExecFunc, commitMsg string) (string, error)

func (*DB) ExecContext

func (db *DB) ExecContext(ctx context.Context, query string, args ...any) (sql.Result, error)

func (*DB) GetAllCommits

func (db *DB) GetAllCommits() ([]Commit, error)

func (*DB) GetChunkStore

func (db *DB) GetChunkStore() (chunks.ChunkStore, error)

func (*DB) GetClient

func (db *DB) GetClient(peerID string) (*DBClient, error)

func (*DB) GetClients

func (db *DB) GetClients() map[string]*DBClient

func (*DB) GetFilePath

func (db *DB) GetFilePath() string

func (*DB) GetFirstCommit

func (db *DB) GetFirstCommit() (Commit, error)

func (*DB) GetLastCommit

func (db *DB) GetLastCommit(branch string) (Commit, error)

func (*DB) GetRemote

func (db *DB) GetRemote(name string) (Remote, error)

func (*DB) GetSqlDB

func (db *DB) GetSqlDB() *sql.DB

func (*DB) InitFromPeer

func (db *DB) InitFromPeer(peerID string) error

func (*DB) InitLocal

func (db *DB) InitLocal() error

func (*DB) Initialized

func (db *DB) Initialized() bool

func (*DB) Merge

func (db *DB) Merge(peerID string) error

func (*DB) PrepareContext

func (db *DB) PrepareContext(ctx context.Context, query string) (*sql.Stmt, error)

func (*DB) Pull

func (db *DB) Pull(peerID string) error

func (*DB) QueryContext

func (db *DB) QueryContext(ctx context.Context, query string, args ...any) (*sql.Rows, error)

func (*DB) RegisterTableChangeCallback

func (db *DB) RegisterTableChangeCallback(tableName string, n Notifier)

func (*DB) RemovePeer

func (db *DB) RemovePeer(peerID string) error

func (*DB) RequestHeadFromAllPeers

func (db *DB) RequestHeadFromAllPeers()

func (*DB) RequestHeadFromPeer

func (db *DB) RequestHeadFromPeer(peerID string) error

func (*DB) VerifySignatures

func (db *DB) VerifySignatures(peerID string) error

type DBCache

type DBCache interface {
	Get() (remotesrv.RemoteSrvStore, error)
}

type DBClient

type DBClient struct {
	proto.DBSyncerClient
	remotesapi.ChunkStoreServiceClient
	proto.DownloaderClient
	// contains filtered or unexported fields
}

func (DBClient) GetID

func (c DBClient) GetID() string

type Database

type Database struct {
	Name string
}

type DoltMREnvRetriever

type DoltMREnvRetriever interface {
	GetMultiRepoEnv() *env.MultiRepoEnv
}

type DoltSwarmFactory

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

func NewDoltSwarmFactory

func NewDoltSwarmFactory(dbName string, clientRetriever ClientRetriever, logger *logrus.Entry) DoltSwarmFactory

func (DoltSwarmFactory) CreateDB

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

func (DoltSwarmFactory) PrepareDB

func (fact DoltSwarmFactory) PrepareDB(ctx context.Context, nbf *types.NomsBinFormat, urlObj *url.URL, params map[string]interface{}) error

type Event

type Event struct {
	Peer string
	Type string
	Data interface{}
}

type ExecFunc

type ExecFunc func(*sql.Tx) error

type HTTPFetcher

type HTTPFetcher interface {
	Do(req *http.Request) (*http.Response, error)
}

type Notifier

type Notifier interface {
	Notify()
}

type Queryer

type Queryer interface {
	Query(query string, args ...interface{}) (*sql.Rows, error)
}

type Remote

type Remote struct {
	Name       string
	URL        string
	FetchSpecs string
	Params     string
}

type RemoteChunkStore

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

func NewRemoteChunkStore

func NewRemoteChunkStore(client *DBClient, peerID string, dbName string, nbfVersion string, logger *logrus.Entry) (*RemoteChunkStore, error)

func (*RemoteChunkStore) AccessMode

func (rcs *RemoteChunkStore) AccessMode() chunks.ExclusiveAccessMode

func (*RemoteChunkStore) AddTableFilesToManifest

func (rcs *RemoteChunkStore) AddTableFilesToManifest(ctx context.Context, fileIdToNumChunks map[string]int) error

func (*RemoteChunkStore) Close

func (rcs *RemoteChunkStore) Close() error

func (*RemoteChunkStore) Commit

func (rcs *RemoteChunkStore) Commit(ctx context.Context, current, last hash.Hash) (bool, error)

func (*RemoteChunkStore) Get

func (rcs *RemoteChunkStore) Get(ctx context.Context, h hash.Hash) (chunks.Chunk, error)

func (*RemoteChunkStore) GetMany

func (rcs *RemoteChunkStore) GetMany(ctx context.Context, hashes hash.HashSet, found func(context.Context, *chunks.Chunk)) error

func (*RemoteChunkStore) GetManyCompressed

func (rcs *RemoteChunkStore) GetManyCompressed(ctx context.Context, hashes hash.HashSet, found func(context.Context, nbs.CompressedChunk)) error

func (*RemoteChunkStore) Has

func (rcs *RemoteChunkStore) Has(ctx context.Context, h hash.Hash) (bool, error)

func (*RemoteChunkStore) HasMany

func (rcs *RemoteChunkStore) HasMany(ctx context.Context, hashes hash.HashSet) (hash.HashSet, error)

func (*RemoteChunkStore) PersistGhostHashes

func (rcs *RemoteChunkStore) PersistGhostHashes(ctx context.Context, refs hash.HashSet) error

func (*RemoteChunkStore) PruneTableFiles

func (rcs *RemoteChunkStore) PruneTableFiles(ctx context.Context) error

func (*RemoteChunkStore) Put

func (*RemoteChunkStore) Rebase

func (rcs *RemoteChunkStore) Rebase(ctx context.Context) error

func (*RemoteChunkStore) Root

func (rcs *RemoteChunkStore) Root(ctx context.Context) (hash.Hash, error)

func (*RemoteChunkStore) SetRootChunk

func (rcs *RemoteChunkStore) SetRootChunk(ctx context.Context, root, previous hash.Hash) error

func (*RemoteChunkStore) Size

func (rcs *RemoteChunkStore) Size(ctx context.Context) (uint64, error)

func (*RemoteChunkStore) Sources

func (*RemoteChunkStore) Stats

func (rcs *RemoteChunkStore) Stats() interface{}

func (*RemoteChunkStore) StatsSummary

func (rcs *RemoteChunkStore) StatsSummary() string

func (*RemoteChunkStore) SupportedOperations

func (rcs *RemoteChunkStore) SupportedOperations() chunks.TableFileStoreOps

func (*RemoteChunkStore) Version

func (rcs *RemoteChunkStore) Version() string

func (*RemoteChunkStore) WriteTableFile

func (rcs *RemoteChunkStore) WriteTableFile(ctx context.Context, fileId string, numChunks int, contentHash []byte, getRd func() (io.ReadCloser, uint64, error)) error

type RemoteSrvStore

type RemoteSrvStore interface {
	chunks.ChunkStore
	chunks.TableFileStore

	Path() (string, bool)
	GetChunkLocationsWithPaths(ctx context.Context, hashes hash.HashSet) (map[string]map[hash.Hash]nbs.Range, error)
}

type RemoteTableFile

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

RemoteTableFile is an implementation of a TableFile that lives in a DoltChunkStore

func (RemoteTableFile) FileID

func (rtf RemoteTableFile) FileID() string

FileID gets the id of the file

func (RemoteTableFile) LocationPrefix

func (rtf RemoteTableFile) LocationPrefix() string

LocationPrefix

func (RemoteTableFile) NumChunks

func (rtf RemoteTableFile) NumChunks() int

NumChunks returns the number of chunks in a table file

func (RemoteTableFile) Open

Open returns an io.ReadCloser which can be used to read the bytes of a table file.

type ServerChunkStore

type ServerChunkStore struct {
	remotesapi.UnimplementedChunkStoreServiceServer
	proto.UnimplementedDownloaderServer
	// contains filtered or unexported fields
}

func NewServerChunkStore

func NewServerChunkStore(logger *logrus.Entry, csCache DBCache, filePath string) *ServerChunkStore

func (*ServerChunkStore) AddTableFiles

AddTableFiles updates the remote manifest with new table files without modifying the root hash.

func (*ServerChunkStore) Commit

func (*ServerChunkStore) DownloadChunks

func (*ServerChunkStore) DownloadFile

func (*ServerChunkStore) GetDownloadLocations

func (*ServerChunkStore) GetRepoMetadata

func (*ServerChunkStore) GetUploadLocations

func (*ServerChunkStore) HasChunks

func (*ServerChunkStore) ListTableFiles

func (*ServerChunkStore) Rebase

func (*ServerChunkStore) Root

func (*ServerChunkStore) StreamDownloadLocations

type ServerSyncer

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

func NewServerSyncer

func NewServerSyncer(logger *logrus.Entry, db *DB) *ServerSyncer

func (*ServerSyncer) AdvertiseHead

func (*ServerSyncer) RequestHead

type Signer

type Signer interface {
	Sign(commit string) (string, error)
	Verify(commit string, signature string, publicKey string) error
	PublicKey() string
	GetID() string
}

type SingletonCSCache

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

func (SingletonCSCache) Get

type TAG

type TAG struct {
	sq.TableStruct `sq:"dolt_tags"`
	TAG_NAME       sq.StringField
	TAG_HASH       sq.StringField
	TAGGER         sq.StringField
	EMAIL          sq.StringField
	DATE           sq.TimeField
	MESSAGE        sq.StringField
}

type Tag

type Tag struct {
	Name    string
	Hash    string
	Tagger  string
	Email   string
	Date    time.Time
	Message string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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