database

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2024 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BlockSyncerDBBuilder

func BlockSyncerDBBuilder(ctx *database.Context) (database.Database, error)

BlockSyncerDBBuilder allows to create a new DB instance implementing the db.Builder type

Types

type DB

type DB struct {
	*mysql.Database
}

DB represents a SQL database with expanded features. so that it can properly store custom BigDipper-related data.

func Cast

func Cast(db database.Database) *DB

Cast allows to cast the given db to a DB instance

func (*DB) AutoMigrate added in v0.2.3

func (db *DB) AutoMigrate(ctx context.Context, tables []schema.Tabler) error

func (*DB) BatchDeleteGroupMemberToSQL added in v1.0.1

func (db *DB) BatchDeleteGroupMemberToSQL(ctx context.Context, group *models.Group, groupID common.Hash, accountIDs []common.Address) (string, []interface{})

func (*DB) BatchDeletePrefixTreeNodeByBucketAndPathAndFullName added in v1.2.0

func (db *DB) BatchDeletePrefixTreeNodeByBucketAndPathAndFullName(ctx context.Context, prefixTree []*bsdb.SlashPrefixTreeNode) error

func (*DB) BatchDeletePrefixTreeNodeByID added in v1.2.0

func (db *DB) BatchDeletePrefixTreeNodeByID(ctx context.Context, prefixTree []*bsdb.SlashPrefixTreeNode) error

func (*DB) BatchUpdateBucketSize added in v1.1.0

func (db *DB) BatchUpdateBucketSize(ctx context.Context, buckets []*models.Bucket) error

func (*DB) CreateGroup added in v0.2.3

func (db *DB) CreateGroup(ctx context.Context, groupMembers []*models.Group) error

func (*DB) CreateGroupToSQL added in v0.2.3

func (db *DB) CreateGroupToSQL(ctx context.Context, groupMembers []*models.Group) (string, []interface{})

func (*DB) CreateObjectIDMap added in v0.2.3

func (db *DB) CreateObjectIDMap(ctx context.Context, objectIDMap *bsdb.ObjectIDMap) (string, []interface{})

CreateObjectIDMap create object id map table entry

func (*DB) CreatePrefixTree

func (db *DB) CreatePrefixTree(ctx context.Context, prefixTree []*bsdb.SlashPrefixTreeNode) (string, []interface{})

CreatePrefixTree create prefix tree nodes by input slice

func (*DB) CreateStorageProvider added in v0.2.3

func (db *DB) CreateStorageProvider(ctx context.Context, storageProvider *models.StorageProvider) error

func (*DB) CreateStorageProviderToSQL added in v0.2.3

func (db *DB) CreateStorageProviderToSQL(ctx context.Context, storageProvider *models.StorageProvider) (string, []interface{})

func (*DB) DeleteBlockResult added in v1.8.0

func (db *DB) DeleteBlockResult(ctx context.Context, blockHeight int64) error

func (*DB) DeleteGVGToSQL added in v1.5.0

func (db *DB) DeleteGVGToSQL(ctx context.Context, gvg *models.GlobalVirtualGroup) (string, []interface{})

func (*DB) DeleteGroupToSQL added in v0.2.4

func (db *DB) DeleteGroupToSQL(ctx context.Context, group *models.Group) (string, []interface{})

func (*DB) DeleteLVGToSQL added in v1.5.0

func (db *DB) DeleteLVGToSQL(ctx context.Context, lvg *models.LocalVirtualGroup) (string, []interface{})

func (*DB) DeletePrefixTree

func (db *DB) DeletePrefixTree(ctx context.Context, prefixTree []*bsdb.SlashPrefixTreeNode) (string, []interface{})

DeletePrefixTree delete prefix tree nodes by given conditions

func (*DB) GetBucketByBucketName added in v1.6.0

func (db *DB) GetBucketByBucketName(ctx context.Context, bucketName string) (*models.Bucket, error)

GetBucketByBucketName get bucket by bucket name

func (*DB) GetBucketNameByObjectID added in v0.2.3

func (b *DB) GetBucketNameByObjectID(objectID common.Hash) (string, error)

GetBucketNameByObjectID get bucket name info by an object id

func (*DB) GetDataMigrationRecord added in v1.1.0

