Documentation ¶
Index ¶
- Constants
- func GetTestAWSConfig(t *testing.T, mockSqsUrl string) aws.Config
- func NewTestPackageNodeId(pt packageType.Type) string
- func RandPackageState() packageState.State
- func RandPackageType() packageType.Type
- func RandString(n int) string
- type AWSError
- type DeleteObjectsVersionResponse
- type DeletedPackage
- type DynamoDBFixture
- type DynamoDBStore
- type Fixture
- type GetDeleteMarkerVersionsResponse
- type ModelScanner
- type NoLogger
- func (n NoLogger) LogDebug(_ ...any)
- func (n NoLogger) LogDebugWithFields(_ log.Fields, _ ...any)
- func (n NoLogger) LogError(_ ...any)
- func (n NoLogger) LogErrorWithFields(_ log.Fields, _ ...any)
- func (n NoLogger) LogInfo(_ ...any)
- func (n NoLogger) LogInfoWithFields(_ log.Fields, _ ...any)
- func (n NoLogger) LogWarn(_ ...any)
- func (n NoLogger) LogWarnWithFields(_ log.Fields, _ ...any)
- type NoSQLStore
- type ObjectStore
- type PackageScanner
- type PackageStateTransition
- type PostgresConfig
- type PostgresOption
- type PostgresStoreFactory
- type Queries
- func (q *Queries) GetDatasetByNodeId(ctx context.Context, dsNodeId string) (*pgdb.Dataset, error)
- func (q *Queries) GetPackageByNodeId(ctx context.Context, packageId string) (*pgdb.Package, error)
- func (q *Queries) IncrementDatasetStorage(ctx context.Context, datasetId int64, sizeIncrement int64) error
- func (q *Queries) IncrementOrganizationStorage(ctx context.Context, organizationId int64, sizeIncrement int64) error
- func (q *Queries) IncrementPackageStorage(ctx context.Context, packageId int64, sizeIncrement int64) error
- func (q *Queries) IncrementPackageStorageAncestors(ctx context.Context, parentId int64, size int64) error
- func (q *Queries) NewSavepoint(ctx context.Context, name string) error
- func (q *Queries) ReleaseSavepoint(ctx context.Context, name string) error
- func (q *Queries) RollbackToSavepoint(ctx context.Context, name string) error
- func (q *Queries) TransitionAncestorPackageState(ctx context.Context, parentId int64, ...) ([]*pgdb.Package, error)
- func (q *Queries) TransitionDescendantPackageState(ctx context.Context, datasetId, packageId int64, ...) ([]*pgdb.Package, error)
- func (q *Queries) TransitionPackageState(ctx context.Context, datasetId int64, packageId string, ...) (*pgdb.Package, error)
- func (q *Queries) TransitionPackageStateBulk(ctx context.Context, datasetId int64, transitions []PackageStateTransition) ([]*pgdb.Package, error)
- func (q *Queries) UpdatePackageName(ctx context.Context, packageId int64, newName string) error
- type QueueStore
- type RowScanner
- type S3Fixture
- type S3ObjectInfo
- type S3Store
- type SQLStore
- type SQLStoreFactory
- type TestDB
- func (tdb *TestDB) Close()
- func (tdb *TestDB) CloseRows(rows *sql.Rows)
- func (tdb *TestDB) ExecSQLFile(sqlFile string)
- func (tdb *TestDB) PingUntilReady() error
- func (tdb *TestDB) Queries(orgId int) *Queries
- func (tdb *TestDB) Truncate(orgID int, table string)
- func (tdb *TestDB) TruncatePennsieve(table string)
- type TestPackage
- func (p *TestPackage) AsPackage() pgdb.Package
- func (p *TestPackage) Deleted() *TestPackage
- func (p *TestPackage) Insert(ctx context.Context, db TestDB, orgId int) *pgdb.Package
- func (p *TestPackage) Restoring() *TestPackage
- func (p *TestPackage) WithDeletedName() *TestPackage
- func (p *TestPackage) WithName(name string) *TestPackage
- func (p *TestPackage) WithParentId(parentId int64) *TestPackage
- func (p *TestPackage) WithState(ps packageState.State) *TestPackage
- func (p *TestPackage) WithType(pt packageType.Type) *TestPackage
- type TestPackageAttribute
- type TestPackageAttributes
Constants ¶
View Source
const (
DeleteRecordTableNameEnvKey = "DELETE_RECORD_DYNAMODB_TABLE_NAME"
)
Variables ¶
This section is empty.
Functions ¶
func NewTestPackageNodeId ¶
func NewTestPackageNodeId(pt packageType.Type) string
func RandPackageState ¶
func RandPackageState() packageState.State
func RandPackageType ¶
func RandPackageType() packageType.Type
func RandString ¶
Types ¶
type DeleteObjectsVersionResponse ¶
type DeleteObjectsVersionResponse struct { Deleted []DeletedPackage AWSErrors []AWSError }
type DeletedPackage ¶
type DynamoDBFixture ¶
type DynamoDBFixture struct { Fixture Client *dynamodb.Client // Tables is a set of table names Tables map[string]bool }
func NewDynamoDBFixture ¶
func NewDynamoDBFixture(t *testing.T, client *dynamodb.Client, inputs ...*dynamodb.CreateTableInput) *DynamoDBFixture
func (*DynamoDBFixture) Teardown ¶
func (f *DynamoDBFixture) Teardown()
func (*DynamoDBFixture) WithItems ¶
func (f *DynamoDBFixture) WithItems(inputs ...*dynamodb.PutItemInput) *DynamoDBFixture
type DynamoDBStore ¶
func NewDynamoDBStore ¶
func NewDynamoDBStore(client *dynamodb.Client) *DynamoDBStore
func (*DynamoDBStore) WithLogging ¶
func (d *DynamoDBStore) WithLogging(log *logging.Log) NoSQLStore
type GetDeleteMarkerVersionsResponse ¶
type GetDeleteMarkerVersionsResponse map[string]*S3ObjectInfo
type ModelScanner ¶
func NewModelScanner ¶
func NewModelScanner(columnNames []string) *ModelScanner
func (*ModelScanner) QualifiedColumnNamesString ¶
func (ms *ModelScanner) QualifiedColumnNamesString(qualifier string) string
type NoSQLStore ¶
type NoSQLStore interface { GetDeleteMarkerVersions(ctx context.Context, restoring ...*models.RestorePackageInfo) (GetDeleteMarkerVersionsResponse, error) RemoveDeleteRecords(ctx context.Context, restoring []*models.RestorePackageInfo) error logging.Logger }
type ObjectStore ¶
type ObjectStore interface { DeleteObjectsVersion(ctx context.Context, objInfos ...S3ObjectInfo) (DeleteObjectsVersionResponse, error) logging.Logger }
type PackageScanner ¶
type PackageScanner struct { *ModelScanner QualifiedColumnNamesString string }
func NewPackageScanner ¶
func NewPackageScanner(columnNames []string) *PackageScanner
func (PackageScanner) Scan ¶
func (s PackageScanner) Scan(scanner RowScanner, pkg *pgdb.Package) error
type PackageStateTransition ¶
type PackageStateTransition struct { // NodeId: package node id NodeId string // Expected: expected current state of package Expected packageState.State // Target: desired state of package Target packageState.State }
type PostgresConfig ¶
type PostgresConfig struct { Host string Port string User string Password string DBName string SSLMode string }
func PostgresConfigFromEnv ¶
func PostgresConfigFromEnv() *PostgresConfig
func (*PostgresConfig) LogString ¶
func (c *PostgresConfig) LogString() string
func (*PostgresConfig) Open ¶
func (c *PostgresConfig) Open(additionalOptions ...PostgresOption) (*sql.DB, error)
func (*PostgresConfig) OpenAtSchema ¶
func (c *PostgresConfig) OpenAtSchema(schema string) (*sql.DB, error)
func (*PostgresConfig) String ¶
func (c *PostgresConfig) String() string
type PostgresOption ¶
func (*PostgresOption) String ¶
func (o *PostgresOption) String() string
type PostgresStoreFactory ¶
func NewPostgresStoreFactory ¶
func NewPostgresStoreFactory(db *sql.DB) *PostgresStoreFactory
func (*PostgresStoreFactory) WithLogging ¶
func (s *PostgresStoreFactory) WithLogging(log logging.Logger) SQLStoreFactory
type Queries ¶
func (*Queries) GetDatasetByNodeId ¶
func (*Queries) GetPackageByNodeId ¶
func (*Queries) IncrementDatasetStorage ¶
func (*Queries) IncrementOrganizationStorage ¶
func (*Queries) IncrementPackageStorage ¶
func (*Queries) IncrementPackageStorageAncestors ¶
func (q *Queries) IncrementPackageStorageAncestors(ctx context.Context, parentId int64, size int64) error
IncrementPackageStorageAncestors increases the storage associated with the parents of the provided package.
func (*Queries) NewSavepoint ¶
func (*Queries) ReleaseSavepoint ¶
func (*Queries) RollbackToSavepoint ¶
func (*Queries) TransitionAncestorPackageState ¶
func (*Queries) TransitionDescendantPackageState ¶
func (*Queries) TransitionPackageState ¶
func (*Queries) TransitionPackageStateBulk ¶
type QueueStore ¶
type QueueStore interface {
SendRestorePackage(ctx context.Context, restoreMessage models.RestorePackageMessage) error
}
func NewQueueStore ¶
func NewQueueStore(sqsClient *sqs.Client) QueueStore
type RowScanner ¶
type S3Fixture ¶
type S3Fixture struct { Fixture Client *s3.Client // Buckets is a set of bucket names Buckets map[string]bool }
func NewS3Fixture ¶
func (*S3Fixture) WithObjects ¶
func (f *S3Fixture) WithObjects(objectInputs ...*s3.PutObjectInput) *S3Fixture
type S3ObjectInfo ¶
type S3ObjectInfo struct { NodeId string `dynamodbav:"NodeId"` Bucket string `dynamodbav:"S3Bucket"` Key string `dynamodbav:"S3Key"` VersionId string `dynamodbav:"S3ObjectVersion"` Size string `dynamodbav:"ObjectSize"` }
func (*S3ObjectInfo) GetSize ¶
func (o *S3ObjectInfo) GetSize() (int64, error)
type S3Store ¶
func NewS3Store ¶
func (*S3Store) WithLogging ¶
func (s *S3Store) WithLogging(log *logging.Log) ObjectStore
type SQLStore ¶
type SQLStore interface { UpdatePackageName(ctx context.Context, packageId int64, newName string) error GetDatasetByNodeId(ctx context.Context, dsNodeId string) (*pgdb.Dataset, error) // TransitionPackageState updates the state of the given package from expectedState to targetState and returns the resulting package. // If the package is not already in expectedState, then models.PackageNotFoundError is returned. TransitionPackageState(ctx context.Context, datasetId int64, packageId string, expectedState, targetState packageState.State) (*pgdb.Package, error) // TransitionPackageStateBulk updates the state of the given packages from expectedStates to targetStates and returns the resulting packages. TransitionPackageStateBulk(ctx context.Context, datasetId int64, transitions []PackageStateTransition) ([]*pgdb.Package, error) // TransitionDescendantPackageState updates the state of any descendants of the given package which have state == expectedState to targetState and returns the updated packages. // It does not update the state of the package with id packageId, only its descendants if any. TransitionDescendantPackageState(ctx context.Context, datasetId, packageId int64, expectedState, targetState packageState.State) ([]*pgdb.Package, error) // TransitionAncestorPackageState updates the state of any ancestors of the package with the given parentId which have state == expectedState to targetState and returns the updated packages. TransitionAncestorPackageState(ctx context.Context, parentId int64, expectedState, targetState packageState.State) ([]*pgdb.Package, error) NewSavepoint(ctx context.Context, name string) error RollbackToSavepoint(ctx context.Context, name string) error ReleaseSavepoint(ctx context.Context, name string) error IncrementOrganizationStorage(ctx context.Context, organizationId int64, sizeIncrement int64) error IncrementDatasetStorage(ctx context.Context, datasetId int64, sizeIncrement int64) error IncrementPackageStorage(ctx context.Context, packageId int64, sizeIncrement int64) error IncrementPackageStorageAncestors(ctx context.Context, parentId int64, size int64) error GetPackageByNodeId(ctx context.Context, packageId string) (*pgdb.Package, error) logging.Logger }
type SQLStoreFactory ¶
type TestDB ¶
func (*TestDB) ExecSQLFile ¶
func (*TestDB) PingUntilReady ¶
PingUntilReady pings the db up to 10 times, stopping when a ping is successful. Used because there have been problems on Jenkins with the test DB not being fully started and ready to make connections. But there must be a better way.
func (*TestDB) TruncatePennsieve ¶
type TestPackage ¶
func NewTestPackage ¶
func NewTestPackage(id int64, datasetId int, ownerId int) *TestPackage
func (*TestPackage) AsPackage ¶
func (p *TestPackage) AsPackage() pgdb.Package
func (*TestPackage) Deleted ¶
func (p *TestPackage) Deleted() *TestPackage
func (*TestPackage) Restoring ¶
func (p *TestPackage) Restoring() *TestPackage
func (*TestPackage) WithDeletedName ¶
func (p *TestPackage) WithDeletedName() *TestPackage
func (*TestPackage) WithName ¶
func (p *TestPackage) WithName(name string) *TestPackage
func (*TestPackage) WithParentId ¶
func (p *TestPackage) WithParentId(parentId int64) *TestPackage
func (*TestPackage) WithState ¶
func (p *TestPackage) WithState(ps packageState.State) *TestPackage
func (*TestPackage) WithType ¶
func (p *TestPackage) WithType(pt packageType.Type) *TestPackage
type TestPackageAttribute ¶
type TestPackageAttribute struct {
packageInfo.PackageAttribute
}
func NewTestPackageAttribute ¶
func NewTestPackageAttribute() *TestPackageAttribute
func (*TestPackageAttribute) AsPackageAttribute ¶
func (a *TestPackageAttribute) AsPackageAttribute() packageInfo.PackageAttribute
type TestPackageAttributes ¶
type TestPackageAttributes []TestPackageAttribute
func NewTestPackageAttributes ¶
func NewTestPackageAttributes(len int) TestPackageAttributes
func (TestPackageAttributes) AsPackageAttributes ¶
func (as TestPackageAttributes) AsPackageAttributes() packageInfo.PackageAttributes
Source Files ¶
Click to show internal directories.
Click to hide internal directories.