Documentation ¶
Overview ¶
Package sqldb is a generated GoMock package.
Index ¶
- Constants
- Variables
- func GetCurrentTimestampUs() int64
- func GetCurrentUnixTime() int64
- func GetCurrentYearMonth() string
- func InitDB(config *config.SQLDBConfig) (*gorm.DB, error)
- func LoadDBConfigFromEnv(config *config.SQLDBConfig)
- func MysqlErrCode(err error) int
- func OverrideConfigVacancy(config *config.SQLDBConfig)
- func TimeToYearMonth(t time.Time) string
- func TimestampSecToTime(timeUnix int64) time.Time
- func TimestampUsToTime(ts int64) time.Time
- type Batch
- type Batcher
- type BucketTrafficTable
- type GCObjectTaskTable
- type IntegrityMetaTable
- type Iteratee
- type Iterator
- type JobTable
- type MockJob
- func (m *MockJob) CreateUploadJob(objectInfo *types1.ObjectInfo) (*types.JobContext, error)
- func (m *MockJob) EXPECT() *MockJobMockRecorder
- func (m *MockJob) GetJobByID(jobID uint64) (*types.JobContext, error)
- func (m *MockJob) GetJobByObjectID(objectID uint64) (*types.JobContext, error)
- func (m *MockJob) UpdateJobState(objectID uint64, state types.JobState) error
- type MockJobMockRecorder
- func (mr *MockJobMockRecorder) CreateUploadJob(objectInfo interface{}) *gomock.Call
- func (mr *MockJobMockRecorder) GetJobByID(jobID interface{}) *gomock.Call
- func (mr *MockJobMockRecorder) GetJobByObjectID(objectID interface{}) *gomock.Call
- func (mr *MockJobMockRecorder) UpdateJobState(objectID, state interface{}) *gomock.Call
- type MockObject
- type MockObjectIntegrity
- type MockObjectIntegrityMockRecorder
- type MockObjectMockRecorder
- type MockOffChainAuthKey
- func (m *MockOffChainAuthKey) EXPECT() *MockOffChainAuthKeyMockRecorder
- func (m *MockOffChainAuthKey) GetAuthKey(userAddress, domain string) (*OffChainAuthKeyTable, error)
- func (m *MockOffChainAuthKey) InsertAuthKey(newRecord *OffChainAuthKeyTable) error
- func (m *MockOffChainAuthKey) UpdateAuthKey(userAddress, domain string, oldNonce, newNonce int32, newPublicKey string, ...) error
- type MockOffChainAuthKeyMockRecorder
- type MockSPDB
- func (m *MockSPDB) CheckQuotaAndAddReadRecord(record *corespdb.ReadRecord, quota *corespdb.BucketQuota) error
- func (m *MockSPDB) CreateUploadJob(objectInfo *types1.ObjectInfo) (*types.JobContext, error)
- func (m *MockSPDB) EXPECT() *MockSPDBMockRecorder
- func (m *MockSPDB) FetchAllSp(status ...types0.Status) ([]*types0.StorageProvider, error)
- func (m *MockSPDB) FetchAllSpWithoutOwnSp(status ...types0.Status) ([]*types0.StorageProvider, error)
- func (m *MockSPDB) GetAuthKey(userAddress, domain string) (*OffChainAuthKeyTable, error)
- func (m *MockSPDB) GetBucketReadRecord(bucketID uint64, timeRange *corespdb.TrafficTimeRange) ([]*corespdb.ReadRecord, error)
- func (m *MockSPDB) GetBucketTraffic(bucketID uint64, yearMonth string) (*corespdb.BucketTraffic, error)
- func (m *MockSPDB) GetJobByID(jobID uint64) (*types.JobContext, error)
- func (m *MockSPDB) GetJobByObjectID(objectID uint64) (*types.JobContext, error)
- func (m *MockSPDB) GetObjectInfo(objectID uint64) (*types1.ObjectInfo, error)
- func (m *MockSPDB) GetObjectIntegrity(objectID uint64) (*corespdb.IntegrityMeta, error)
- func (m *MockSPDB) GetObjectReadRecord(objectID uint64, timeRange *corespdb.TrafficTimeRange) ([]*corespdb.ReadRecord, error)
- func (m *MockSPDB) GetOwnSpInfo() (*types0.StorageProvider, error)
- func (m *MockSPDB) GetReadRecord(timeRange *corespdb.TrafficTimeRange) ([]*corespdb.ReadRecord, error)
- func (m *MockSPDB) GetSpByAddress(address string, addressType corespdb.SpAddressType) (*types0.StorageProvider, error)
- func (m *MockSPDB) GetSpByEndpoint(endpoint string) (*types0.StorageProvider, error)
- func (m *MockSPDB) GetStorageParams() (*types1.Params, error)
- func (m *MockSPDB) GetUserReadRecord(userAddress string, timeRange *corespdb.TrafficTimeRange) ([]*corespdb.ReadRecord, error)
- func (m *MockSPDB) InsertAuthKey(newRecord *OffChainAuthKeyTable) error
- func (m *MockSPDB) SetObjectInfo(objectID uint64, objectInfo *types1.ObjectInfo) error
- func (m *MockSPDB) SetObjectIntegrity(integrity *corespdb.IntegrityMeta) error
- func (m *MockSPDB) SetOwnSpInfo(sp *types0.StorageProvider) error
- func (m *MockSPDB) SetStorageParams(params *types1.Params) error
- func (m *MockSPDB) UpdateAllSp(spList []*types0.StorageProvider) error
- func (m *MockSPDB) UpdateAuthKey(userAddress, domain string, oldNonce, newNonce int32, newPublicKey string, ...) error
- func (m *MockSPDB) UpdateJobState(objectID uint64, state types.JobState) error
- type MockSPDBMockRecorder
- func (mr *MockSPDBMockRecorder) CheckQuotaAndAddReadRecord(record, quota interface{}) *gomock.Call
- func (mr *MockSPDBMockRecorder) CreateUploadJob(objectInfo interface{}) *gomock.Call
- func (mr *MockSPDBMockRecorder) FetchAllSp(status ...interface{}) *gomock.Call
- func (mr *MockSPDBMockRecorder) FetchAllSpWithoutOwnSp(status ...interface{}) *gomock.Call
- func (mr *MockSPDBMockRecorder) GetAuthKey(userAddress, domain interface{}) *gomock.Call
- func (mr *MockSPDBMockRecorder) GetBucketReadRecord(bucketID, timeRange interface{}) *gomock.Call
- func (mr *MockSPDBMockRecorder) GetBucketTraffic(bucketID, yearMonth interface{}) *gomock.Call
- func (mr *MockSPDBMockRecorder) GetJobByID(jobID interface{}) *gomock.Call
- func (mr *MockSPDBMockRecorder) GetJobByObjectID(objectID interface{}) *gomock.Call
- func (mr *MockSPDBMockRecorder) GetObjectInfo(objectID interface{}) *gomock.Call
- func (mr *MockSPDBMockRecorder) GetObjectIntegrity(objectID interface{}) *gomock.Call
- func (mr *MockSPDBMockRecorder) GetObjectReadRecord(objectID, timeRange interface{}) *gomock.Call
- func (mr *MockSPDBMockRecorder) GetOwnSpInfo() *gomock.Call
- func (mr *MockSPDBMockRecorder) GetReadRecord(timeRange interface{}) *gomock.Call
- func (mr *MockSPDBMockRecorder) GetSpByAddress(address, addressType interface{}) *gomock.Call
- func (mr *MockSPDBMockRecorder) GetSpByEndpoint(endpoint interface{}) *gomock.Call
- func (mr *MockSPDBMockRecorder) GetStorageParams() *gomock.Call
- func (mr *MockSPDBMockRecorder) GetUserReadRecord(userAddress, timeRange interface{}) *gomock.Call
- func (mr *MockSPDBMockRecorder) InsertAuthKey(newRecord interface{}) *gomock.Call
- func (mr *MockSPDBMockRecorder) SetObjectInfo(objectID, objectInfo interface{}) *gomock.Call
- func (mr *MockSPDBMockRecorder) SetObjectIntegrity(integrity interface{}) *gomock.Call
- func (mr *MockSPDBMockRecorder) SetOwnSpInfo(sp interface{}) *gomock.Call
- func (mr *MockSPDBMockRecorder) SetStorageParams(params interface{}) *gomock.Call
- func (mr *MockSPDBMockRecorder) UpdateAllSp(spList interface{}) *gomock.Call
- func (mr *MockSPDBMockRecorder) UpdateAuthKey(...) *gomock.Call
- func (mr *MockSPDBMockRecorder) UpdateJobState(objectID, state interface{}) *gomock.Call
- type MockSPInfo
- func (m *MockSPInfo) EXPECT() *MockSPInfoMockRecorder
- func (m *MockSPInfo) FetchAllSp(status ...types0.Status) ([]*types0.StorageProvider, error)
- func (m *MockSPInfo) FetchAllSpWithoutOwnSp(status ...types0.Status) ([]*types0.StorageProvider, error)
- func (m *MockSPInfo) GetOwnSpInfo() (*types0.StorageProvider, error)
- func (m *MockSPInfo) GetSpByAddress(address string, addressType corespdb.SpAddressType) (*types0.StorageProvider, error)
- func (m *MockSPInfo) GetSpByEndpoint(endpoint string) (*types0.StorageProvider, error)
- func (m *MockSPInfo) SetOwnSpInfo(sp *types0.StorageProvider) error
- func (m *MockSPInfo) UpdateAllSp(spList []*types0.StorageProvider) error
- type MockSPInfoMockRecorder
- func (mr *MockSPInfoMockRecorder) FetchAllSp(status ...interface{}) *gomock.Call
- func (mr *MockSPInfoMockRecorder) FetchAllSpWithoutOwnSp(status ...interface{}) *gomock.Call
- func (mr *MockSPInfoMockRecorder) GetOwnSpInfo() *gomock.Call
- func (mr *MockSPInfoMockRecorder) GetSpByAddress(address, addressType interface{}) *gomock.Call
- func (mr *MockSPInfoMockRecorder) GetSpByEndpoint(endpoint interface{}) *gomock.Call
- func (mr *MockSPInfoMockRecorder) SetOwnSpInfo(sp interface{}) *gomock.Call
- func (mr *MockSPInfoMockRecorder) UpdateAllSp(spList interface{}) *gomock.Call
- type MockServiceConfig
- type MockServiceConfigMockRecorder
- type MockStorageParam
- type MockStorageParamMockRecorder
- type MockTraffic
- func (m *MockTraffic) CheckQuotaAndAddReadRecord(record *corespdb.ReadRecord, quota *corespdb.BucketQuota) error
- func (m *MockTraffic) EXPECT() *MockTrafficMockRecorder
- func (m *MockTraffic) GetBucketReadRecord(bucketID uint64, timeRange *corespdb.TrafficTimeRange) ([]*corespdb.ReadRecord, error)
- func (m *MockTraffic) GetBucketTraffic(bucketID uint64, yearMonth string) (*corespdb.BucketTraffic, error)
- func (m *MockTraffic) GetObjectReadRecord(objectID uint64, timeRange *corespdb.TrafficTimeRange) ([]*corespdb.ReadRecord, error)
- func (m *MockTraffic) GetReadRecord(timeRange *corespdb.TrafficTimeRange) ([]*corespdb.ReadRecord, error)
- func (m *MockTraffic) GetUserReadRecord(userAddress string, timeRange *corespdb.TrafficTimeRange) ([]*corespdb.ReadRecord, error)
- type MockTrafficMockRecorder
- func (mr *MockTrafficMockRecorder) CheckQuotaAndAddReadRecord(record, quota interface{}) *gomock.Call
- func (mr *MockTrafficMockRecorder) GetBucketReadRecord(bucketID, timeRange interface{}) *gomock.Call
- func (mr *MockTrafficMockRecorder) GetBucketTraffic(bucketID, yearMonth interface{}) *gomock.Call
- func (mr *MockTrafficMockRecorder) GetObjectReadRecord(objectID, timeRange interface{}) *gomock.Call
- func (mr *MockTrafficMockRecorder) GetReadRecord(timeRange interface{}) *gomock.Call
- func (mr *MockTrafficMockRecorder) GetUserReadRecord(userAddress, timeRange interface{}) *gomock.Call
- type ObjectTable
- type OffChainAuthKeyTable
- type PieceHashTable
- type ReadRecordTable
- type ServiceConfigTable
- type SpDBImpl
- func (s *SpDBImpl) CheckQuotaAndAddReadRecord(record *corespdb.ReadRecord, quota *corespdb.BucketQuota) error
- func (s *SpDBImpl) CreateUploadJob(objectInfo *storagetypes.ObjectInfo) (*servicetypes.JobContext, error)
- func (s *SpDBImpl) DeleteAllReplicatePieceChecksum(objectID uint64, replicateIdx uint32, pieceCount uint32) error
- func (s *SpDBImpl) DeleteGCObjectProgress(taskKey string) error
- func (s *SpDBImpl) DeleteObjectIntegrity(objectID uint64) error
- func (s *SpDBImpl) DeleteReplicatePieceChecksum(objectID uint64, replicateIdx uint32, pieceIdx uint32) error
- func (s *SpDBImpl) FetchAllSp(status ...sptypes.Status) ([]*sptypes.StorageProvider, error)
- func (s *SpDBImpl) FetchAllSpWithoutOwnSp(status ...sptypes.Status) ([]*sptypes.StorageProvider, error)
- func (s *SpDBImpl) GetAllGCObjectTask(taskKey string) []task.GCObjectTask
- func (s *SpDBImpl) GetAllReplicatePieceChecksum(objectID uint64, replicateIdx uint32, pieceCount uint32) ([][]byte, error)
- func (s *SpDBImpl) GetAllServiceConfigs() (string, string, error)
- func (s *SpDBImpl) GetAuthKey(userAddress string, domain string) (*corespdb.OffChainAuthKey, error)
- func (s *SpDBImpl) GetBucketReadRecord(bucketID uint64, timeRange *corespdb.TrafficTimeRange) ([]*corespdb.ReadRecord, error)
- func (s *SpDBImpl) GetBucketTraffic(bucketID uint64, yearMonth string) (*corespdb.BucketTraffic, error)
- func (s *SpDBImpl) GetJobByID(jobID uint64) (*servicetypes.JobContext, error)
- func (s *SpDBImpl) GetJobByObjectID(objectID uint64) (*servicetypes.JobContext, error)
- func (s *SpDBImpl) GetObjectInfo(objectID uint64) (*storagetypes.ObjectInfo, error)
- func (s *SpDBImpl) GetObjectIntegrity(objectID uint64) (*corespdb.IntegrityMeta, error)
- func (s *SpDBImpl) GetObjectReadRecord(objectID uint64, timeRange *corespdb.TrafficTimeRange) ([]*corespdb.ReadRecord, error)
- func (s *SpDBImpl) GetOwnSpInfo() (*sptypes.StorageProvider, error)
- func (s *SpDBImpl) GetReadRecord(timeRange *corespdb.TrafficTimeRange) ([]*corespdb.ReadRecord, error)
- func (s *SpDBImpl) GetReplicatePieceChecksum(objectID uint64, replicateIdx uint32, pieceIdx uint32) ([]byte, error)
- func (s *SpDBImpl) GetSpByAddress(address string, addressType corespdb.SpAddressType) (*sptypes.StorageProvider, error)
- func (s *SpDBImpl) GetSpByEndpoint(endpoint string) (*sptypes.StorageProvider, error)
- func (s *SpDBImpl) GetStorageParams() (*storagetypes.Params, error)
- func (s *SpDBImpl) GetUserReadRecord(userAddress string, timeRange *corespdb.TrafficTimeRange) ([]*corespdb.ReadRecord, error)
- func (s *SpDBImpl) InsertAuthKey(newRecord *corespdb.OffChainAuthKey) error
- func (s *SpDBImpl) SetAllReplicatePieceChecksum(objectID uint64, replicateIdx uint32, pieceCount uint32, checksum [][]byte) error
- func (s *SpDBImpl) SetAllServiceConfigs(version, config string) error
- func (s *SpDBImpl) SetGCObjectProgress(taskKey string, curDeletingBlockID uint64, lastDeletedObjectID uint64) error
- func (s *SpDBImpl) SetObjectInfo(objectID uint64, objectInfo *storagetypes.ObjectInfo) error
- func (s *SpDBImpl) SetObjectIntegrity(meta *corespdb.IntegrityMeta) error
- func (s *SpDBImpl) SetOwnSpInfo(sp *sptypes.StorageProvider) error
- func (s *SpDBImpl) SetReplicatePieceChecksum(objectID uint64, replicateIdx uint32, pieceIdx uint32, checksum []byte) error
- func (s *SpDBImpl) SetStorageParams(params *storagetypes.Params) error
- func (s *SpDBImpl) UpdateAllSp(spList []*sptypes.StorageProvider) error
- func (s *SpDBImpl) UpdateAuthKey(userAddress string, domain string, oldNonce int32, newNonce int32, ...) error
- func (s *SpDBImpl) UpdateJobState(objectID uint64, state servicetypes.JobState) error
- type SpInfoTable
- type StorageParamsTable
Constants ¶
const ( // JobTableName defines the job context table name JobTableName = "job" // ObjectTableName defines the object table name ObjectTableName = "object" // GCObjectTaskTableName defines the gc object task table name GCObjectTaskTableName = "gc_object_task" // PieceHashTableName defines the piece hash table name PieceHashTableName = "piece_hash" // IntegrityMetaTableName defines the integrity meta table name IntegrityMetaTableName = "integrity_meta" // SpInfoTableName defines the SP info table name SpInfoTableName = "sp_info" // StorageParamsTableName defines the storage params info table name StorageParamsTableName = "storage_params" // BucketTrafficTableName defines the bucket traffic table name, which is used for recoding the used quota by bucket BucketTrafficTableName = "bucket_traffic" // ReadRecordTableName defines the read record table name ReadRecordTableName = "read_record" // ServiceConfigTableName defines the SP configuration table name ServiceConfigTableName = "service_config" // OffChainAuthKeyTableName defines the off chain auth key table name OffChainAuthKeyTableName = "off_chain_auth_key" )
define table name constant
const ( // SpDBUser defines env variable name for sp db user name SpDBUser = "SP_DB_USER" // SpDBPasswd defines env variable name for sp db user passwd SpDBPasswd = "SP_DB_PASSWORD" // SpDBAddress defines env variable name for sp db address SpDBAddress = "SP_DB_ADDRESS" // SpDBDataBase defines env variable name for sp db database SpDBDataBase = "SP_DB_DATABASE" // DefaultConnMaxLifetime defines the default max liveness time of connection DefaultConnMaxLifetime = 60 // DefaultConnMaxIdleTime defines the default max idle time of connection DefaultConnMaxIdleTime = 30 // DefaultMaxIdleConns defines the default max number of idle connections DefaultMaxIdleConns = 16 // DefaultMaxOpenConns defines the default max number of open connections DefaultMaxOpenConns = 32 )
Variables ¶
var ( // ErrCheckQuotaEnough defines check quota is enough ErrCheckQuotaEnough = errors.New("quota is not enough") )
var (
ErrDuplicateEntryCode = 1062
)
Functions ¶
func GetCurrentTimestampUs ¶
func GetCurrentTimestampUs() int64
GetCurrentTimestampUs return a microsecond timestamp
func GetCurrentUnixTime ¶
func GetCurrentUnixTime() int64
GetCurrentUnixTime return a second timestamp
func GetCurrentYearMonth ¶
func GetCurrentYearMonth() string
GetCurrentYearMonth get current year and month
func LoadDBConfigFromEnv ¶
func LoadDBConfigFromEnv(config *config.SQLDBConfig)
LoadDBConfigFromEnv load db user and password from env vars
func MysqlErrCode ¶ added in v0.2.2
func OverrideConfigVacancy ¶ added in v0.1.1
func OverrideConfigVacancy(config *config.SQLDBConfig)
OverrideConfigVacancy override the SQLDB param zero value
func TimeToYearMonth ¶
TimeToYearMonth convent time.Time to YYYY-MM string
func TimestampSecToTime ¶
TimestampSecToTime convert a second timestamp to time.Time
func TimestampUsToTime ¶
TimestampUsToTime convert a microsecond timestamp to time.Time
Types ¶
type Batch ¶
type Batch interface { // Put inserts the given value into the key-value data store. Put(key interface{}, value interface{}) error // Delete removes the key from the key-value data store. Delete(key interface{}) error // ValueSize retrieves the amount of data queued up for writing. ValueSize() int // Write flushes any accumulated data to disk. Write() error // Reset resets the batch for reuse. Reset() }
Batch is a write-only database that commits changes to its host database when Write is called. A batch cannot be used concurrently.
type Batcher ¶
type Batcher interface { // NewBatch creates a write-only database that buffers changes to its host db // until a final write is called. NewBatch() Batch // NewBatchWithSize creates a write-only database batch with pre-allocated buffer. NewBatchWithSize(size int) Batch }
Batcher wraps the NewBatch method of a backing data store.
type BucketTrafficTable ¶
type BucketTrafficTable struct { BucketID uint64 `gorm:"primary_key"` Month string `gorm:"primary_key"` BucketName string ReadConsumedSize uint64 // ReadQuotaSize = the greenfield chain bucket quota + the sp default free quota ReadQuotaSize uint64 ModifiedTime time.Time }
BucketTrafficTable table schema
func (BucketTrafficTable) TableName ¶
func (BucketTrafficTable) TableName() string
TableName is used to set BucketTraffic Schema's table name in database
type GCObjectTaskTable ¶
type GCObjectTaskTable struct { TaskKey string `gorm:"primary_key"` CurrentDeletingBlockID uint64 LastDeletedObjectID uint64 }
GCObjectTaskTable table schema
func (GCObjectTaskTable) TableName ¶
func (GCObjectTaskTable) TableName() string
TableName is used to set JobTable Schema's table name in database
type IntegrityMetaTable ¶
type IntegrityMetaTable struct { ObjectID uint64 `gorm:"primary_key"` IntegrityChecksum string PieceChecksumList string Signature string }
IntegrityMetaTable table schema
func (IntegrityMetaTable) TableName ¶
func (IntegrityMetaTable) TableName() string
TableName is used to set IntegrityMetaTable schema's table name in database
type Iteratee ¶
type Iteratee interface { // NewIterator creates a binary-alphabetical iterator over a subset // of database content with a particular key prefix, starting at a particular // initial key (or after, if it does not exist). // // Note: This method assumes that the prefix is NOT part of the start, so there's // no need for the caller to prepend the prefix to the start NewIterator(start interface{}) Iterator }
Iteratee wraps the NewIterator methods of a backing data store.
type Iterator ¶
type Iterator interface { // IsValid return true if current element is valid. IsValid() bool // Next move to next Next() // Error returns any accumulated error. Exhausting all the key/value pairs // is not considered to be an error. Error() error // Key returns the key of the current key/value pair, or nil if done. The caller // should not modify the contents of the returned slice, and its contents may // change on the next call to Next. Key() interface{} // Value returns the value of the current key/value pair, or nil if done. The // caller should not modify the contents of the returned slice, and its contents // may change on the next call to Next. Value() interface{} // Release releases associated resources. Release should always succeed and can // be called multiple times without causing error. Release() }
Iterator iterates over a database's key/value pairs in ascending key order.
When it encounters an error any seek will return false and will yield no key/ value pairs. The error can be queried by calling the Error method. Calling Release is still necessary.
An iterator must be released after use, but it is not necessary to read an iterator until exhaustion. An iterator is not safe for concurrent use, but it is safe to use multiple iterators concurrently.
type JobTable ¶
type JobTable struct { JobID uint64 `gorm:"primary_key;autoIncrement"` JobType int32 JobState int32 JobErrorCode uint32 CreatedTime time.Time ModifiedTime time.Time }
JobTable table schema
type MockJob ¶ added in v0.2.0
type MockJob struct {
// contains filtered or unexported fields
}
MockJob is a mock of Job interface.
func NewMockJob ¶ added in v0.2.0
func NewMockJob(ctrl *gomock.Controller) *MockJob
NewMockJob creates a new mock instance.
func (*MockJob) CreateUploadJob ¶ added in v0.2.0
func (m *MockJob) CreateUploadJob(objectInfo *types1.ObjectInfo) (*types.JobContext, error)
CreateUploadJob mocks base method.
func (*MockJob) EXPECT ¶ added in v0.2.0
func (m *MockJob) EXPECT() *MockJobMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockJob) GetJobByID ¶ added in v0.2.0
func (m *MockJob) GetJobByID(jobID uint64) (*types.JobContext, error)
GetJobByID mocks base method.
func (*MockJob) GetJobByObjectID ¶ added in v0.2.0
func (m *MockJob) GetJobByObjectID(objectID uint64) (*types.JobContext, error)
GetJobByObjectID mocks base method.
type MockJobMockRecorder ¶ added in v0.2.0
type MockJobMockRecorder struct {
// contains filtered or unexported fields
}
MockJobMockRecorder is the mock recorder for MockJob.
func (*MockJobMockRecorder) CreateUploadJob ¶ added in v0.2.0
func (mr *MockJobMockRecorder) CreateUploadJob(objectInfo interface{}) *gomock.Call
CreateUploadJob indicates an expected call of CreateUploadJob.
func (*MockJobMockRecorder) GetJobByID ¶ added in v0.2.0
func (mr *MockJobMockRecorder) GetJobByID(jobID interface{}) *gomock.Call
GetJobByID indicates an expected call of GetJobByID.
func (*MockJobMockRecorder) GetJobByObjectID ¶ added in v0.2.0
func (mr *MockJobMockRecorder) GetJobByObjectID(objectID interface{}) *gomock.Call
GetJobByObjectID indicates an expected call of GetJobByObjectID.
func (*MockJobMockRecorder) UpdateJobState ¶ added in v0.2.0
func (mr *MockJobMockRecorder) UpdateJobState(objectID, state interface{}) *gomock.Call
UpdateJobState indicates an expected call of UpdateJobState.
type MockObject ¶ added in v0.2.0
type MockObject struct {
// contains filtered or unexported fields
}
MockObject is a mock of Object interface.
func NewMockObject ¶ added in v0.2.0
func NewMockObject(ctrl *gomock.Controller) *MockObject
NewMockObject creates a new mock instance.
func (*MockObject) EXPECT ¶ added in v0.2.0
func (m *MockObject) EXPECT() *MockObjectMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockObject) GetObjectInfo ¶ added in v0.2.0
func (m *MockObject) GetObjectInfo(objectID uint64) (*types1.ObjectInfo, error)
GetObjectInfo mocks base method.
func (*MockObject) SetObjectInfo ¶ added in v0.2.0
func (m *MockObject) SetObjectInfo(objectID uint64, objectInfo *types1.ObjectInfo) error
SetObjectInfo mocks base method.
type MockObjectIntegrity ¶ added in v0.2.0
type MockObjectIntegrity struct {
// contains filtered or unexported fields
}
MockObjectIntegrity is a mock of ObjectIntegrity interface.
func NewMockObjectIntegrity ¶ added in v0.2.0
func NewMockObjectIntegrity(ctrl *gomock.Controller) *MockObjectIntegrity
NewMockObjectIntegrity creates a new mock instance.
func (*MockObjectIntegrity) EXPECT ¶ added in v0.2.0
func (m *MockObjectIntegrity) EXPECT() *MockObjectIntegrityMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockObjectIntegrity) GetObjectIntegrity ¶ added in v0.2.0
func (m *MockObjectIntegrity) GetObjectIntegrity(objectID uint64) (*corespdb.IntegrityMeta, error)
GetObjectIntegrity mocks base method.
func (*MockObjectIntegrity) SetObjectIntegrity ¶ added in v0.2.0
func (m *MockObjectIntegrity) SetObjectIntegrity(integrity *corespdb.IntegrityMeta) error
SetObjectIntegrity mocks base method.
type MockObjectIntegrityMockRecorder ¶ added in v0.2.0
type MockObjectIntegrityMockRecorder struct {
// contains filtered or unexported fields
}
MockObjectIntegrityMockRecorder is the mock recorder for MockObjectIntegrity.
func (*MockObjectIntegrityMockRecorder) GetObjectIntegrity ¶ added in v0.2.0
func (mr *MockObjectIntegrityMockRecorder) GetObjectIntegrity(objectID interface{}) *gomock.Call
GetObjectIntegrity indicates an expected call of GetObjectIntegrity.
func (*MockObjectIntegrityMockRecorder) SetObjectIntegrity ¶ added in v0.2.0
func (mr *MockObjectIntegrityMockRecorder) SetObjectIntegrity(integrity interface{}) *gomock.Call
SetObjectIntegrity indicates an expected call of SetObjectIntegrity.
type MockObjectMockRecorder ¶ added in v0.2.0
type MockObjectMockRecorder struct {
// contains filtered or unexported fields
}
MockObjectMockRecorder is the mock recorder for MockObject.
func (*MockObjectMockRecorder) GetObjectInfo ¶ added in v0.2.0
func (mr *MockObjectMockRecorder) GetObjectInfo(objectID interface{}) *gomock.Call
GetObjectInfo indicates an expected call of GetObjectInfo.
func (*MockObjectMockRecorder) SetObjectInfo ¶ added in v0.2.0
func (mr *MockObjectMockRecorder) SetObjectInfo(objectID, objectInfo interface{}) *gomock.Call
SetObjectInfo indicates an expected call of SetObjectInfo.
type MockOffChainAuthKey ¶ added in v0.2.0
type MockOffChainAuthKey struct {
// contains filtered or unexported fields
}
MockOffChainAuthKey is a mock of OffChainAuthKey interface.
func NewMockOffChainAuthKey ¶ added in v0.2.0
func NewMockOffChainAuthKey(ctrl *gomock.Controller) *MockOffChainAuthKey
NewMockOffChainAuthKey creates a new mock instance.
func (*MockOffChainAuthKey) EXPECT ¶ added in v0.2.0
func (m *MockOffChainAuthKey) EXPECT() *MockOffChainAuthKeyMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockOffChainAuthKey) GetAuthKey ¶ added in v0.2.0
func (m *MockOffChainAuthKey) GetAuthKey(userAddress, domain string) (*OffChainAuthKeyTable, error)
GetAuthKey mocks base method.
func (*MockOffChainAuthKey) InsertAuthKey ¶ added in v0.2.0
func (m *MockOffChainAuthKey) InsertAuthKey(newRecord *OffChainAuthKeyTable) error
InsertAuthKey mocks base method.
func (*MockOffChainAuthKey) UpdateAuthKey ¶ added in v0.2.0
func (m *MockOffChainAuthKey) UpdateAuthKey(userAddress, domain string, oldNonce, newNonce int32, newPublicKey string, newExpiryDate time.Time) error
UpdateAuthKey mocks base method.
type MockOffChainAuthKeyMockRecorder ¶ added in v0.2.0
type MockOffChainAuthKeyMockRecorder struct {
// contains filtered or unexported fields
}
MockOffChainAuthKeyMockRecorder is the mock recorder for MockOffChainAuthKey.
func (*MockOffChainAuthKeyMockRecorder) GetAuthKey ¶ added in v0.2.0
func (mr *MockOffChainAuthKeyMockRecorder) GetAuthKey(userAddress, domain interface{}) *gomock.Call
GetAuthKey indicates an expected call of GetAuthKey.
func (*MockOffChainAuthKeyMockRecorder) InsertAuthKey ¶ added in v0.2.0
func (mr *MockOffChainAuthKeyMockRecorder) InsertAuthKey(newRecord interface{}) *gomock.Call
InsertAuthKey indicates an expected call of InsertAuthKey.
func (*MockOffChainAuthKeyMockRecorder) UpdateAuthKey ¶ added in v0.2.0
func (mr *MockOffChainAuthKeyMockRecorder) UpdateAuthKey(userAddress, domain, oldNonce, newNonce, newPublicKey, newExpiryDate interface{}) *gomock.Call
UpdateAuthKey indicates an expected call of UpdateAuthKey.
type MockSPDB ¶ added in v0.2.0
type MockSPDB struct {
// contains filtered or unexported fields
}
MockSPDB is a mock of SPDB interface.
func NewMockSPDB ¶ added in v0.2.0
func NewMockSPDB(ctrl *gomock.Controller) *MockSPDB
NewMockSPDB creates a new mock instance.
func (*MockSPDB) CheckQuotaAndAddReadRecord ¶ added in v0.2.0
func (m *MockSPDB) CheckQuotaAndAddReadRecord(record *corespdb.ReadRecord, quota *corespdb.BucketQuota) error
CheckQuotaAndAddReadRecord mocks base method.
func (*MockSPDB) CreateUploadJob ¶ added in v0.2.0
func (m *MockSPDB) CreateUploadJob(objectInfo *types1.ObjectInfo) (*types.JobContext, error)
CreateUploadJob mocks base method.
func (*MockSPDB) EXPECT ¶ added in v0.2.0
func (m *MockSPDB) EXPECT() *MockSPDBMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockSPDB) FetchAllSp ¶ added in v0.2.0
FetchAllSp mocks base method.
func (*MockSPDB) FetchAllSpWithoutOwnSp ¶ added in v0.2.0
func (m *MockSPDB) FetchAllSpWithoutOwnSp(status ...types0.Status) ([]*types0.StorageProvider, error)
FetchAllSpWithoutOwnSp mocks base method.
func (*MockSPDB) GetAuthKey ¶ added in v0.2.0
func (m *MockSPDB) GetAuthKey(userAddress, domain string) (*OffChainAuthKeyTable, error)
GetAuthKey mocks base method.
func (*MockSPDB) GetBucketReadRecord ¶ added in v0.2.0
func (m *MockSPDB) GetBucketReadRecord(bucketID uint64, timeRange *corespdb.TrafficTimeRange) ([]*corespdb.ReadRecord, error)
GetBucketReadRecord mocks base method.
func (*MockSPDB) GetBucketTraffic ¶ added in v0.2.0
func (m *MockSPDB) GetBucketTraffic(bucketID uint64, yearMonth string) (*corespdb.BucketTraffic, error)
GetBucketTraffic mocks base method.
func (*MockSPDB) GetJobByID ¶ added in v0.2.0
func (m *MockSPDB) GetJobByID(jobID uint64) (*types.JobContext, error)
GetJobByID mocks base method.
func (*MockSPDB) GetJobByObjectID ¶ added in v0.2.0
func (m *MockSPDB) GetJobByObjectID(objectID uint64) (*types.JobContext, error)
GetJobByObjectID mocks base method.
func (*MockSPDB) GetObjectInfo ¶ added in v0.2.0
func (m *MockSPDB) GetObjectInfo(objectID uint64) (*types1.ObjectInfo, error)
GetObjectInfo mocks base method.
func (*MockSPDB) GetObjectIntegrity ¶ added in v0.2.0
func (m *MockSPDB) GetObjectIntegrity(objectID uint64) (*corespdb.IntegrityMeta, error)
GetObjectIntegrity mocks base method.
func (*MockSPDB) GetObjectReadRecord ¶ added in v0.2.0
func (m *MockSPDB) GetObjectReadRecord(objectID uint64, timeRange *corespdb.TrafficTimeRange) ([]*corespdb.ReadRecord, error)
GetObjectReadRecord mocks base method.
func (*MockSPDB) GetOwnSpInfo ¶ added in v0.2.0
func (m *MockSPDB) GetOwnSpInfo() (*types0.StorageProvider, error)
GetOwnSpInfo mocks base method.
func (*MockSPDB) GetReadRecord ¶ added in v0.2.0
func (m *MockSPDB) GetReadRecord(timeRange *corespdb.TrafficTimeRange) ([]*corespdb.ReadRecord, error)
GetReadRecord mocks base method.
func (*MockSPDB) GetSpByAddress ¶ added in v0.2.0
func (m *MockSPDB) GetSpByAddress(address string, addressType corespdb.SpAddressType) (*types0.StorageProvider, error)
GetSpByAddress mocks base method.
func (*MockSPDB) GetSpByEndpoint ¶ added in v0.2.0
func (m *MockSPDB) GetSpByEndpoint(endpoint string) (*types0.StorageProvider, error)
GetSpByEndpoint mocks base method.
func (*MockSPDB) GetStorageParams ¶ added in v0.2.0
GetStorageParams mocks base method.
func (*MockSPDB) GetUserReadRecord ¶ added in v0.2.0
func (m *MockSPDB) GetUserReadRecord(userAddress string, timeRange *corespdb.TrafficTimeRange) ([]*corespdb.ReadRecord, error)
GetUserReadRecord mocks base method.
func (*MockSPDB) InsertAuthKey ¶ added in v0.2.0
func (m *MockSPDB) InsertAuthKey(newRecord *OffChainAuthKeyTable) error
InsertAuthKey mocks base method.
func (*MockSPDB) SetObjectInfo ¶ added in v0.2.0
func (m *MockSPDB) SetObjectInfo(objectID uint64, objectInfo *types1.ObjectInfo) error
SetObjectInfo mocks base method.
func (*MockSPDB) SetObjectIntegrity ¶ added in v0.2.0
func (m *MockSPDB) SetObjectIntegrity(integrity *corespdb.IntegrityMeta) error
SetObjectIntegrity mocks base method.
func (*MockSPDB) SetOwnSpInfo ¶ added in v0.2.0
func (m *MockSPDB) SetOwnSpInfo(sp *types0.StorageProvider) error
SetOwnSpInfo mocks base method.
func (*MockSPDB) SetStorageParams ¶ added in v0.2.0
SetStorageParams mocks base method.
func (*MockSPDB) UpdateAllSp ¶ added in v0.2.0
func (m *MockSPDB) UpdateAllSp(spList []*types0.StorageProvider) error
UpdateAllSp mocks base method.
type MockSPDBMockRecorder ¶ added in v0.2.0
type MockSPDBMockRecorder struct {
// contains filtered or unexported fields
}
MockSPDBMockRecorder is the mock recorder for MockSPDB.
func (*MockSPDBMockRecorder) CheckQuotaAndAddReadRecord ¶ added in v0.2.0
func (mr *MockSPDBMockRecorder) CheckQuotaAndAddReadRecord(record, quota interface{}) *gomock.Call
CheckQuotaAndAddReadRecord indicates an expected call of CheckQuotaAndAddReadRecord.
func (*MockSPDBMockRecorder) CreateUploadJob ¶ added in v0.2.0
func (mr *MockSPDBMockRecorder) CreateUploadJob(objectInfo interface{}) *gomock.Call
CreateUploadJob indicates an expected call of CreateUploadJob.
func (*MockSPDBMockRecorder) FetchAllSp ¶ added in v0.2.0
func (mr *MockSPDBMockRecorder) FetchAllSp(status ...interface{}) *gomock.Call
FetchAllSp indicates an expected call of FetchAllSp.
func (*MockSPDBMockRecorder) FetchAllSpWithoutOwnSp ¶ added in v0.2.0
func (mr *MockSPDBMockRecorder) FetchAllSpWithoutOwnSp(status ...interface{}) *gomock.Call
FetchAllSpWithoutOwnSp indicates an expected call of FetchAllSpWithoutOwnSp.
func (*MockSPDBMockRecorder) GetAuthKey ¶ added in v0.2.0
func (mr *MockSPDBMockRecorder) GetAuthKey(userAddress, domain interface{}) *gomock.Call
GetAuthKey indicates an expected call of GetAuthKey.
func (*MockSPDBMockRecorder) GetBucketReadRecord ¶ added in v0.2.0
func (mr *MockSPDBMockRecorder) GetBucketReadRecord(bucketID, timeRange interface{}) *gomock.Call
GetBucketReadRecord indicates an expected call of GetBucketReadRecord.
func (*MockSPDBMockRecorder) GetBucketTraffic ¶ added in v0.2.0
func (mr *MockSPDBMockRecorder) GetBucketTraffic(bucketID, yearMonth interface{}) *gomock.Call
GetBucketTraffic indicates an expected call of GetBucketTraffic.
func (*MockSPDBMockRecorder) GetJobByID ¶ added in v0.2.0
func (mr *MockSPDBMockRecorder) GetJobByID(jobID interface{}) *gomock.Call
GetJobByID indicates an expected call of GetJobByID.
func (*MockSPDBMockRecorder) GetJobByObjectID ¶ added in v0.2.0
func (mr *MockSPDBMockRecorder) GetJobByObjectID(objectID interface{}) *gomock.Call
GetJobByObjectID indicates an expected call of GetJobByObjectID.
func (*MockSPDBMockRecorder) GetObjectInfo ¶ added in v0.2.0
func (mr *MockSPDBMockRecorder) GetObjectInfo(objectID interface{}) *gomock.Call
GetObjectInfo indicates an expected call of GetObjectInfo.
func (*MockSPDBMockRecorder) GetObjectIntegrity ¶ added in v0.2.0
func (mr *MockSPDBMockRecorder) GetObjectIntegrity(objectID interface{}) *gomock.Call
GetObjectIntegrity indicates an expected call of GetObjectIntegrity.
func (*MockSPDBMockRecorder) GetObjectReadRecord ¶ added in v0.2.0
func (mr *MockSPDBMockRecorder) GetObjectReadRecord(objectID, timeRange interface{}) *gomock.Call
GetObjectReadRecord indicates an expected call of GetObjectReadRecord.
func (*MockSPDBMockRecorder) GetOwnSpInfo ¶ added in v0.2.0
func (mr *MockSPDBMockRecorder) GetOwnSpInfo() *gomock.Call
GetOwnSpInfo indicates an expected call of GetOwnSpInfo.
func (*MockSPDBMockRecorder) GetReadRecord ¶ added in v0.2.0
func (mr *MockSPDBMockRecorder) GetReadRecord(timeRange interface{}) *gomock.Call
GetReadRecord indicates an expected call of GetReadRecord.
func (*MockSPDBMockRecorder) GetSpByAddress ¶ added in v0.2.0
func (mr *MockSPDBMockRecorder) GetSpByAddress(address, addressType interface{}) *gomock.Call
GetSpByAddress indicates an expected call of GetSpByAddress.
func (*MockSPDBMockRecorder) GetSpByEndpoint ¶ added in v0.2.0
func (mr *MockSPDBMockRecorder) GetSpByEndpoint(endpoint interface{}) *gomock.Call
GetSpByEndpoint indicates an expected call of GetSpByEndpoint.
func (*MockSPDBMockRecorder) GetStorageParams ¶ added in v0.2.0
func (mr *MockSPDBMockRecorder) GetStorageParams() *gomock.Call
GetStorageParams indicates an expected call of GetStorageParams.
func (*MockSPDBMockRecorder) GetUserReadRecord ¶ added in v0.2.0
func (mr *MockSPDBMockRecorder) GetUserReadRecord(userAddress, timeRange interface{}) *gomock.Call
GetUserReadRecord indicates an expected call of GetUserReadRecord.
func (*MockSPDBMockRecorder) InsertAuthKey ¶ added in v0.2.0
func (mr *MockSPDBMockRecorder) InsertAuthKey(newRecord interface{}) *gomock.Call
InsertAuthKey indicates an expected call of InsertAuthKey.
func (*MockSPDBMockRecorder) SetObjectInfo ¶ added in v0.2.0
func (mr *MockSPDBMockRecorder) SetObjectInfo(objectID, objectInfo interface{}) *gomock.Call
SetObjectInfo indicates an expected call of SetObjectInfo.
func (*MockSPDBMockRecorder) SetObjectIntegrity ¶ added in v0.2.0
func (mr *MockSPDBMockRecorder) SetObjectIntegrity(integrity interface{}) *gomock.Call
SetObjectIntegrity indicates an expected call of SetObjectIntegrity.
func (*MockSPDBMockRecorder) SetOwnSpInfo ¶ added in v0.2.0
func (mr *MockSPDBMockRecorder) SetOwnSpInfo(sp interface{}) *gomock.Call
SetOwnSpInfo indicates an expected call of SetOwnSpInfo.
func (*MockSPDBMockRecorder) SetStorageParams ¶ added in v0.2.0
func (mr *MockSPDBMockRecorder) SetStorageParams(params interface{}) *gomock.Call
SetStorageParams indicates an expected call of SetStorageParams.
func (*MockSPDBMockRecorder) UpdateAllSp ¶ added in v0.2.0
func (mr *MockSPDBMockRecorder) UpdateAllSp(spList interface{}) *gomock.Call
UpdateAllSp indicates an expected call of UpdateAllSp.
func (*MockSPDBMockRecorder) UpdateAuthKey ¶ added in v0.2.0
func (mr *MockSPDBMockRecorder) UpdateAuthKey(userAddress, domain, oldNonce, newNonce, newPublicKey, newExpiryDate interface{}) *gomock.Call
UpdateAuthKey indicates an expected call of UpdateAuthKey.
func (*MockSPDBMockRecorder) UpdateJobState ¶ added in v0.2.0
func (mr *MockSPDBMockRecorder) UpdateJobState(objectID, state interface{}) *gomock.Call
UpdateJobState indicates an expected call of UpdateJobState.
type MockSPInfo ¶ added in v0.2.0
type MockSPInfo struct {
// contains filtered or unexported fields
}
MockSPInfo is a mock of SPInfo interface.
func NewMockSPInfo ¶ added in v0.2.0
func NewMockSPInfo(ctrl *gomock.Controller) *MockSPInfo
NewMockSPInfo creates a new mock instance.
func (*MockSPInfo) EXPECT ¶ added in v0.2.0
func (m *MockSPInfo) EXPECT() *MockSPInfoMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockSPInfo) FetchAllSp ¶ added in v0.2.0
func (m *MockSPInfo) FetchAllSp(status ...types0.Status) ([]*types0.StorageProvider, error)
FetchAllSp mocks base method.
func (*MockSPInfo) FetchAllSpWithoutOwnSp ¶ added in v0.2.0
func (m *MockSPInfo) FetchAllSpWithoutOwnSp(status ...types0.Status) ([]*types0.StorageProvider, error)
FetchAllSpWithoutOwnSp mocks base method.
func (*MockSPInfo) GetOwnSpInfo ¶ added in v0.2.0
func (m *MockSPInfo) GetOwnSpInfo() (*types0.StorageProvider, error)
GetOwnSpInfo mocks base method.
func (*MockSPInfo) GetSpByAddress ¶ added in v0.2.0
func (m *MockSPInfo) GetSpByAddress(address string, addressType corespdb.SpAddressType) (*types0.StorageProvider, error)
GetSpByAddress mocks base method.
func (*MockSPInfo) GetSpByEndpoint ¶ added in v0.2.0
func (m *MockSPInfo) GetSpByEndpoint(endpoint string) (*types0.StorageProvider, error)
GetSpByEndpoint mocks base method.
func (*MockSPInfo) SetOwnSpInfo ¶ added in v0.2.0
func (m *MockSPInfo) SetOwnSpInfo(sp *types0.StorageProvider) error
SetOwnSpInfo mocks base method.
func (*MockSPInfo) UpdateAllSp ¶ added in v0.2.0
func (m *MockSPInfo) UpdateAllSp(spList []*types0.StorageProvider) error
UpdateAllSp mocks base method.
type MockSPInfoMockRecorder ¶ added in v0.2.0
type MockSPInfoMockRecorder struct {
// contains filtered or unexported fields
}
MockSPInfoMockRecorder is the mock recorder for MockSPInfo.
func (*MockSPInfoMockRecorder) FetchAllSp ¶ added in v0.2.0
func (mr *MockSPInfoMockRecorder) FetchAllSp(status ...interface{}) *gomock.Call
FetchAllSp indicates an expected call of FetchAllSp.
func (*MockSPInfoMockRecorder) FetchAllSpWithoutOwnSp ¶ added in v0.2.0
func (mr *MockSPInfoMockRecorder) FetchAllSpWithoutOwnSp(status ...interface{}) *gomock.Call
FetchAllSpWithoutOwnSp indicates an expected call of FetchAllSpWithoutOwnSp.
func (*MockSPInfoMockRecorder) GetOwnSpInfo ¶ added in v0.2.0
func (mr *MockSPInfoMockRecorder) GetOwnSpInfo() *gomock.Call
GetOwnSpInfo indicates an expected call of GetOwnSpInfo.
func (*MockSPInfoMockRecorder) GetSpByAddress ¶ added in v0.2.0
func (mr *MockSPInfoMockRecorder) GetSpByAddress(address, addressType interface{}) *gomock.Call
GetSpByAddress indicates an expected call of GetSpByAddress.
func (*MockSPInfoMockRecorder) GetSpByEndpoint ¶ added in v0.2.0
func (mr *MockSPInfoMockRecorder) GetSpByEndpoint(endpoint interface{}) *gomock.Call
GetSpByEndpoint indicates an expected call of GetSpByEndpoint.
func (*MockSPInfoMockRecorder) SetOwnSpInfo ¶ added in v0.2.0
func (mr *MockSPInfoMockRecorder) SetOwnSpInfo(sp interface{}) *gomock.Call
SetOwnSpInfo indicates an expected call of SetOwnSpInfo.
func (*MockSPInfoMockRecorder) UpdateAllSp ¶ added in v0.2.0
func (mr *MockSPInfoMockRecorder) UpdateAllSp(spList interface{}) *gomock.Call
UpdateAllSp indicates an expected call of UpdateAllSp.
type MockServiceConfig ¶ added in v0.2.0
type MockServiceConfig struct {
// contains filtered or unexported fields
}
MockServiceConfig is a mock of ServiceConfig interface.
func NewMockServiceConfig ¶ added in v0.2.0
func NewMockServiceConfig(ctrl *gomock.Controller) *MockServiceConfig
NewMockServiceConfig creates a new mock instance.
func (*MockServiceConfig) EXPECT ¶ added in v0.2.0
func (m *MockServiceConfig) EXPECT() *MockServiceConfigMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockServiceConfig) GetAllServiceConfigs ¶ added in v0.2.0
func (m *MockServiceConfig) GetAllServiceConfigs() (string, string, error)
GetAllServiceConfigs mocks base method.
func (*MockServiceConfig) SetAllServiceConfigs ¶ added in v0.2.0
func (m *MockServiceConfig) SetAllServiceConfigs(version, config string) error
SetAllServiceConfigs mocks base method.
type MockServiceConfigMockRecorder ¶ added in v0.2.0
type MockServiceConfigMockRecorder struct {
// contains filtered or unexported fields
}
MockServiceConfigMockRecorder is the mock recorder for MockServiceConfig.
func (*MockServiceConfigMockRecorder) GetAllServiceConfigs ¶ added in v0.2.0
func (mr *MockServiceConfigMockRecorder) GetAllServiceConfigs() *gomock.Call
GetAllServiceConfigs indicates an expected call of GetAllServiceConfigs.
func (*MockServiceConfigMockRecorder) SetAllServiceConfigs ¶ added in v0.2.0
func (mr *MockServiceConfigMockRecorder) SetAllServiceConfigs(version, config interface{}) *gomock.Call
SetAllServiceConfigs indicates an expected call of SetAllServiceConfigs.
type MockStorageParam ¶ added in v0.2.0
type MockStorageParam struct {
// contains filtered or unexported fields
}
MockStorageParam is a mock of StorageParam interface.
func NewMockStorageParam ¶ added in v0.2.0
func NewMockStorageParam(ctrl *gomock.Controller) *MockStorageParam
NewMockStorageParam creates a new mock instance.
func (*MockStorageParam) EXPECT ¶ added in v0.2.0
func (m *MockStorageParam) EXPECT() *MockStorageParamMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockStorageParam) GetStorageParams ¶ added in v0.2.0
func (m *MockStorageParam) GetStorageParams() (*types1.Params, error)
GetStorageParams mocks base method.
func (*MockStorageParam) SetStorageParams ¶ added in v0.2.0
func (m *MockStorageParam) SetStorageParams(params *types1.Params) error
SetStorageParams mocks base method.
type MockStorageParamMockRecorder ¶ added in v0.2.0
type MockStorageParamMockRecorder struct {
// contains filtered or unexported fields
}
MockStorageParamMockRecorder is the mock recorder for MockStorageParam.
func (*MockStorageParamMockRecorder) GetStorageParams ¶ added in v0.2.0
func (mr *MockStorageParamMockRecorder) GetStorageParams() *gomock.Call
GetStorageParams indicates an expected call of GetStorageParams.
func (*MockStorageParamMockRecorder) SetStorageParams ¶ added in v0.2.0
func (mr *MockStorageParamMockRecorder) SetStorageParams(params interface{}) *gomock.Call
SetStorageParams indicates an expected call of SetStorageParams.
type MockTraffic ¶ added in v0.2.0
type MockTraffic struct {
// contains filtered or unexported fields
}
MockTraffic is a mock of Traffic interface.
func NewMockTraffic ¶ added in v0.2.0
func NewMockTraffic(ctrl *gomock.Controller) *MockTraffic
NewMockTraffic creates a new mock instance.
func (*MockTraffic) CheckQuotaAndAddReadRecord ¶ added in v0.2.0
func (m *MockTraffic) CheckQuotaAndAddReadRecord(record *corespdb.ReadRecord, quota *corespdb.BucketQuota) error
CheckQuotaAndAddReadRecord mocks base method.
func (*MockTraffic) EXPECT ¶ added in v0.2.0
func (m *MockTraffic) EXPECT() *MockTrafficMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockTraffic) GetBucketReadRecord ¶ added in v0.2.0
func (m *MockTraffic) GetBucketReadRecord(bucketID uint64, timeRange *corespdb.TrafficTimeRange) ([]*corespdb.ReadRecord, error)
GetBucketReadRecord mocks base method.
func (*MockTraffic) GetBucketTraffic ¶ added in v0.2.0
func (m *MockTraffic) GetBucketTraffic(bucketID uint64, yearMonth string) (*corespdb.BucketTraffic, error)
GetBucketTraffic mocks base method.
func (*MockTraffic) GetObjectReadRecord ¶ added in v0.2.0
func (m *MockTraffic) GetObjectReadRecord(objectID uint64, timeRange *corespdb.TrafficTimeRange) ([]*corespdb.ReadRecord, error)
GetObjectReadRecord mocks base method.
func (*MockTraffic) GetReadRecord ¶ added in v0.2.0
func (m *MockTraffic) GetReadRecord(timeRange *corespdb.TrafficTimeRange) ([]*corespdb.ReadRecord, error)
GetReadRecord mocks base method.
func (*MockTraffic) GetUserReadRecord ¶ added in v0.2.0
func (m *MockTraffic) GetUserReadRecord(userAddress string, timeRange *corespdb.TrafficTimeRange) ([]*corespdb.ReadRecord, error)
GetUserReadRecord mocks base method.
type MockTrafficMockRecorder ¶ added in v0.2.0
type MockTrafficMockRecorder struct {
// contains filtered or unexported fields
}
MockTrafficMockRecorder is the mock recorder for MockTraffic.
func (*MockTrafficMockRecorder) CheckQuotaAndAddReadRecord ¶ added in v0.2.0
func (mr *MockTrafficMockRecorder) CheckQuotaAndAddReadRecord(record, quota interface{}) *gomock.Call
CheckQuotaAndAddReadRecord indicates an expected call of CheckQuotaAndAddReadRecord.
func (*MockTrafficMockRecorder) GetBucketReadRecord ¶ added in v0.2.0
func (mr *MockTrafficMockRecorder) GetBucketReadRecord(bucketID, timeRange interface{}) *gomock.Call
GetBucketReadRecord indicates an expected call of GetBucketReadRecord.
func (*MockTrafficMockRecorder) GetBucketTraffic ¶ added in v0.2.0
func (mr *MockTrafficMockRecorder) GetBucketTraffic(bucketID, yearMonth interface{}) *gomock.Call
GetBucketTraffic indicates an expected call of GetBucketTraffic.
func (*MockTrafficMockRecorder) GetObjectReadRecord ¶ added in v0.2.0
func (mr *MockTrafficMockRecorder) GetObjectReadRecord(objectID, timeRange interface{}) *gomock.Call
GetObjectReadRecord indicates an expected call of GetObjectReadRecord.
func (*MockTrafficMockRecorder) GetReadRecord ¶ added in v0.2.0
func (mr *MockTrafficMockRecorder) GetReadRecord(timeRange interface{}) *gomock.Call
GetReadRecord indicates an expected call of GetReadRecord.
func (*MockTrafficMockRecorder) GetUserReadRecord ¶ added in v0.2.0
func (mr *MockTrafficMockRecorder) GetUserReadRecord(userAddress, timeRange interface{}) *gomock.Call
GetUserReadRecord indicates an expected call of GetUserReadRecord.
type ObjectTable ¶
type ObjectTable struct { ObjectID uint64 `gorm:"primary_key"` JobID uint64 `gorm:"index:job_to_object"` // Job.JobID Owner string BucketName string ObjectName string PayloadSize uint64 Visibility int32 ContentType string CreatedAtHeight int64 ObjectStatus int32 RedundancyType int32 SourceType int32 SpIntegrityHash string SecondarySpAddresses string }
ObjectTable table schema
func (ObjectTable) TableName ¶
func (ObjectTable) TableName() string
TableName is used to set ObjectTable Schema's table name in database
type OffChainAuthKeyTable ¶ added in v0.1.2
type OffChainAuthKeyTable struct { UserAddress string `gorm:"primary_key"` Domain string `gorm:"primary_key"` CurrentNonce int32 CurrentPublicKey string NextNonce int32 ExpiryDate time.Time CreatedTime time.Time ModifiedTime time.Time }
OffChainAuthKeyTable table schema
func (OffChainAuthKeyTable) TableName ¶ added in v0.1.2
func (OffChainAuthKeyTable) TableName() string
TableName is used to set JobTable Schema's table name in database
type PieceHashTable ¶ added in v0.2.2
type PieceHashTable struct { ObjectID uint64 `gorm:"primary_key"` ReplicateIndex uint32 `gorm:"primary_key"` PieceIndex uint32 `gorm:"primary_key"` PieceChecksum string }
PieceHashTable table schema
func (PieceHashTable) TableName ¶ added in v0.2.2
func (PieceHashTable) TableName() string
TableName is used to set PieceHashTable schema's table name in database
type ReadRecordTable ¶
type ReadRecordTable struct { ReadRecordID uint64 `gorm:"primary_key;autoIncrement"` BucketID uint64 `gorm:"index:bucket_to_read_record"` ObjectID uint64 `gorm:"index:object_to_read_record"` UserAddress string `gorm:"index:user_to_read_record"` ReadTimestampUs int64 `gorm:"index:time_to_read_record"` // microsecond timestamp BucketName string ObjectName string ReadSize uint64 }
ReadRecordTable table schema
func (ReadRecordTable) TableName ¶
func (ReadRecordTable) TableName() string
TableName is used to set ReadRecord Schema's table name in database
type ServiceConfigTable ¶
ServiceConfigTable table schema
func (ServiceConfigTable) TableName ¶
func (ServiceConfigTable) TableName() string
TableName is used to set ServiceConfigTable Schema's table name in database
type SpDBImpl ¶
type SpDBImpl struct {
// contains filtered or unexported fields
}
SpDBImpl storage provider database, implements SPDB interface
func NewSpDB ¶
func NewSpDB(config *config.SQLDBConfig) (*SpDBImpl, error)
NewSpDB return a database instance
func (*SpDBImpl) CheckQuotaAndAddReadRecord ¶
func (s *SpDBImpl) CheckQuotaAndAddReadRecord(record *corespdb.ReadRecord, quota *corespdb.BucketQuota) error
CheckQuotaAndAddReadRecord check current quota, and add read record TODO: Traffic statistics may be inaccurate in extreme cases, optimize it in the future
func (*SpDBImpl) CreateUploadJob ¶
func (s *SpDBImpl) CreateUploadJob(objectInfo *storagetypes.ObjectInfo) (*servicetypes.JobContext, error)
CreateUploadJob create JobTable record and ObjectTable record; use JobID field for association
func (*SpDBImpl) DeleteAllReplicatePieceChecksum ¶ added in v0.2.2
func (s *SpDBImpl) DeleteAllReplicatePieceChecksum(objectID uint64, replicateIdx uint32, pieceCount uint32) error
DeleteAllReplicatePieceChecksum deletes all the piece checksum.
func (*SpDBImpl) DeleteGCObjectProgress ¶ added in v0.2.2
DeleteGCObjectProgress is used to delete gc object task.
func (*SpDBImpl) DeleteObjectIntegrity ¶ added in v0.2.2
DeleteObjectIntegrity deletes integrity meta info.
func (*SpDBImpl) DeleteReplicatePieceChecksum ¶ added in v0.2.2
func (s *SpDBImpl) DeleteReplicatePieceChecksum(objectID uint64, replicateIdx uint32, pieceIdx uint32) error
DeleteReplicatePieceChecksum deletes piece checksum.
func (*SpDBImpl) FetchAllSp ¶
FetchAllSp get all sp info
func (*SpDBImpl) FetchAllSpWithoutOwnSp ¶
func (s *SpDBImpl) FetchAllSpWithoutOwnSp(status ...sptypes.Status) ([]*sptypes.StorageProvider, error)
FetchAllSpWithoutOwnSp get all spp info without own sp info, own sp is identified by is_own field in db
func (*SpDBImpl) GetAllGCObjectTask ¶
func (s *SpDBImpl) GetAllGCObjectTask(taskKey string) []task.GCObjectTask
GetAllGCObjectTask is unused. TODO: will be implemented in the future, may be used in startup.
func (*SpDBImpl) GetAllReplicatePieceChecksum ¶ added in v0.2.2
func (s *SpDBImpl) GetAllReplicatePieceChecksum(objectID uint64, replicateIdx uint32, pieceCount uint32) ([][]byte, error)
GetAllReplicatePieceChecksum gets all the piece checksums.
func (*SpDBImpl) GetAllServiceConfigs ¶
GetAllServiceConfigs query service config table to get all service configs
func (*SpDBImpl) GetAuthKey ¶ added in v0.1.2
GetAuthKey get OffChainAuthKey from OffChainAuthKeyTable
func (*SpDBImpl) GetBucketReadRecord ¶
func (s *SpDBImpl) GetBucketReadRecord(bucketID uint64, timeRange *corespdb.TrafficTimeRange) ([]*corespdb.ReadRecord, error)
GetBucketReadRecord return bucket record list by time range
func (*SpDBImpl) GetBucketTraffic ¶
func (s *SpDBImpl) GetBucketTraffic(bucketID uint64, yearMonth string) (*corespdb.BucketTraffic, error)
GetBucketTraffic return bucket traffic info
func (*SpDBImpl) GetJobByID ¶
func (s *SpDBImpl) GetJobByID(jobID uint64) (*servicetypes.JobContext, error)
GetJobByID query JobTable by jobID and convert to service/types.JobContext
func (*SpDBImpl) GetJobByObjectID ¶
func (s *SpDBImpl) GetJobByObjectID(objectID uint64) (*servicetypes.JobContext, error)
GetJobByObjectID query JobTable by jobID and convert to service/types.JobContext
func (*SpDBImpl) GetObjectInfo ¶
func (s *SpDBImpl) GetObjectInfo(objectID uint64) (*storagetypes.ObjectInfo, error)
GetObjectInfo query ObjectTable by objectID and convert to storage/types.ObjectInfo.
func (*SpDBImpl) GetObjectIntegrity ¶
func (s *SpDBImpl) GetObjectIntegrity(objectID uint64) (*corespdb.IntegrityMeta, error)
GetObjectIntegrity returns the integrity hash info
func (*SpDBImpl) GetObjectReadRecord ¶
func (s *SpDBImpl) GetObjectReadRecord(objectID uint64, timeRange *corespdb.TrafficTimeRange) ([]*corespdb.ReadRecord, error)
GetObjectReadRecord return object record list by time range
func (*SpDBImpl) GetOwnSpInfo ¶
func (s *SpDBImpl) GetOwnSpInfo() (*sptypes.StorageProvider, error)
GetOwnSpInfo query own sp info in db
func (*SpDBImpl) GetReadRecord ¶
func (s *SpDBImpl) GetReadRecord(timeRange *corespdb.TrafficTimeRange) ([]*corespdb.ReadRecord, error)
GetReadRecord return record list by time range
func (*SpDBImpl) GetReplicatePieceChecksum ¶ added in v0.2.2
func (s *SpDBImpl) GetReplicatePieceChecksum(objectID uint64, replicateIdx uint32, pieceIdx uint32) ([]byte, error)
GetReplicatePieceChecksum gets replicate piece checksum.
func (*SpDBImpl) GetSpByAddress ¶
func (s *SpDBImpl) GetSpByAddress(address string, addressType corespdb.SpAddressType) (*sptypes.StorageProvider, error)
GetSpByAddress query sp info in db by address and address type
func (*SpDBImpl) GetSpByEndpoint ¶
func (s *SpDBImpl) GetSpByEndpoint(endpoint string) (*sptypes.StorageProvider, error)
GetSpByEndpoint query sp info by endpoint
func (*SpDBImpl) GetStorageParams ¶
func (s *SpDBImpl) GetStorageParams() (*storagetypes.Params, error)
GetStorageParams query storage params in db
func (*SpDBImpl) GetUserReadRecord ¶
func (s *SpDBImpl) GetUserReadRecord(userAddress string, timeRange *corespdb.TrafficTimeRange) ([]*corespdb.ReadRecord, error)
GetUserReadRecord return user record list by time range
func (*SpDBImpl) InsertAuthKey ¶ added in v0.1.2
func (s *SpDBImpl) InsertAuthKey(newRecord *corespdb.OffChainAuthKey) error
InsertAuthKey insert a new record into OffChainAuthKeyTable
func (*SpDBImpl) SetAllReplicatePieceChecksum ¶
func (s *SpDBImpl) SetAllReplicatePieceChecksum(objectID uint64, replicateIdx uint32, pieceCount uint32, checksum [][]byte) error
SetAllReplicatePieceChecksum is unused.
func (*SpDBImpl) SetAllServiceConfigs ¶
SetAllServiceConfigs set service configs to db; if there is no data in db, insert a new record otherwise update data in db
func (*SpDBImpl) SetGCObjectProgress ¶
func (s *SpDBImpl) SetGCObjectProgress(taskKey string, curDeletingBlockID uint64, lastDeletedObjectID uint64) error
SetGCObjectProgress is used to insert/update gc object progress.
func (*SpDBImpl) SetObjectInfo ¶
func (s *SpDBImpl) SetObjectInfo(objectID uint64, objectInfo *storagetypes.ObjectInfo) error
SetObjectInfo set ObjectTable's record by objectID
func (*SpDBImpl) SetObjectIntegrity ¶
func (s *SpDBImpl) SetObjectIntegrity(meta *corespdb.IntegrityMeta) error
SetObjectIntegrity puts(overwrites) integrity hash info to db
func (*SpDBImpl) SetOwnSpInfo ¶
func (s *SpDBImpl) SetOwnSpInfo(sp *sptypes.StorageProvider) error
SetOwnSpInfo set(maybe overwrite) own sp info to db
func (*SpDBImpl) SetReplicatePieceChecksum ¶ added in v0.2.2
func (s *SpDBImpl) SetReplicatePieceChecksum(objectID uint64, replicateIdx uint32, pieceIdx uint32, checksum []byte) error
SetReplicatePieceChecksum sets replicate checksum.
func (*SpDBImpl) SetStorageParams ¶
func (s *SpDBImpl) SetStorageParams(params *storagetypes.Params) error
SetStorageParams set(maybe overwrite) storage params to db
func (*SpDBImpl) UpdateAllSp ¶
func (s *SpDBImpl) UpdateAllSp(spList []*sptypes.StorageProvider) error
UpdateAllSp update(maybe overwrite) all sp info in db
func (*SpDBImpl) UpdateAuthKey ¶ added in v0.1.2
func (s *SpDBImpl) UpdateAuthKey(userAddress string, domain string, oldNonce int32, newNonce int32, newPublicKey string, newExpiryDate time.Time) error
UpdateAuthKey update OffChainAuthKey from OffChainAuthKeyTable
func (*SpDBImpl) UpdateJobState ¶
func (s *SpDBImpl) UpdateJobState(objectID uint64, state servicetypes.JobState) error
UpdateJobState update JobTable record's state
type SpInfoTable ¶
type SpInfoTable struct { OperatorAddress string `gorm:"primary_key"` IsOwn bool `gorm:"primary_key"` FundingAddress string SealAddress string ApprovalAddress string TotalDeposit string Status int32 Endpoint string Moniker string Identity string Website string SecurityContact string Details string }
SpInfoTable table schema
func (SpInfoTable) TableName ¶
func (SpInfoTable) TableName() string
TableName is used to set SpInfoTable Schema's table name in database
type StorageParamsTable ¶
type StorageParamsTable struct { ID int64 `gorm:"primary_key;autoIncrement"` MaxSegmentSize uint64 RedundantDataChunkNum uint32 RedundantParityChunkNum uint32 MaxPayloadSize uint64 }
StorageParamsTable table schema
func (StorageParamsTable) TableName ¶
func (StorageParamsTable) TableName() string
TableName is used to set StorageParamsTable Schema's table name in database
Source Files ¶
- batch.go
- const.go
- database_mock.go
- entity.go
- errors.go
- gc_object.go
- gc_object_schema.go
- iterator.go
- job.go
- job_schema.go
- object_integrity.go
- object_integrity_schema.go
- off_chain_auth_key.go
- off_chain_auth_key_schema.go
- service_config.go
- service_config_schema.go
- sp.go
- sp_schema.go
- store.go
- traffic.go
- traffic_schema.go