func (db *DB) GetDataMigrationRecord(ctx context.Context, processKey string) (*bsdb.DataMigrationRecord, error)

func (*DB) GetMasterDB

func (db *DB) GetMasterDB(ctx context.Context) (*bsdb.MasterDB, error)

GetMasterDB get master db info

func (*DB) GetObject added in v0.2.3

func (db *DB) GetObject(ctx context.Context, objectId common.Hash) (*models.Object, error)

func (*DB) GetObjectCount added in v1.8.0

func (db *DB) GetObjectCount(needSeal bool, blockHeight int64) ([]int64, error)

func (*DB) GetPrefixTree

func (db *DB) GetPrefixTree(ctx context.Context, fullName, bucketName string) (*bsdb.SlashPrefixTreeNode, error)

GetPrefixTree get prefix tree node by full name and bucket name

func (*DB) GetPrefixTreeCount

func (db *DB) GetPrefixTreeCount(ctx context.Context, pathName, bucketName string) (int64, error)

GetPrefixTreeCount get prefix tree nodes count by path and bucket name

func (*DB) GetPrefixTreeObject

func (db *DB) GetPrefixTreeObject(ctx context.Context, objectID common.Hash, bucketName string) (*bsdb.SlashPrefixTreeNode, error)

GetPrefixTreeObject get prefix tree node object by object id

func (*DB) GetPrefixTreesByBucketAndPathName added in v1.2.0

func (db *DB) GetPrefixTreesByBucketAndPathName(ctx context.Context, bucketName, pathName string) ([]*bsdb.SlashPrefixTreeNode, error)

GetPrefixTreesByBucketAndPathName get prefix tree node by bucket name and path name

func (*DB) GetPrefixTreesByBucketAndPathNameAndFullName added in v1.2.0

func (db *DB) GetPrefixTreesByBucketAndPathNameAndFullName(ctx context.Context, bucketName, pathName, fullName string) (*bsdb.SlashPrefixTreeNode, error)

GetPrefixTreesByBucketAndPathNameAndFullName get prefix tree node by bucket name and path name and full name

func (*DB) MultiSaveStatement added in v0.2.3

func (db *DB) MultiSaveStatement(ctx context.Context, statements []*models.Statements) error

func (*DB) MultiSaveStatementToSQL added in v0.2.3

func (db *DB) MultiSaveStatementToSQL(ctx context.Context, statements []*models.Statements) (string, []interface{})

func (*DB) PrepareTables added in v0.2.3

func (db *DB) PrepareTables(ctx context.Context, tables []schema.Tabler) error

func (*DB) RemoveStatements added in v0.2.3

func (db *DB) RemoveStatements(ctx context.Context, policyID common.Hash) error

func (*DB) RemoveStatementsToSQL added in v0.2.3

func (db *DB) RemoveStatementsToSQL(ctx context.Context, policyID common.Hash) (string, []interface{})

func (*DB) SaveBlockResult added in v1.8.0

func (db *DB) SaveBlockResult(ctx context.Context, br *models.BlockResult) error

func (*DB) SaveBucket added in v0.2.3

func (db *DB) SaveBucket(ctx context.Context, bucket *models.Bucket) error

func (*DB) SaveBucketToSQL added in v0.2.3

func (db *DB) SaveBucketToSQL(ctx context.Context, bucket *models.Bucket) (string, []interface{})

func (*DB) SaveEpoch added in v0.2.3

func (db *DB) SaveEpoch(ctx context.Context, epoch *models.Epoch) error

func (*DB) SaveEpochToSQL added in v0.2.3

func (db *DB) SaveEpochToSQL(ctx context.Context, epoch *models.Epoch) (string, []interface{})

func (*DB) SaveEventCancelMigrationBucket added in v0.2.3

func (db *DB) SaveEventCancelMigrationBucket(ctx context.Context, eventCancelMigrationBucket *bsdb.EventCancelMigrationBucket) (string, []interface{})

func (*DB) SaveEventCancelSwapOut added in v0.2.3

func (db *DB) SaveEventCancelSwapOut(ctx context.Context, eventCancelSwapOut *bsdb.EventCancelSwapOut) (string, []interface{})

func (*DB) SaveEventCompleteMigrationBucket added in v0.2.3

