Documentation ¶
Overview ¶
Package bsdb is a generated GoMock package.
Index ¶
- Constants
- Variables
- func ContinuationTokenFilter(continuationToken string) func(db *gorm.DB) *gorm.DB
- func FullNameFilter(fullName string) func(db *gorm.DB) *gorm.DB
- func InitDB(config *config.SQLDBConfig) (*gorm.DB, error)
- func NameFilter(name string) func(db *gorm.DB) *gorm.DB
- func PathNameFilter(pathName string) func(db *gorm.DB) *gorm.DB
- func PrefixFilter(prefix string) func(db *gorm.DB) *gorm.DB
- func RemovedFilter(removed bool) func(db *gorm.DB) *gorm.DB
- func SourceTypeFilter(sourceType string) func(db *gorm.DB) *gorm.DB
- type BSDB
- type BsDBImpl
- func (b *BsDBImpl) GetBucketByID(bucketID int64, includePrivate bool) (*Bucket, error)
- func (b *BsDBImpl) GetBucketByName(bucketName string, includePrivate bool) (*Bucket, error)
- func (b *BsDBImpl) GetBucketMetaByName(bucketName string, includePrivate bool) (*BucketFullMeta, error)
- func (b *BsDBImpl) GetGroupsByGroupIDAndAccount(groupIDList []common.Hash, account common.Address, includeRemoved bool) ([]*Group, error)
- func (b *BsDBImpl) GetLatestBlockNumber() (int64, error)
- func (b *BsDBImpl) GetObjectByName(objectName string, bucketName string, includePrivate bool) (*Object, error)
- func (b *BsDBImpl) GetPaymentByBucketID(bucketID int64, includePrivate bool) (*StreamRecord, error)
- func (b *BsDBImpl) GetPaymentByBucketName(bucketName string, includePrivate bool) (*StreamRecord, error)
- func (b *BsDBImpl) GetPaymentByPaymentAddress(paymentAddress common.Address) (*StreamRecord, error)
- func (b *BsDBImpl) GetPermissionByResourceAndPrincipal(resourceType, principalType, principalValue string, resourceID common.Hash) (*Permission, error)
- func (b *BsDBImpl) GetPermissionsByResourceAndPrincipleType(resourceType, principalType string, resourceID common.Hash, ...) ([]*Permission, error)
- func (b *BsDBImpl) GetStatementsByPolicyID(policyIDList []common.Hash, includeRemoved bool) ([]*Statement, error)
- func (b *BsDBImpl) GetSwitchDBSignal() (*MasterDB, error)
- func (b *BsDBImpl) GetUserBuckets(accountID common.Address, includeRemoved bool) ([]*Bucket, error)
- func (b *BsDBImpl) GetUserBucketsCount(accountID common.Address, includeRemoved bool) (int64, error)
- func (b *BsDBImpl) ListBucketsByBucketID(ids []common.Hash, includeRemoved bool) ([]*Bucket, error)
- func (b *BsDBImpl) ListDeletedObjectsByBlockNumberRange(startBlockNumber int64, endBlockNumber int64, includePrivate bool) ([]*Object, error)
- func (b *BsDBImpl) ListExpiredBucketsBySp(createAt int64, primarySpAddress string, limit int64) ([]*Bucket, error)
- func (b *BsDBImpl) ListGroupsByNameAndSourceType(name, prefix, sourceType string, limit, offset int, includeRemoved bool) ([]*Group, int64, error)
- func (b *BsDBImpl) ListObjects(bucketName, continuationToken, prefix string, maxKeys int) ([]*ListObjectsResult, error)
- func (b *BsDBImpl) ListObjectsByBucketName(bucketName, continuationToken, prefix, delimiter string, maxKeys int, ...) ([]*ListObjectsResult, error)
- func (b *BsDBImpl) ListObjectsByObjectID(ids []common.Hash, includeRemoved bool) ([]*Object, error)
- type Bucket
- type BucketFullMeta
- type BucketIDs
- type Epoch
- type Group
- type ListObjectsResult
- type MasterDB
- type Metadata
- type MockBSDB
- func (m *MockBSDB) EXPECT() *MockBSDBMockRecorder
- func (m *MockBSDB) GetBucketByID(bucketID int64, includePrivate bool) (*Bucket, error)
- func (m *MockBSDB) GetBucketByName(bucketName string, includePrivate bool) (*Bucket, error)
- func (m *MockBSDB) GetBucketMetaByName(bucketName string, includePrivate bool) (*BucketFullMeta, error)
- func (m *MockBSDB) GetGroupsByGroupIDAndAccount(groupIDList []common.Hash, account common.Address, includeRemoved bool) ([]*Group, error)
- func (m *MockBSDB) GetLatestBlockNumber() (int64, error)
- func (m *MockBSDB) GetObjectByName(objectName, bucketName string, includePrivate bool) (*Object, error)
- func (m *MockBSDB) GetPaymentByBucketID(bucketID int64, includePrivate bool) (*StreamRecord, error)
- func (m *MockBSDB) GetPaymentByBucketName(bucketName string, includePrivate bool) (*StreamRecord, error)
- func (m *MockBSDB) GetPaymentByPaymentAddress(address common.Address) (*StreamRecord, error)
- func (m *MockBSDB) GetPermissionByResourceAndPrincipal(resourceType, principalType, principalValue string, resourceID common.Hash) (*Permission, error)
- func (m *MockBSDB) GetPermissionsByResourceAndPrincipleType(resourceType, principalType string, resourceID common.Hash, ...) ([]*Permission, error)
- func (m *MockBSDB) GetStatementsByPolicyID(policyIDList []common.Hash, includeRemoved bool) ([]*Statement, error)
- func (m *MockBSDB) GetSwitchDBSignal() (*MasterDB, error)
- func (m *MockBSDB) GetUserBuckets(accountID common.Address, includeRemoved bool) ([]*Bucket, error)
- func (m *MockBSDB) GetUserBucketsCount(accountID common.Address, includeRemoved bool) (int64, error)
- func (m *MockBSDB) ListDeletedObjectsByBlockNumberRange(startBlockNumber, endBlockNumber int64, includePrivate bool) ([]*Object, error)
- func (m *MockBSDB) ListExpiredBucketsBySp(createAt int64, primarySpAddress string, limit int64) ([]*Bucket, error)
- func (m *MockBSDB) ListGroupsByNameAndSourceType(name, prefix, sourceType string, limit, offset int, includeRemoved bool) ([]*Group, int64, error)
- func (m *MockBSDB) ListObjectsByBucketName(bucketName, continuationToken, prefix, delimiter string, maxKeys int, ...) ([]*ListObjectsResult, error)
- type MockBSDBMockRecorder
- func (mr *MockBSDBMockRecorder) GetBucketByID(bucketID, includePrivate interface{}) *gomock.Call
- func (mr *MockBSDBMockRecorder) GetBucketByName(bucketName, includePrivate interface{}) *gomock.Call
- func (mr *MockBSDBMockRecorder) GetBucketMetaByName(bucketName, includePrivate interface{}) *gomock.Call
- func (mr *MockBSDBMockRecorder) GetGroupsByGroupIDAndAccount(groupIDList, account, includeRemoved interface{}) *gomock.Call
- func (mr *MockBSDBMockRecorder) GetLatestBlockNumber() *gomock.Call
- func (mr *MockBSDBMockRecorder) GetObjectByName(objectName, bucketName, includePrivate interface{}) *gomock.Call
- func (mr *MockBSDBMockRecorder) GetPaymentByBucketID(bucketID, includePrivate interface{}) *gomock.Call
- func (mr *MockBSDBMockRecorder) GetPaymentByBucketName(bucketName, includePrivate interface{}) *gomock.Call
- func (mr *MockBSDBMockRecorder) GetPaymentByPaymentAddress(address interface{}) *gomock.Call
- func (mr *MockBSDBMockRecorder) GetPermissionByResourceAndPrincipal(resourceType, principalType, principalValue, resourceID interface{}) *gomock.Call
- func (mr *MockBSDBMockRecorder) GetPermissionsByResourceAndPrincipleType(resourceType, principalType, resourceID, includeRemoved interface{}) *gomock.Call
- func (mr *MockBSDBMockRecorder) GetStatementsByPolicyID(policyIDList, includeRemoved interface{}) *gomock.Call
- func (mr *MockBSDBMockRecorder) GetSwitchDBSignal() *gomock.Call
- func (mr *MockBSDBMockRecorder) GetUserBuckets(accountID, includeRemoved interface{}) *gomock.Call
- func (mr *MockBSDBMockRecorder) GetUserBucketsCount(accountID, includeRemoved interface{}) *gomock.Call
- func (mr *MockBSDBMockRecorder) ListDeletedObjectsByBlockNumberRange(startBlockNumber, endBlockNumber, includePrivate interface{}) *gomock.Call
- func (mr *MockBSDBMockRecorder) ListExpiredBucketsBySp(createAt, primarySpAddress, limit interface{}) *gomock.Call
- func (mr *MockBSDBMockRecorder) ListGroupsByNameAndSourceType(name, prefix, sourceType, limit, offset, includeRemoved interface{}) *gomock.Call
- func (mr *MockBSDBMockRecorder) ListObjectsByBucketName(...) *gomock.Call
- type MockMetadata
- func (m *MockMetadata) EXPECT() *MockMetadataMockRecorder
- func (m *MockMetadata) GetBucketByID(bucketID int64, includePrivate bool) (*Bucket, error)
- func (m *MockMetadata) GetBucketByName(bucketName string, includePrivate bool) (*Bucket, error)
- func (m *MockMetadata) GetBucketMetaByName(bucketName string, includePrivate bool) (*BucketFullMeta, error)
- func (m *MockMetadata) GetGroupsByGroupIDAndAccount(groupIDList []common.Hash, account common.Address, includeRemoved bool) ([]*Group, error)
- func (m *MockMetadata) GetLatestBlockNumber() (int64, error)
- func (m *MockMetadata) GetObjectByName(objectName, bucketName string, includePrivate bool) (*Object, error)
- func (m *MockMetadata) GetPaymentByBucketID(bucketID int64, includePrivate bool) (*StreamRecord, error)
- func (m *MockMetadata) GetPaymentByBucketName(bucketName string, includePrivate bool) (*StreamRecord, error)
- func (m *MockMetadata) GetPaymentByPaymentAddress(address common.Address) (*StreamRecord, error)
- func (m *MockMetadata) GetPermissionByResourceAndPrincipal(resourceType, principalType, principalValue string, resourceID common.Hash) (*Permission, error)
- func (m *MockMetadata) GetPermissionsByResourceAndPrincipleType(resourceType, principalType string, resourceID common.Hash, ...) ([]*Permission, error)
- func (m *MockMetadata) GetStatementsByPolicyID(policyIDList []common.Hash, includeRemoved bool) ([]*Statement, error)
- func (m *MockMetadata) GetSwitchDBSignal() (*MasterDB, error)
- func (m *MockMetadata) GetUserBuckets(accountID common.Address, includeRemoved bool) ([]*Bucket, error)
- func (m *MockMetadata) GetUserBucketsCount(accountID common.Address, includeRemoved bool) (int64, error)
- func (m *MockMetadata) ListDeletedObjectsByBlockNumberRange(startBlockNumber, endBlockNumber int64, includePrivate bool) ([]*Object, error)
- func (m *MockMetadata) ListExpiredBucketsBySp(createAt int64, primarySpAddress string, limit int64) ([]*Bucket, error)
- func (m *MockMetadata) ListGroupsByNameAndSourceType(name, prefix, sourceType string, limit, offset int, includeRemoved bool) ([]*Group, int64, error)
- func (m *MockMetadata) ListObjectsByBucketName(bucketName, continuationToken, prefix, delimiter string, maxKeys int, ...) ([]*ListObjectsResult, error)
- type MockMetadataMockRecorder
- func (mr *MockMetadataMockRecorder) GetBucketByID(bucketID, includePrivate interface{}) *gomock.Call
- func (mr *MockMetadataMockRecorder) GetBucketByName(bucketName, includePrivate interface{}) *gomock.Call
- func (mr *MockMetadataMockRecorder) GetBucketMetaByName(bucketName, includePrivate interface{}) *gomock.Call
- func (mr *MockMetadataMockRecorder) GetGroupsByGroupIDAndAccount(groupIDList, account, includeRemoved interface{}) *gomock.Call
- func (mr *MockMetadataMockRecorder) GetLatestBlockNumber() *gomock.Call
- func (mr *MockMetadataMockRecorder) GetObjectByName(objectName, bucketName, includePrivate interface{}) *gomock.Call
- func (mr *MockMetadataMockRecorder) GetPaymentByBucketID(bucketID, includePrivate interface{}) *gomock.Call
- func (mr *MockMetadataMockRecorder) GetPaymentByBucketName(bucketName, includePrivate interface{}) *gomock.Call
- func (mr *MockMetadataMockRecorder) GetPaymentByPaymentAddress(address interface{}) *gomock.Call
- func (mr *MockMetadataMockRecorder) GetPermissionByResourceAndPrincipal(resourceType, principalType, principalValue, resourceID interface{}) *gomock.Call
- func (mr *MockMetadataMockRecorder) GetPermissionsByResourceAndPrincipleType(resourceType, principalType, resourceID, includeRemoved interface{}) *gomock.Call
- func (mr *MockMetadataMockRecorder) GetStatementsByPolicyID(policyIDList, includeRemoved interface{}) *gomock.Call
- func (mr *MockMetadataMockRecorder) GetSwitchDBSignal() *gomock.Call
- func (mr *MockMetadataMockRecorder) GetUserBuckets(accountID, includeRemoved interface{}) *gomock.Call
- func (mr *MockMetadataMockRecorder) GetUserBucketsCount(accountID, includeRemoved interface{}) *gomock.Call
- func (mr *MockMetadataMockRecorder) ListDeletedObjectsByBlockNumberRange(startBlockNumber, endBlockNumber, includePrivate interface{}) *gomock.Call
- func (mr *MockMetadataMockRecorder) ListExpiredBucketsBySp(createAt, primarySpAddress, limit interface{}) *gomock.Call
- func (mr *MockMetadataMockRecorder) ListGroupsByNameAndSourceType(name, prefix, sourceType, limit, offset, includeRemoved interface{}) *gomock.Call
- func (mr *MockMetadataMockRecorder) ListObjectsByBucketName(...) *gomock.Call
- type Object
- type ObjectIDs
- type Permission
- type SlashPrefixTreeNode
- type Statement
- type StreamRecord
Constants ¶
const ( // BsDBUser defines env variable name for block syncer db username. BsDBUser = "BS_DB_USER" // BsDBPasswd defines env variable name for block syncer db user passwd. BsDBPasswd = "BS_DB_PASSWORD" // BsDBAddress defines env variable name for block syncer db address. BsDBAddress = "BS_DB_ADDRESS" // BsDBDataBase defines env variable name for block syncer db database. BsDBDataBase = "BS_DB_DATABASE" // BsDBSwitchedUser defines env variable name for switched block syncer db username. BsDBSwitchedUser = "BS_DB_SWITCHED_USER" // BsDBSwitchedPasswd defines env variable name for switched block syncer db user passwd. BsDBSwitchedPasswd = "BS_DB_SWITCHED_PASSWORD" // BsDBSwitchedAddress defines env variable name for switched block syncer db address. BsDBSwitchedAddress = "BS_DB_SWITCHED_ADDRESS" // BsDBSwitchedDataBase defines env variable name for switched block syncer db database. BsDBSwitchedDataBase = "BS_DB_SWITCHED_DATABASE" )
const ( // DeletedObjectsDefaultSize defines the default size of ListDeletedObjectsByBlockNumberRange response DeletedObjectsDefaultSize = 1000 // ExpiredBucketsDefaultSize defines the default size of ListExpiredBucketsBySp response ExpiredBucketsDefaultSize = 1000 // ListObjectsDefaultMaxKeys defines the default size of ListObjectsByBucketName response ListObjectsDefaultMaxKeys = 50 // GetUserBucketsLimitSize defines the default limit for the number of buckets in any given account is 100 GetUserBucketsLimitSize = 100 // ListObjectsLimitSize defines the default limit of ListObjectsByBucketName response ListObjectsLimitSize = 1000 )
define metadata query statement
const ( // BucketTableName defines the name of bucket table BucketTableName = "buckets" // ObjectTableName defines the name of object table ObjectTableName = "objects" // EpochTableName defines the name of epoch table EpochTableName = "epoch" // PermissionTableName defines the name of permission table PermissionTableName = "permission" // StatementTableName defines the name of statement table StatementTableName = "statements" // GroupTableName defines the name of group table GroupTableName = "groups" // MasterDBTableName defines the name of master db table MasterDBTableName = "master_db" // PrefixTreeTableName defines the name of prefix tree node table PrefixTreeTableName = "slash_prefix_tree_nodes" )
define table name constant of block syncer db
const ( ObjectName = "object" CommonPrefix = "common_prefix" GroupAddress = "0x0000000000000000000000000000000000000000" )
define the list objects const
Variables ¶
var ActionTypeMap = map[permtypes.ActionType]int{ permtypes.ACTION_TYPE_ALL: 0, permtypes.ACTION_UPDATE_BUCKET_INFO: 1, permtypes.ACTION_DELETE_BUCKET: 2, permtypes.ACTION_CREATE_OBJECT: 3, permtypes.ACTION_DELETE_OBJECT: 4, permtypes.ACTION_COPY_OBJECT: 5, permtypes.ACTION_GET_OBJECT: 6, permtypes.ACTION_EXECUTE_OBJECT: 7, permtypes.ACTION_LIST_OBJECT: 8, permtypes.ACTION_UPDATE_GROUP_MEMBER: 9, permtypes.ACTION_DELETE_GROUP: 10, permtypes.ACTION_UPDATE_OBJECT_INFO: 11, }
ActionTypeMap db action value is a bitmap, traverse this map to get the corresponding action list
Functions ¶
func ContinuationTokenFilter ¶ added in v0.2.0
func FullNameFilter ¶ added in v0.2.2
func InitDB ¶
func InitDB(config *config.SQLDBConfig) (*gorm.DB, error)
InitDB init a block syncer db instance
func PathNameFilter ¶ added in v0.2.2
Types ¶
type BSDB ¶
type BSDB interface { Metadata }
BSDB contains all the methods required by block syncer database
type BsDBImpl ¶
type BsDBImpl struct {
// contains filtered or unexported fields
}
BsDBImpl block syncer database, implements BSDB interface
func NewBsDB ¶
func NewBsDB(cfg *gfspconfig.GfSpConfig, isBackup bool) (*BsDBImpl, error)
NewBsDB return a block syncer db instance or a block syncer db backup instance based on the isBackup flag
func (*BsDBImpl) GetBucketByID ¶
GetBucketByID get buckets info by a bucket id
func (*BsDBImpl) GetBucketByName ¶
GetBucketByName get buckets info by a bucket name
func (*BsDBImpl) GetBucketMetaByName ¶ added in v0.2.0
func (b *BsDBImpl) GetBucketMetaByName(bucketName string, includePrivate bool) (*BucketFullMeta, error)
func (*BsDBImpl) GetGroupsByGroupIDAndAccount ¶ added in v0.1.2
func (b *BsDBImpl) GetGroupsByGroupIDAndAccount(groupIDList []common.Hash, account common.Address, includeRemoved bool) ([]*Group, error)
GetGroupsByGroupIDAndAccount get groups info by group id list and account id
func (*BsDBImpl) GetLatestBlockNumber ¶
GetLatestBlockNumber get current latest block number
func (*BsDBImpl) GetObjectByName ¶ added in v0.1.1
func (b *BsDBImpl) GetObjectByName(objectName string, bucketName string, includePrivate bool) (*Object, error)
GetObjectByName get object info by an object name
func (*BsDBImpl) GetPaymentByBucketID ¶
func (b *BsDBImpl) GetPaymentByBucketID(bucketID int64, includePrivate bool) (*StreamRecord, error)
GetPaymentByBucketID get payment info by a bucket id
func (*BsDBImpl) GetPaymentByBucketName ¶
func (b *BsDBImpl) GetPaymentByBucketName(bucketName string, includePrivate bool) (*StreamRecord, error)
GetPaymentByBucketName get payment info by a bucket name
func (*BsDBImpl) GetPaymentByPaymentAddress ¶
func (b *BsDBImpl) GetPaymentByPaymentAddress(paymentAddress common.Address) (*StreamRecord, error)
GetPaymentByPaymentAddress get payment info by a payment address
func (*BsDBImpl) GetPermissionByResourceAndPrincipal ¶ added in v0.1.2
func (b *BsDBImpl) GetPermissionByResourceAndPrincipal(resourceType, principalType, principalValue string, resourceID common.Hash) (*Permission, error)
GetPermissionByResourceAndPrincipal get permission by resource type & ID, principal type & value
func (*BsDBImpl) GetPermissionsByResourceAndPrincipleType ¶ added in v0.1.2
func (b *BsDBImpl) GetPermissionsByResourceAndPrincipleType(resourceType, principalType string, resourceID common.Hash, includeRemoved bool) ([]*Permission, error)
GetPermissionsByResourceAndPrincipleType get permission by resource type & ID, principal type
func (*BsDBImpl) GetStatementsByPolicyID ¶ added in v0.1.2
func (b *BsDBImpl) GetStatementsByPolicyID(policyIDList []common.Hash, includeRemoved bool) ([]*Statement, error)
GetStatementsByPolicyID get statements info by a policy id
func (*BsDBImpl) GetSwitchDBSignal ¶ added in v0.2.0
GetSwitchDBSignal get signal to switch db
func (*BsDBImpl) GetUserBuckets ¶
GetUserBuckets get buckets info by a user address
func (*BsDBImpl) GetUserBucketsCount ¶
func (b *BsDBImpl) GetUserBucketsCount(accountID common.Address, includeRemoved bool) (int64, error)
GetUserBucketsCount get buckets count by a user address
func (*BsDBImpl) ListBucketsByBucketID ¶ added in v0.2.2
ListBucketsByBucketID list buckets by bucket ids
func (*BsDBImpl) ListDeletedObjectsByBlockNumberRange ¶
func (b *BsDBImpl) ListDeletedObjectsByBlockNumberRange(startBlockNumber int64, endBlockNumber int64, includePrivate bool) ([]*Object, error)
ListDeletedObjectsByBlockNumberRange list deleted objects info by a block number range
func (*BsDBImpl) ListExpiredBucketsBySp ¶ added in v0.1.2
func (b *BsDBImpl) ListExpiredBucketsBySp(createAt int64, primarySpAddress string, limit int64) ([]*Bucket, error)
ListExpiredBucketsBySp lists expired buckets
func (*BsDBImpl) ListGroupsByNameAndSourceType ¶ added in v0.2.2
func (b *BsDBImpl) ListGroupsByNameAndSourceType(name, prefix, sourceType string, limit, offset int, includeRemoved bool) ([]*Group, int64, error)
ListGroupsByNameAndSourceType get groups list by specific parameters
func (*BsDBImpl) ListObjects ¶ added in v0.2.2
func (b *BsDBImpl) ListObjects(bucketName, continuationToken, prefix string, maxKeys int) ([]*ListObjectsResult, error)
ListObjects List objects by bucket name
func (*BsDBImpl) ListObjectsByBucketName ¶
func (b *BsDBImpl) ListObjectsByBucketName(bucketName, continuationToken, prefix, delimiter string, maxKeys int, includeRemoved bool) ([]*ListObjectsResult, error)
ListObjectsByBucketName lists objects information by a bucket name. The function takes the following parameters: - bucketName: The name of the bucket to search for objects. - continuationToken: A token to paginate through the list of objects. - prefix: A prefix to filter the objects by their object names. - delimiter: A delimiter to group objects that share a common prefix. An empty delimiter means no grouping. - maxKeys: The maximum number of objects to return in the result.
The function returns a slice of ListObjectsResult, which contains information about the objects and their types (object or common_prefix). If there is a delimiter specified, the function will group objects that share a common prefix and return them as common_prefix in the result. If the delimiter is empty, the function will return all objects without grouping them by a common prefix.
type Bucket ¶
type Bucket struct { // ID defines db auto_increment id of bucket ID uint64 `gorm:"id"` // Owner is the account address of bucket creator, it is also the bucket owner. Owner common.Address `gorm:"owner"` // Operator defines the operator address of bucket Operator common.Address `gorm:"operator"` // BucketName is a globally unique name of bucket BucketName string `gorm:"bucket_name"` // Visibility defines the highest permissions for bucket. When a bucket is public, everyone can get storage obj Visibility string `gorm:"visibility"` // ID is the unique identification for bucket. BucketID common.Hash `gorm:"bucket_id"` // SourceType defines which chain the user should send the bucket management transactions to SourceType string `gorm:"source_type"` // CreateAt defines the block number when the bucket created. CreateAt int64 `gorm:"create_at"` // CreateTime defines the timestamp when the bucket created CreateTime int64 `gorm:"create_time"` // CreateTxHash defines the creation transaction hash of bucket CreateTxHash common.Hash `gorm:"create_tx_hash"` // PaymentAddress is the address of the payment account PaymentAddress common.Address `gorm:"payment_address"` // PrimarySpAddress is the address of the primary sp. Objects belong to this bucket will never // leave this SP, unless you explicitly shift them to another SP. PrimarySpAddress common.Address `gorm:"primary_sp_address"` // ReadQuota defines the traffic quota for read ChargedReadQuota uint64 `gorm:"charged_read_quota"` // PaymentPriceTime defines price time of payment PaymentPriceTime int64 `gorm:"payment_price_time"` // Removed defines the bucket is deleted or not Removed bool `gorm:"removed"` // Status defines the status of bucket Status string `gorm:"column:status"` // DeleteAt defines the block number when the bucket deleted. DeleteAt int64 `gorm:"delete_at"` // DeleteReason defines the deleted reason of bucket DeleteReason string `gorm:"delete_reason"` // UpdateAt defines the block number when the bucket update. UpdateAt int64 `gorm:"column:update_at"` // UpdateTxHash defines the update transaction hash of bucket UpdateTxHash common.Hash `gorm:"update_tx_hash"` // UpdateTime defines the timestamp when the bucket update. UpdateTime int64 `gorm:"column:update_time"` }
Bucket is the structure for user bucket
type BucketFullMeta ¶ added in v0.2.0
type BucketFullMeta struct { Bucket StreamRecord }
BucketFullMeta is the structure for user bucket with its related info
type BucketIDs ¶ added in v0.2.2
type BucketIDs struct {
IDs []uint64 `json:"ids"`
}
BucketIDs represents the request of list bucket by ids
type Epoch ¶
type Epoch struct { // OneRowID defines if the table only has one row OneRowID bool `gorm:"one_row_id;not null;default:true;primaryKey"` // BlockHeight defines the latest block number BlockHeight int64 `gorm:"block_height;type:bigint(64)"` // BlockHash defines the latest block hash BlockHash common.Hash `gorm:"block_hash;type:BINARY(32)"` // UpdateTime defines the update time of the latest block UpdateTime int64 `gorm:"update_time;type:bigint(64)"` }
Epoch stores current information of the latest block
type Group ¶ added in v0.1.2
type Group struct { // ID defines db auto_increment id of group ID uint64 `gorm:"column:id"` // Owner is the account address of group creator Owner common.Address `gorm:"column:owner"` // GroupID is the unique identification for bucket. GroupID common.Hash `gorm:"column:group_id"` // GroupName defines the name of the group GroupName string `gorm:"column:group_name"` // SourceType defines which chain the user should send the bucket management transactions to SourceType string `gorm:"column:source_type"` // Extra defines the extra info for the group to update Extra string `gorm:"column:extra"` // AccountID defines the group user address AccountID common.Address `gorm:"column:account_id"` // Operator defines operator address of group Operator common.Address `gorm:"column:operator"` // CreateAt defines the block number when the group created CreateAt int64 `gorm:"column:create_at"` // CreateTime defines the timestamp when the group created CreateTime int64 `gorm:"column:create_time"` // UpdateAt defines the block number when the group updated UpdateAt int64 `gorm:"column:update_at"` // UpdateTime defines the timestamp when the group updated UpdateTime int64 `gorm:"column:update_time"` // Removed defines the group is deleted or not Removed bool `gorm:"column:removed"` }
Group is the structure for group information
type ListObjectsResult ¶ added in v0.2.0
ListObjectsResult represents the result of a List Objects operation.
type MasterDB ¶ added in v0.2.0
type MasterDB struct { OneRowId bool `gorm:"column:one_row_id;not null;primaryKey"` // IsMaster defines if current DB is master DB IsMaster bool `gorm:"column:is_master;not null;"` }
MasterDB stores current master DB
type Metadata ¶
type Metadata interface { // GetUserBuckets get buckets info by a user address GetUserBuckets(accountID common.Address, includeRemoved bool) ([]*Bucket, error) // GetUserBucketsCount get buckets count by a user address GetUserBucketsCount(accountID common.Address, includeRemoved bool) (int64, error) // GetBucketByName get buckets info by a bucket name GetBucketByName(bucketName string, includePrivate bool) (*Bucket, error) // GetBucketByID get buckets info by by a bucket id GetBucketByID(bucketID int64, includePrivate bool) (*Bucket, error) // GetLatestBlockNumber get current latest block number GetLatestBlockNumber() (int64, error) // GetPaymentByBucketName get bucket payment info by a bucket name GetPaymentByBucketName(bucketName string, includePrivate bool) (*StreamRecord, error) // GetPaymentByBucketID get bucket payment info by a bucket id GetPaymentByBucketID(bucketID int64, includePrivate bool) (*StreamRecord, error) // GetPaymentByPaymentAddress get bucket payment info by a payment address GetPaymentByPaymentAddress(address common.Address) (*StreamRecord, error) // GetPermissionByResourceAndPrincipal get permission info by resource type & id, principal type & value GetPermissionByResourceAndPrincipal(resourceType, principalType, principalValue string, resourceID common.Hash) (*Permission, error) // GetStatementsByPolicyID get statements info by a policy id GetStatementsByPolicyID(policyIDList []common.Hash, includeRemoved bool) ([]*Statement, error) // GetPermissionsByResourceAndPrincipleType get permissions info by resource type & id, principal type GetPermissionsByResourceAndPrincipleType(resourceType, principalType string, resourceID common.Hash, includeRemoved bool) ([]*Permission, error) // GetGroupsByGroupIDAndAccount get groups info by group id list and account id GetGroupsByGroupIDAndAccount(groupIDList []common.Hash, account common.Address, includeRemoved bool) ([]*Group, error) // ListObjectsByBucketName list objects info by a bucket name ListObjectsByBucketName(bucketName, continuationToken, prefix, delimiter string, maxKeys int, includeRemoved bool) ([]*ListObjectsResult, error) // ListDeletedObjectsByBlockNumberRange list deleted objects info by a block number range ListDeletedObjectsByBlockNumberRange(startBlockNumber int64, endBlockNumber int64, includePrivate bool) ([]*Object, error) // ListExpiredBucketsBySp list expired buckets by sp ListExpiredBucketsBySp(createAt int64, primarySpAddress string, limit int64) ([]*Bucket, error) // GetObjectByName get object info by an object name GetObjectByName(objectName string, bucketName string, includePrivate bool) (*Object, error) // GetSwitchDBSignal check if there is a signal to switch the database GetSwitchDBSignal() (*MasterDB, error) // GetBucketMetaByName get bucket info with its related info GetBucketMetaByName(bucketName string, includePrivate bool) (*BucketFullMeta, error) // ListGroupsByNameAndSourceType get groups list by specific parameters ListGroupsByNameAndSourceType(name, prefix, sourceType string, limit, offset int, includeRemoved bool) ([]*Group, int64, error) // ListObjectsByObjectID list objects by object ids ListObjectsByObjectID(ids []common.Hash, includeRemoved bool) ([]*Object, error) // ListBucketsByBucketID list buckets by bucket ids ListBucketsByBucketID(ids []common.Hash, includeRemoved bool) ([]*Bucket, error) }
Metadata contains all the methods required by block syncer db database
type MockBSDB ¶ added in v0.2.0
type MockBSDB struct {
// contains filtered or unexported fields
}
MockBSDB is a mock of BSDB interface.
func NewMockBSDB ¶ added in v0.2.0
func NewMockBSDB(ctrl *gomock.Controller) *MockBSDB
NewMockBSDB creates a new mock instance.
func (*MockBSDB) EXPECT ¶ added in v0.2.0
func (m *MockBSDB) EXPECT() *MockBSDBMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockBSDB) GetBucketByID ¶ added in v0.2.0
GetBucketByID mocks base method.
func (*MockBSDB) GetBucketByName ¶ added in v0.2.0
GetBucketByName mocks base method.
func (*MockBSDB) GetBucketMetaByName ¶ added in v0.2.0
func (m *MockBSDB) GetBucketMetaByName(bucketName string, includePrivate bool) (*BucketFullMeta, error)
GetBucketMetaByName mocks base method.
func (*MockBSDB) GetGroupsByGroupIDAndAccount ¶ added in v0.2.0
func (m *MockBSDB) GetGroupsByGroupIDAndAccount(groupIDList []common.Hash, account common.Address, includeRemoved bool) ([]*Group, error)
GetGroupsByGroupIDAndAccount mocks base method.
func (*MockBSDB) GetLatestBlockNumber ¶ added in v0.2.0
GetLatestBlockNumber mocks base method.
func (*MockBSDB) GetObjectByName ¶ added in v0.2.0
func (m *MockBSDB) GetObjectByName(objectName, bucketName string, includePrivate bool) (*Object, error)
GetObjectByName mocks base method.
func (*MockBSDB) GetPaymentByBucketID ¶ added in v0.2.0
func (m *MockBSDB) GetPaymentByBucketID(bucketID int64, includePrivate bool) (*StreamRecord, error)
GetPaymentByBucketID mocks base method.
func (*MockBSDB) GetPaymentByBucketName ¶ added in v0.2.0
func (m *MockBSDB) GetPaymentByBucketName(bucketName string, includePrivate bool) (*StreamRecord, error)
GetPaymentByBucketName mocks base method.
func (*MockBSDB) GetPaymentByPaymentAddress ¶ added in v0.2.0
func (m *MockBSDB) GetPaymentByPaymentAddress(address common.Address) (*StreamRecord, error)
GetPaymentByPaymentAddress mocks base method.
func (*MockBSDB) GetPermissionByResourceAndPrincipal ¶ added in v0.2.0
func (m *MockBSDB) GetPermissionByResourceAndPrincipal(resourceType, principalType, principalValue string, resourceID common.Hash) (*Permission, error)
GetPermissionByResourceAndPrincipal mocks base method.
func (*MockBSDB) GetPermissionsByResourceAndPrincipleType ¶ added in v0.2.0
func (m *MockBSDB) GetPermissionsByResourceAndPrincipleType(resourceType, principalType string, resourceID common.Hash, includeRemoved bool) ([]*Permission, error)
GetPermissionsByResourceAndPrincipleType mocks base method.
func (*MockBSDB) GetStatementsByPolicyID ¶ added in v0.2.0
func (m *MockBSDB) GetStatementsByPolicyID(policyIDList []common.Hash, includeRemoved bool) ([]*Statement, error)
GetStatementsByPolicyID mocks base method.
func (*MockBSDB) GetSwitchDBSignal ¶ added in v0.2.0
GetSwitchDBSignal mocks base method.
func (*MockBSDB) GetUserBuckets ¶ added in v0.2.0
GetUserBuckets mocks base method.
func (*MockBSDB) GetUserBucketsCount ¶ added in v0.2.0
func (m *MockBSDB) GetUserBucketsCount(accountID common.Address, includeRemoved bool) (int64, error)
GetUserBucketsCount mocks base method.
func (*MockBSDB) ListDeletedObjectsByBlockNumberRange ¶ added in v0.2.0
func (m *MockBSDB) ListDeletedObjectsByBlockNumberRange(startBlockNumber, endBlockNumber int64, includePrivate bool) ([]*Object, error)
ListDeletedObjectsByBlockNumberRange mocks base method.
func (*MockBSDB) ListExpiredBucketsBySp ¶ added in v0.2.0
func (m *MockBSDB) ListExpiredBucketsBySp(createAt int64, primarySpAddress string, limit int64) ([]*Bucket, error)
ListExpiredBucketsBySp mocks base method.
func (*MockBSDB) ListGroupsByNameAndSourceType ¶ added in v0.2.2
func (m *MockBSDB) ListGroupsByNameAndSourceType(name, prefix, sourceType string, limit, offset int, includeRemoved bool) ([]*Group, int64, error)
ListGroupsByNameAndSourceType mocks base method.
func (*MockBSDB) ListObjectsByBucketName ¶ added in v0.2.0
func (m *MockBSDB) ListObjectsByBucketName(bucketName, continuationToken, prefix, delimiter string, maxKeys int, includeRemoved bool) ([]*ListObjectsResult, error)
ListObjectsByBucketName mocks base method.
type MockBSDBMockRecorder ¶ added in v0.2.0
type MockBSDBMockRecorder struct {
// contains filtered or unexported fields
}
MockBSDBMockRecorder is the mock recorder for MockBSDB.
func (*MockBSDBMockRecorder) GetBucketByID ¶ added in v0.2.0
func (mr *MockBSDBMockRecorder) GetBucketByID(bucketID, includePrivate interface{}) *gomock.Call
GetBucketByID indicates an expected call of GetBucketByID.
func (*MockBSDBMockRecorder) GetBucketByName ¶ added in v0.2.0
func (mr *MockBSDBMockRecorder) GetBucketByName(bucketName, includePrivate interface{}) *gomock.Call
GetBucketByName indicates an expected call of GetBucketByName.
func (*MockBSDBMockRecorder) GetBucketMetaByName ¶ added in v0.2.0
func (mr *MockBSDBMockRecorder) GetBucketMetaByName(bucketName, includePrivate interface{}) *gomock.Call
GetBucketMetaByName indicates an expected call of GetBucketMetaByName.
func (*MockBSDBMockRecorder) GetGroupsByGroupIDAndAccount ¶ added in v0.2.0
func (mr *MockBSDBMockRecorder) GetGroupsByGroupIDAndAccount(groupIDList, account, includeRemoved interface{}) *gomock.Call
GetGroupsByGroupIDAndAccount indicates an expected call of GetGroupsByGroupIDAndAccount.
func (*MockBSDBMockRecorder) GetLatestBlockNumber ¶ added in v0.2.0
func (mr *MockBSDBMockRecorder) GetLatestBlockNumber() *gomock.Call
GetLatestBlockNumber indicates an expected call of GetLatestBlockNumber.
func (*MockBSDBMockRecorder) GetObjectByName ¶ added in v0.2.0
func (mr *MockBSDBMockRecorder) GetObjectByName(objectName, bucketName, includePrivate interface{}) *gomock.Call
GetObjectByName indicates an expected call of GetObjectByName.
func (*MockBSDBMockRecorder) GetPaymentByBucketID ¶ added in v0.2.0
func (mr *MockBSDBMockRecorder) GetPaymentByBucketID(bucketID, includePrivate interface{}) *gomock.Call
GetPaymentByBucketID indicates an expected call of GetPaymentByBucketID.
func (*MockBSDBMockRecorder) GetPaymentByBucketName ¶ added in v0.2.0
func (mr *MockBSDBMockRecorder) GetPaymentByBucketName(bucketName, includePrivate interface{}) *gomock.Call
GetPaymentByBucketName indicates an expected call of GetPaymentByBucketName.
func (*MockBSDBMockRecorder) GetPaymentByPaymentAddress ¶ added in v0.2.0
func (mr *MockBSDBMockRecorder) GetPaymentByPaymentAddress(address interface{}) *gomock.Call
GetPaymentByPaymentAddress indicates an expected call of GetPaymentByPaymentAddress.
func (*MockBSDBMockRecorder) GetPermissionByResourceAndPrincipal ¶ added in v0.2.0
func (mr *MockBSDBMockRecorder) GetPermissionByResourceAndPrincipal(resourceType, principalType, principalValue, resourceID interface{}) *gomock.Call
GetPermissionByResourceAndPrincipal indicates an expected call of GetPermissionByResourceAndPrincipal.
func (*MockBSDBMockRecorder) GetPermissionsByResourceAndPrincipleType ¶ added in v0.2.0
func (mr *MockBSDBMockRecorder) GetPermissionsByResourceAndPrincipleType(resourceType, principalType, resourceID, includeRemoved interface{}) *gomock.Call
GetPermissionsByResourceAndPrincipleType indicates an expected call of GetPermissionsByResourceAndPrincipleType.
func (*MockBSDBMockRecorder) GetStatementsByPolicyID ¶ added in v0.2.0
func (mr *MockBSDBMockRecorder) GetStatementsByPolicyID(policyIDList, includeRemoved interface{}) *gomock.Call
GetStatementsByPolicyID indicates an expected call of GetStatementsByPolicyID.
func (*MockBSDBMockRecorder) GetSwitchDBSignal ¶ added in v0.2.0
func (mr *MockBSDBMockRecorder) GetSwitchDBSignal() *gomock.Call
GetSwitchDBSignal indicates an expected call of GetSwitchDBSignal.
func (*MockBSDBMockRecorder) GetUserBuckets ¶ added in v0.2.0
func (mr *MockBSDBMockRecorder) GetUserBuckets(accountID, includeRemoved interface{}) *gomock.Call
GetUserBuckets indicates an expected call of GetUserBuckets.
func (*MockBSDBMockRecorder) GetUserBucketsCount ¶ added in v0.2.0
func (mr *MockBSDBMockRecorder) GetUserBucketsCount(accountID, includeRemoved interface{}) *gomock.Call
GetUserBucketsCount indicates an expected call of GetUserBucketsCount.
func (*MockBSDBMockRecorder) ListDeletedObjectsByBlockNumberRange ¶ added in v0.2.0
func (mr *MockBSDBMockRecorder) ListDeletedObjectsByBlockNumberRange(startBlockNumber, endBlockNumber, includePrivate interface{}) *gomock.Call
ListDeletedObjectsByBlockNumberRange indicates an expected call of ListDeletedObjectsByBlockNumberRange.
func (*MockBSDBMockRecorder) ListExpiredBucketsBySp ¶ added in v0.2.0
func (mr *MockBSDBMockRecorder) ListExpiredBucketsBySp(createAt, primarySpAddress, limit interface{}) *gomock.Call
ListExpiredBucketsBySp indicates an expected call of ListExpiredBucketsBySp.
func (*MockBSDBMockRecorder) ListGroupsByNameAndSourceType ¶ added in v0.2.2
func (mr *MockBSDBMockRecorder) ListGroupsByNameAndSourceType(name, prefix, sourceType, limit, offset, includeRemoved interface{}) *gomock.Call
ListGroupsByNameAndSourceType indicates an expected call of ListGroupsByNameAndSourceType.
func (*MockBSDBMockRecorder) ListObjectsByBucketName ¶ added in v0.2.0
func (mr *MockBSDBMockRecorder) ListObjectsByBucketName(bucketName, continuationToken, prefix, delimiter, maxKeys, includeRemoved interface{}) *gomock.Call
ListObjectsByBucketName indicates an expected call of ListObjectsByBucketName.
type MockMetadata ¶ added in v0.2.0
type MockMetadata struct {
// contains filtered or unexported fields
}
MockMetadata is a mock of Metadata interface.
func NewMockMetadata ¶ added in v0.2.0
func NewMockMetadata(ctrl *gomock.Controller) *MockMetadata
NewMockMetadata creates a new mock instance.
func (*MockMetadata) EXPECT ¶ added in v0.2.0
func (m *MockMetadata) EXPECT() *MockMetadataMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockMetadata) GetBucketByID ¶ added in v0.2.0
func (m *MockMetadata) GetBucketByID(bucketID int64, includePrivate bool) (*Bucket, error)
GetBucketByID mocks base method.
func (*MockMetadata) GetBucketByName ¶ added in v0.2.0
func (m *MockMetadata) GetBucketByName(bucketName string, includePrivate bool) (*Bucket, error)
GetBucketByName mocks base method.
func (*MockMetadata) GetBucketMetaByName ¶ added in v0.2.0
func (m *MockMetadata) GetBucketMetaByName(bucketName string, includePrivate bool) (*BucketFullMeta, error)
GetBucketMetaByName mocks base method.
func (*MockMetadata) GetGroupsByGroupIDAndAccount ¶ added in v0.2.0
func (m *MockMetadata) GetGroupsByGroupIDAndAccount(groupIDList []common.Hash, account common.Address, includeRemoved bool) ([]*Group, error)
GetGroupsByGroupIDAndAccount mocks base method.
func (*MockMetadata) GetLatestBlockNumber ¶ added in v0.2.0
func (m *MockMetadata) GetLatestBlockNumber() (int64, error)
GetLatestBlockNumber mocks base method.
func (*MockMetadata) GetObjectByName ¶ added in v0.2.0
func (m *MockMetadata) GetObjectByName(objectName, bucketName string, includePrivate bool) (*Object, error)
GetObjectByName mocks base method.
func (*MockMetadata) GetPaymentByBucketID ¶ added in v0.2.0
func (m *MockMetadata) GetPaymentByBucketID(bucketID int64, includePrivate bool) (*StreamRecord, error)
GetPaymentByBucketID mocks base method.
func (*MockMetadata) GetPaymentByBucketName ¶ added in v0.2.0
func (m *MockMetadata) GetPaymentByBucketName(bucketName string, includePrivate bool) (*StreamRecord, error)
GetPaymentByBucketName mocks base method.
func (*MockMetadata) GetPaymentByPaymentAddress ¶ added in v0.2.0
func (m *MockMetadata) GetPaymentByPaymentAddress(address common.Address) (*StreamRecord, error)
GetPaymentByPaymentAddress mocks base method.
func (*MockMetadata) GetPermissionByResourceAndPrincipal ¶ added in v0.2.0
func (m *MockMetadata) GetPermissionByResourceAndPrincipal(resourceType, principalType, principalValue string, resourceID common.Hash) (*Permission, error)
GetPermissionByResourceAndPrincipal mocks base method.
func (*MockMetadata) GetPermissionsByResourceAndPrincipleType ¶ added in v0.2.0
func (m *MockMetadata) GetPermissionsByResourceAndPrincipleType(resourceType, principalType string, resourceID common.Hash, includeRemoved bool) ([]*Permission, error)
GetPermissionsByResourceAndPrincipleType mocks base method.
func (*MockMetadata) GetStatementsByPolicyID ¶ added in v0.2.0
func (m *MockMetadata) GetStatementsByPolicyID(policyIDList []common.Hash, includeRemoved bool) ([]*Statement, error)
GetStatementsByPolicyID mocks base method.
func (*MockMetadata) GetSwitchDBSignal ¶ added in v0.2.0
func (m *MockMetadata) GetSwitchDBSignal() (*MasterDB, error)
GetSwitchDBSignal mocks base method.
func (*MockMetadata) GetUserBuckets ¶ added in v0.2.0
func (m *MockMetadata) GetUserBuckets(accountID common.Address, includeRemoved bool) ([]*Bucket, error)
GetUserBuckets mocks base method.
func (*MockMetadata) GetUserBucketsCount ¶ added in v0.2.0
func (m *MockMetadata) GetUserBucketsCount(accountID common.Address, includeRemoved bool) (int64, error)
GetUserBucketsCount mocks base method.
func (*MockMetadata) ListDeletedObjectsByBlockNumberRange ¶ added in v0.2.0
func (m *MockMetadata) ListDeletedObjectsByBlockNumberRange(startBlockNumber, endBlockNumber int64, includePrivate bool) ([]*Object, error)
ListDeletedObjectsByBlockNumberRange mocks base method.
func (*MockMetadata) ListExpiredBucketsBySp ¶ added in v0.2.0
func (m *MockMetadata) ListExpiredBucketsBySp(createAt int64, primarySpAddress string, limit int64) ([]*Bucket, error)
ListExpiredBucketsBySp mocks base method.
func (*MockMetadata) ListGroupsByNameAndSourceType ¶ added in v0.2.2
func (m *MockMetadata) ListGroupsByNameAndSourceType(name, prefix, sourceType string, limit, offset int, includeRemoved bool) ([]*Group, int64, error)
ListGroupsByNameAndSourceType mocks base method.
func (*MockMetadata) ListObjectsByBucketName ¶ added in v0.2.0
func (m *MockMetadata) ListObjectsByBucketName(bucketName, continuationToken, prefix, delimiter string, maxKeys int, includeRemoved bool) ([]*ListObjectsResult, error)
ListObjectsByBucketName mocks base method.
type MockMetadataMockRecorder ¶ added in v0.2.0
type MockMetadataMockRecorder struct {
// contains filtered or unexported fields
}
MockMetadataMockRecorder is the mock recorder for MockMetadata.
func (*MockMetadataMockRecorder) GetBucketByID ¶ added in v0.2.0
func (mr *MockMetadataMockRecorder) GetBucketByID(bucketID, includePrivate interface{}) *gomock.Call
GetBucketByID indicates an expected call of GetBucketByID.
func (*MockMetadataMockRecorder) GetBucketByName ¶ added in v0.2.0
func (mr *MockMetadataMockRecorder) GetBucketByName(bucketName, includePrivate interface{}) *gomock.Call
GetBucketByName indicates an expected call of GetBucketByName.
func (*MockMetadataMockRecorder) GetBucketMetaByName ¶ added in v0.2.0
func (mr *MockMetadataMockRecorder) GetBucketMetaByName(bucketName, includePrivate interface{}) *gomock.Call
GetBucketMetaByName indicates an expected call of GetBucketMetaByName.
func (*MockMetadataMockRecorder) GetGroupsByGroupIDAndAccount ¶ added in v0.2.0
func (mr *MockMetadataMockRecorder) GetGroupsByGroupIDAndAccount(groupIDList, account, includeRemoved interface{}) *gomock.Call
GetGroupsByGroupIDAndAccount indicates an expected call of GetGroupsByGroupIDAndAccount.
func (*MockMetadataMockRecorder) GetLatestBlockNumber ¶ added in v0.2.0
func (mr *MockMetadataMockRecorder) GetLatestBlockNumber() *gomock.Call
GetLatestBlockNumber indicates an expected call of GetLatestBlockNumber.
func (*MockMetadataMockRecorder) GetObjectByName ¶ added in v0.2.0
func (mr *MockMetadataMockRecorder) GetObjectByName(objectName, bucketName, includePrivate interface{}) *gomock.Call
GetObjectByName indicates an expected call of GetObjectByName.
func (*MockMetadataMockRecorder) GetPaymentByBucketID ¶ added in v0.2.0
func (mr *MockMetadataMockRecorder) GetPaymentByBucketID(bucketID, includePrivate interface{}) *gomock.Call
GetPaymentByBucketID indicates an expected call of GetPaymentByBucketID.
func (*MockMetadataMockRecorder) GetPaymentByBucketName ¶ added in v0.2.0
func (mr *MockMetadataMockRecorder) GetPaymentByBucketName(bucketName, includePrivate interface{}) *gomock.Call
GetPaymentByBucketName indicates an expected call of GetPaymentByBucketName.
func (*MockMetadataMockRecorder) GetPaymentByPaymentAddress ¶ added in v0.2.0
func (mr *MockMetadataMockRecorder) GetPaymentByPaymentAddress(address interface{}) *gomock.Call
GetPaymentByPaymentAddress indicates an expected call of GetPaymentByPaymentAddress.
func (*MockMetadataMockRecorder) GetPermissionByResourceAndPrincipal ¶ added in v0.2.0
func (mr *MockMetadataMockRecorder) GetPermissionByResourceAndPrincipal(resourceType, principalType, principalValue, resourceID interface{}) *gomock.Call
GetPermissionByResourceAndPrincipal indicates an expected call of GetPermissionByResourceAndPrincipal.
func (*MockMetadataMockRecorder) GetPermissionsByResourceAndPrincipleType ¶ added in v0.2.0
func (mr *MockMetadataMockRecorder) GetPermissionsByResourceAndPrincipleType(resourceType, principalType, resourceID, includeRemoved interface{}) *gomock.Call
GetPermissionsByResourceAndPrincipleType indicates an expected call of GetPermissionsByResourceAndPrincipleType.
func (*MockMetadataMockRecorder) GetStatementsByPolicyID ¶ added in v0.2.0
func (mr *MockMetadataMockRecorder) GetStatementsByPolicyID(policyIDList, includeRemoved interface{}) *gomock.Call
GetStatementsByPolicyID indicates an expected call of GetStatementsByPolicyID.
func (*MockMetadataMockRecorder) GetSwitchDBSignal ¶ added in v0.2.0
func (mr *MockMetadataMockRecorder) GetSwitchDBSignal() *gomock.Call
GetSwitchDBSignal indicates an expected call of GetSwitchDBSignal.
func (*MockMetadataMockRecorder) GetUserBuckets ¶ added in v0.2.0
func (mr *MockMetadataMockRecorder) GetUserBuckets(accountID, includeRemoved interface{}) *gomock.Call
GetUserBuckets indicates an expected call of GetUserBuckets.
func (*MockMetadataMockRecorder) GetUserBucketsCount ¶ added in v0.2.0
func (mr *MockMetadataMockRecorder) GetUserBucketsCount(accountID, includeRemoved interface{}) *gomock.Call
GetUserBucketsCount indicates an expected call of GetUserBucketsCount.
func (*MockMetadataMockRecorder) ListDeletedObjectsByBlockNumberRange ¶ added in v0.2.0
func (mr *MockMetadataMockRecorder) ListDeletedObjectsByBlockNumberRange(startBlockNumber, endBlockNumber, includePrivate interface{}) *gomock.Call
ListDeletedObjectsByBlockNumberRange indicates an expected call of ListDeletedObjectsByBlockNumberRange.
func (*MockMetadataMockRecorder) ListExpiredBucketsBySp ¶ added in v0.2.0
func (mr *MockMetadataMockRecorder) ListExpiredBucketsBySp(createAt, primarySpAddress, limit interface{}) *gomock.Call
ListExpiredBucketsBySp indicates an expected call of ListExpiredBucketsBySp.
func (*MockMetadataMockRecorder) ListGroupsByNameAndSourceType ¶ added in v0.2.2
func (mr *MockMetadataMockRecorder) ListGroupsByNameAndSourceType(name, prefix, sourceType, limit, offset, includeRemoved interface{}) *gomock.Call
ListGroupsByNameAndSourceType indicates an expected call of ListGroupsByNameAndSourceType.
func (*MockMetadataMockRecorder) ListObjectsByBucketName ¶ added in v0.2.0
func (mr *MockMetadataMockRecorder) ListObjectsByBucketName(bucketName, continuationToken, prefix, delimiter, maxKeys, includeRemoved interface{}) *gomock.Call
ListObjectsByBucketName indicates an expected call of ListObjectsByBucketName.
type Object ¶
type Object struct { // ID defines db auto_increment id of object ID uint64 `gorm:"id"` // Creator defines the account address of object creator Creator common.Address `gorm:"creator"` // Operator defines the operator address of object Operator common.Address `gorm:"operator"` // Owner defines the account address of object owner Owner common.Address `gorm:"owner"` // BucketName is the name of the bucket BucketName string `gorm:"bucket_name"` // ObjectName is the name of object ObjectName string `gorm:"object_name"` // ObjectID is the unique identifier of object ObjectID common.Hash `gorm:"object_id"` // BucketID is the unique identifier of bucket BucketID common.Hash `gorm:"bucket_id"` // PayloadSize is the total size of the object payload PayloadSize uint64 `gorm:"payload_size"` // Visibility defines the highest permissions for bucket. When a bucket is public, everyone can get storage obj Visibility string `gorm:"visibility"` // ContentType defines the format of the object which should be a standard MIME type ContentType string `gorm:"content_type"` // CreateAt defines the block number when the object created CreateAt int64 `gorm:"create_at"` // CreateTime defines the timestamp when the object created CreateTime int64 `gorm:"create_time"` // ObjectStatus defines the upload status of the object. ObjectStatus string `gorm:"column:status"` // RedundancyType defines the type of the redundancy which can be multi-replication or EC RedundancyType string `gorm:"redundancy_type"` // SourceType defines the source of the object. SourceType string `gorm:"source_type"` // CheckSums defines the root hash of the pieces which stored in a SP Checksums pq.ByteaArray `gorm:"check_sums;type:text"` // SecondarySpAddresses defines the addresses of secondary_sps SecondarySpAddresses pq.StringArray `gorm:"secondary_sp_addresses;type:text"` // LockedBalance defines locked balance of object LockedBalance common.Hash `gorm:"locked_balance"` // Removed defines the object is deleted or not Removed bool `gorm:"removed"` // UpdateTime defines the time when the object updated UpdateTime int64 `gorm:"update_time"` // UpdateAt defines the block number when the object updated UpdateAt int64 `gorm:"update_at"` // DeleteAt defines the block number when the object deleted DeleteAt int64 `gorm:"delete_at"` // DeleteReason defines the deleted reason of object DeleteReason string `gorm:"delete_reason"` // CreateTxHash defines the creation transaction hash of object CreateTxHash common.Hash `gorm:"create_tx_hash"` // UpdateTxHash defines the update transaction hash of object UpdateTxHash common.Hash `gorm:"update_tx_hash"` // SealTxHash defines the sealed transaction hash of object SealTxHash common.Hash `gorm:"column:sealed_tx_hash"` }
Object is the structure for user object
type ObjectIDs ¶ added in v0.2.2
type ObjectIDs struct {
IDs []uint64 `json:"ids"`
}
ObjectIDs represents the request of list object by ids
type Permission ¶ added in v0.1.2
type Permission struct { // ID defines db auto_increment id of permission ID uint64 `gorm:"id"` // PrincipalType defines the type of principal PrincipalType int32 `gorm:"principal_type"` // PrincipalValue defines the value of principal // When the type is an account, its value is sdk.AccAddress().String(); // when the type is a group, its value is math.Uint().String() PrincipalValue string `gorm:"principal_value"` // ResourceType defines the type of resource that grants permission for ResourceType string `gorm:"resource_type"` // ResourceID defines the bucket/object/group id of the resource that grants permission for ResourceID common.Hash `gorm:"resource_id"` // PolicyID is a unique u256 sequence for each policy. It also is used as NFT tokenID PolicyID common.Hash `gorm:"policy_id"` // CreateTimestamp defines the create time of permission CreateTimestamp int64 `gorm:"create_timestamp"` // UpdateTimestamp defines the update time of permission UpdateTimestamp int64 `gorm:"update_timestamp"` // ExpirationTime defines the expiration time of permission ExpirationTime int64 `gorm:"expiration_time;type:bigint(64)"` // Removed defines the permission is deleted or not Removed bool `gorm:"removed"` }
Permission is the structure to verify action permission
func (Permission) Eval ¶ added in v0.1.2
func (p Permission) Eval(action permtypes.ActionType, blockTime time.Time, opts *permtypes.VerifyOptions, statements []*Statement) permtypes.Effect
Eval is used to evaluate the execution results of permission policies.
func (*Permission) TableName ¶ added in v0.1.2
func (p *Permission) TableName() string
TableName is used to set Permission table name in database
type SlashPrefixTreeNode ¶ added in v0.2.2
type SlashPrefixTreeNode struct { ID uint64 `gorm:"column:id;primaryKey"` PathName string `gorm:"column:path_name;type:varchar(1024);index:idx_bucket_path,priority:2,length:512"` FullName string `gorm:"column:full_name;type:varchar(1024);index:idx_bucket_full_object,priority:2,length:512"` Name string `gorm:"column:name;type:varchar(1024)"` IsObject bool `gorm:"column:is_object;default:false;index:idx_bucket_full_object,priority:3"` IsFolder bool `gorm:"column:is_folder;default:false"` BucketName string `gorm:"column:bucket_name;type:varchar(64);index:idx_bucket_full_object,priority:1;index:idx_bucket_path,priority:1"` ObjectID common.Hash `gorm:"column:object_id;type:BINARY(32);index:idx_object_id"` ObjectName string `gorm:"column:object_name;type:varchar(1024)"` }
SlashPrefixTreeNode A tree structure based on prefixes
func (*SlashPrefixTreeNode) TableName ¶ added in v0.2.2
func (*SlashPrefixTreeNode) TableName() string
TableName is used to set SlashPrefixTreeNode table name in database
type Statement ¶ added in v0.1.2
type Statement struct { // ID defines db auto_increment id of statement ID uint64 `gorm:"id"` // PolicyID is a unique u256 sequence for each policy. It also is used as NFT tokenID PolicyID common.Hash `gorm:"policy_id"` // Effect define the impact of permissions, which is Allow/Deny Effect string `gorm:"effect"` // ActionValue define the operation type you can act. greenfield defines a set of permission // that you can specify in a permissionInfo ActionValue int `gorm:"action_value"` // Resources CAN ONLY BE USED IN bucket level. Support fuzzy match and limit to 5 // If no sub-resource is specified in a statement, then all objects in the bucket are accessible by the principal. // However, if the sub-resource is defined as 'bucket/test_*,' in the statement, then only objects with a 'test_' // prefix can be accessed by the principal. Resources pq.StringArray `gorm:"resources;type:text"` // ExpirationTime defines how long the permission is valid. If not explicitly specified, it means it will not expire. ExpirationTime int64 `gorm:"expiration_time"` // LimitSize defines the total data size that is allowed to operate. If not explicitly specified, it means it will not limit. LimitSize uint64 `gorm:"limit_size"` // Removed defines the statement is deleted or not Removed bool `gorm:"removed"` }
Statement defines the details content of the permission, include effect/actions/sub-resources
func (*Statement) Eval ¶ added in v0.1.2
func (s *Statement) Eval(action permtypes.ActionType, opts *permtypes.VerifyOptions) permtypes.Effect
Eval is used to evaluate the execution results of statement policies.
type StreamRecord ¶
type StreamRecord struct { // ID defines db auto_increment id of stream record ID uint64 `gorm:"id"` // Account defines the account address Account common.Address `gorm:"account"` // CrudTimestamp defines the latest update timestamp of the stream record CrudTimestamp int64 `gorm:"crud_timestamp"` // NetflowRate defines the per-second rate that an account's balance is changing. // It is the sum of the account's inbound and outbound flow rates. NetflowRate *common.Big `gorm:"netflow_rate"` // StaticBalance defines the balance of the stream account at the latest CRUD timestamp. StaticBalance *common.Big `gorm:"static_balance"` // BufferBalance defines reserved balance of the stream account // If the netflow rate is negative, the reserved balance is `netflow_rate * reserve_time` BufferBalance *common.Big `gorm:"buffer_balance"` // LockBalance defines the locked balance of the stream account after it puts a new object and before the object is sealed LockBalance *common.Big `gorm:"lock_balance"` // Status defines the status of the stream account Status string `gorm:"status"` // SettleTimestamp defines the unix timestamp when the stream account will be settled SettleTimestamp int64 `gorm:"column:settle_timestamp"` // OutFlows defines the accumulated outflow rates of the stream account OutFlows []byte `gorm:"out_flows;type:longblob"` }
func (*StreamRecord) TableName ¶
func (s *StreamRecord) TableName() string
TableName is used to set StreamRecord table name in database
Source Files ¶
- block.go
- bucket.go
- bucket_schema.go
- common.go
- const.go
- database.go
- database_mock.go
- epoch_schema.go
- filters.go
- group.go
- group_schema.go
- master.go
- master_schema.go
- object.go
- object_schema.go
- payment.go
- permission.go
- permission_schema.go
- prefix.go
- prefix_schema.go
- statement.go
- statement_schema.go
- store.go
- stream_record_schema.go