func (db *DB) SaveEventCompleteMigrationBucket(ctx context.Context, eventCompleteMigrationBucket *bsdb.EventCompleteMigrationBucket) (string, []interface{})

func (*DB) SaveEventCompleteSwapOut added in v0.2.3

func (db *DB) SaveEventCompleteSwapOut(ctx context.Context, eventCompleteSwapOut *bsdb.EventCompleteSwapOut) (string, []interface{})

func (*DB) SaveEventMigrationBucket added in v0.2.3

func (db *DB) SaveEventMigrationBucket(ctx context.Context, eventMigrationBucket *bsdb.EventMigrationBucket) (string, []interface{})

func (*DB) SaveEventRejectMigrationBucket added in v1.1.0

func (db *DB) SaveEventRejectMigrationBucket(ctx context.Context, eventRejectMigrationBucket *bsdb.EventRejectMigrateBucket) (string, []interface{})

func (*DB) SaveEventSPCompleteExit added in v0.2.3

func (db *DB) SaveEventSPCompleteExit(ctx context.Context, eventSpCompleteExit *bsdb.EventCompleteStorageProviderExit) (string, []interface{})

func (*DB) SaveEventSPExit added in v0.2.3

func (db *DB) SaveEventSPExit(ctx context.Context, eventSPExit *bsdb.EventStorageProviderExit) (string, []interface{})

func (*DB) SaveEventSwapOut added in v0.2.3

func (db *DB) SaveEventSwapOut(ctx context.Context, eventSwapOut *bsdb.EventSwapOut) (string, []interface{})

func (*DB) SaveGVG added in v0.2.3

func (db *DB) SaveGVG(ctx context.Context, gvg *models.GlobalVirtualGroup) error

func (*DB) SaveGVGToSQL added in v0.2.3

func (db *DB) SaveGVGToSQL(ctx context.Context, gvg *models.GlobalVirtualGroup) (string, []interface{})

func (*DB) SaveLVG added in v0.2.3

func (db *DB) SaveLVG(ctx context.Context, lvg *models.LocalVirtualGroup) error

func (*DB) SaveLVGToSQL added in v0.2.3

func (db *DB) SaveLVGToSQL(ctx context.Context, lvg *models.LocalVirtualGroup) (string, []interface{})

func (*DB) SaveObject added in v0.2.3

func (db *DB) SaveObject(ctx context.Context, object *models.Object) error

func (*DB) SaveObjectToSQL added in v0.2.3

func (db *DB) SaveObjectToSQL(ctx context.Context, object *models.Object) (string, []interface{})

func (*DB) SavePaymentAccount added in v0.2.3

func (db *DB) SavePaymentAccount(ctx context.Context, paymentAccount *models.PaymentAccount) error

func (*DB) SavePaymentAccountToSQL added in v0.2.3

func (db *DB) SavePaymentAccountToSQL(ctx context.Context, paymentAccount *models.PaymentAccount) (string, []interface{})

func (*DB) SavePermission added in v0.2.3

func (db *DB) SavePermission(ctx context.Context, permission *models.Permission) error

func (*DB) SavePermissionToSQL added in v0.2.3

func (db *DB) SavePermissionToSQL(ctx context.Context, permission *models.Permission) (string, []interface{})

func (*DB) SaveStat added in v1.8.0

func (db *DB) SaveStat(ctx context.Context, stat *models.DataStat) error

func (*DB) SaveStreamRecord added in v0.2.3

func (db *DB) SaveStreamRecord(ctx context.Context, streamRecord *models.StreamRecord) error

func (*DB) SaveStreamRecordToSQL added in v0.2.3

func (db *DB) SaveStreamRecordToSQL(ctx context.Context, streamRecord *models.StreamRecord) (string, []interface{})

func (*DB) SaveVGF added in v0.2.3

func (db *DB) SaveVGF(ctx context.Context, vgf *models.GlobalVirtualGroupFamily) error

func (*DB) SaveVGFToSQL added in v0.2.3

func (db *DB) SaveVGFToSQL(ctx context.Context, vgf *models.GlobalVirtualGroupFamily) (string, []interface{})

func (*DB) SetMasterDB

func (db *DB) SetMasterDB(ctx context.Context, masterDB *bsdb.MasterDB) error

SetMasterDB set the master db

func (*DB) UpdateBucket added in v0.2.3

func (db *DB) UpdateBucket(ctx context.Context, bucket *models.Bucket) error

func (*DB) UpdateBucketByNameToSQL added in v1.2.0

func (db *DB) UpdateBucketByNameToSQL(ctx context.Context, bucket *models.Bucket) (string, []interface{})

func (*DB) UpdateBucketOffChainStatus added in v1.6.0

func (db *DB) UpdateBucketOffChainStatus(ctx context.Context, bucket *models.Bucket) (string, []interface{})

func (*DB) UpdateBucketToSQL added in v0.2.3

func (db *DB) UpdateBucketToSQL(ctx context.Context, bucket *models.Bucket) (string, []interface{})

func (*DB) UpdateChargeSizeToSQL added in v1.1.0

func (db *DB) UpdateChargeSizeToSQL(ctx context.Context, objectID common.Hash, bucketName, operation string) (string, []interface{})

func (*DB) UpdateDataMigrationRecord added in v1.1.0

func (db *DB) UpdateDataMigrationRecord(ctx context.Context, processKey string, isCompleted bool) error

func (*DB) UpdateGVG added in v0.2.3

func (db *DB) UpdateGVG(ctx context.Context, gvg *models.GlobalVirtualGroup) error

func (*DB) UpdateGVGToSQL added in v0.2.3

func (db *DB) UpdateGVGToSQL(ctx context.Context, gvg *models.GlobalVirtualGroup) (string, []interface{})

func (*DB) UpdateGroup added in v0.2.3

func (db *DB) UpdateGroup(ctx context.Context, group *models.Group) error

func (*DB) UpdateGroupByOwnerAndNameToSQL added in v1.2.0

func (db *DB) UpdateGroupByOwnerAndNameToSQL(ctx context.Context, group *models.Group) (string, []interface{})

func (*DB) UpdateGroupToSQL added in v0.2.3

func (db *DB) UpdateGroupToSQL(ctx context.Context, group *models.Group) (string, []interface{})

func (*DB) UpdateLVG added in v0.2.3

func (db *DB) UpdateLVG(ctx context.Context, lvg *models.LocalVirtualGroup) error

func (*DB) UpdateLVGToSQL added in v0.2.3

func (db *DB) UpdateLVGToSQL(ctx context.Context, lvg *models.LocalVirtualGroup) (string, []interface{})

func (*DB) UpdateObject added in v0.2.3

func (db *DB) UpdateObject(ctx context.Context, object *models.Object) error

func (*DB) UpdateObjectByBucketNameAndObjectNameToSQL added in v1.2.0

func (db *DB) UpdateObjectByBucketNameAndObjectNameToSQL(ctx context.Context, object *models.Object) (string, []interface{})

func (*DB) UpdateObjectToSQL added in v0.2.3

func (db *DB) UpdateObjectToSQL(ctx context.Context, object *models.Object) (string, []interface{})

func (*DB) UpdatePermission added in v0.2.3

func (db *DB) UpdatePermission(ctx context.Context, permission *models.Permission) error

func (*DB) UpdatePermissionToSQL added in v0.2.3

func (db *DB) UpdatePermissionToSQL(ctx context.Context, permission *models.Permission) (string, []interface{})

func (*DB) UpdateStorageProvider added in v0.2.3

func (db *DB) UpdateStorageProvider(ctx context.Context, storageProvider *models.StorageProvider) error

func (*DB) UpdateStorageProviderToSQL added in v0.2.3

func (db *DB) UpdateStorageProviderToSQL(ctx context.Context, storageProvider *models.StorageProvider) (string, []interface{})

func (*DB) UpdateStorageSizeToSQL added in v1.1.0

func (db *DB) UpdateStorageSizeToSQL(ctx context.Context, objectID common.Hash, bucketName, operation string) (string, []interface{})

func (*DB) UpdateVGF added in v0.2.3

func (db *DB) UpdateVGF(ctx context.Context, vgf *models.GlobalVirtualGroupFamily) error

func (*DB) UpdateVGFToSQL added in v0.2.3

func (db *DB) UpdateVGFToSQL(ctx context.Context, vgf *models.GlobalVirtualGroupFamily) (string, []interface{})

Jump to

Keyboard shortcuts

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