Documentation ¶
Index ¶
- Constants
- func GetFilesForPath(client core.DynamoDBAPI, tableName string, manifestId string, path string, ...) (*dynamodb.QueryOutput, error)
- func UpdateFileTableStatus(client core.DynamoDBAPI, tableName string, manifestId string, uploadId string, ...) error
- func UpdateManifestStatus(client core.DynamoDBAPI, tableName string, manifestId string, ...) error
- type Dataset
- type DatasetStorage
- type DatasetTeam
- type DatasetUser
- type DbPermission
- type ErrFileNotFound
- type ErrMultipleRowsAffected
- type FeatureFlags
- type File
- type FileParams
- type ManifestFilePrimaryKey
- type ManifestFileTable
- type ManifestTable
- type Organization
- type OrganizationStorage
- type OrganizationUser
- type Package
- type PackageMap
- type PackageParams
- type PackageStorage
- type Token
- type User
Constants ¶
const ( NoPermission DbPermission = 0 Collaborate = 1 Read = 2 Write = 4 Delete = 8 Administer = 16 Owner = 32 )
Variables ¶
This section is empty.
Functions ¶
func GetFilesForPath ¶
func GetFilesForPath(client core.DynamoDBAPI, tableName string, manifestId string, path string, filter string, limit int32, startKey map[string]types.AttributeValue) (*dynamodb.QueryOutput, error)
GetFilesForPath returns files in path for a manifest with optional filter.
func UpdateFileTableStatus ¶
func UpdateFileTableStatus(client core.DynamoDBAPI, tableName string, manifestId string, uploadId string, status manifestFile.Status, msg string) error
UpdateFileTableStatus updates the status of the file in the file-table dynamodb
func UpdateManifestStatus ¶ added in v1.1.0
func UpdateManifestStatus(client core.DynamoDBAPI, tableName string, manifestId string, status manifest.Status) error
UpdateManifestStatus updates the status of the manifest in dynamodb
Types ¶
type Dataset ¶
type DatasetStorage ¶
func (*DatasetStorage) Increment ¶
func (d *DatasetStorage) Increment(db core.PostgresAPI, datasetId int64, size int64) error
Increment increases the storage associated with the provided dataset.
type DatasetTeam ¶
type DatasetUser ¶
type DbPermission ¶
type DbPermission int64
func (DbPermission) String ¶
func (s DbPermission) String() string
type ErrFileNotFound ¶ added in v1.4.2
type ErrFileNotFound struct{}
func (*ErrFileNotFound) Error ¶ added in v1.4.2
func (m *ErrFileNotFound) Error() string
type ErrMultipleRowsAffected ¶ added in v1.4.2
type ErrMultipleRowsAffected struct{}
func (*ErrMultipleRowsAffected) Error ¶ added in v1.4.2
func (m *ErrMultipleRowsAffected) Error() string
type FeatureFlags ¶
type FeatureFlags struct { OrganizationId int64 `json:"organization_id"` Feature string `json:"feature"` Enabled bool `json:"enabled"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` }
func (*FeatureFlags) GetAll ¶
func (d *FeatureFlags) GetAll(db core.PostgresAPI, organizationId int64) ([]FeatureFlags, error)
GetAll returns all rows in the FeatureFlags Table
type File ¶
type File struct { Id string `json:"id"` PackageId int `json:"package_id"` Name string `json:"name"` FileType fileType.Type `json:"file_type"` S3Bucket string `json:"s3_bucket"` S3Key string `json:"s3_key"` ObjectType objectType.ObjectType `json:"object_type"` Size int64 `json:"size"` CheckSum string `json:"checksum"` UUID uuid.UUID `json:"uuid"` ProcessingState processingState.ProcessingState `json:"processing_state"` UploadedState uploadState.UploadedState `json:"uploaded_state"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` }
func (*File) Add ¶
func (p *File) Add(db core.PostgresAPI, files []FileParams) ([]File, error)
func (*File) UpdateBucket ¶
func (p *File) UpdateBucket(db core.PostgresAPI, uploadId string, bucket string, s3Key string, organizationId int64) error
UpdateBucket updates the storage bucket as part of upload process and sets Status
type FileParams ¶
type FileParams struct { PackageId int `json:"package_id"` Name string `json:"name"` FileType fileType.Type `json:"file_type"` S3Bucket string `json:"s3_bucket"` S3Key string `json:"s3_key"` ObjectType objectType.ObjectType `json:"object_type"` Size int64 `json:"size"` CheckSum string `json:"checksum"` Sha256 string `json:"sha256"` UUID uuid.UUID `json:"uuid"` }
type ManifestFilePrimaryKey ¶
type ManifestFileTable ¶
type ManifestFileTable struct { ManifestId string `dynamodbav:"ManifestId"` UploadId string `dynamodbav:"UploadId"` FilePath string `dynamodbav:"FilePath,omitempty"` FileName string `dynamodbav:"FileName"` MergePackageId string `dynamodbav:"MergePackageId,omitempty"` Status string `dynamodbav:"Status"` FileType string `dynamodbav:"FileType"` InProgress string `dynamodbav:"InProgress"` }
ManifestFileTable is a representation of a ManifestFile in DynamoDB
func GetFilesPaginated ¶
func GetFilesPaginated(client core.DynamoDBAPI, tableName string, manifestId string, status sql.NullString, limit int32, startKey map[string]types.AttributeValue) ([]ManifestFileTable, map[string]types.AttributeValue, error)
GetFilesPaginated returns paginated list of files for a given manifestID and optional status.
func GetManifestFile ¶
func GetManifestFile(client core.DynamoDBAPI, tableName string, manifestId string, uploadId string) (*ManifestFileTable, error)
GetManifestFile returns a manifest file from the ManifestFile Table.
type ManifestTable ¶
type ManifestTable struct { ManifestId string `dynamodbav:"ManifestId"` DatasetId int64 `dynamodbav:"DatasetId"` DatasetNodeId string `dynamodbav:"DatasetNodeId"` OrganizationId int64 `dynamodbav:"OrganizationId"` UserId int64 `dynamodbav:"UserId"` Status string `dynamodbav:"Status"` DateCreated int64 `dynamodbav:"DateCreated"` }
ManifestTable is a representation of a Manifest in DynamoDB
func GetFromManifest ¶
func GetFromManifest(client core.DynamoDBAPI, manifestTableName string, manifestId string) (*ManifestTable, error)
GetFromManifest returns a Manifest item for a given manifest ID.
func GetManifestsForDataset ¶
func GetManifestsForDataset(client core.DynamoDBAPI, manifestTableName string, datasetNodeId string) ([]ManifestTable, error)
GetManifestsForDataset returns all manifests for a given dataset.
type Organization ¶
type Organization struct { Id int64 `json:"id"` Name string `json:"name"` Slug string `json:"slug"` NodeId string `json:"node_id"` StorageBucket sql.NullString `json:"storage_bucket"` PublishBucket sql.NullString `json:"publish_bucket"` EmbargoBucket sql.NullString `json:"embargo_bucket"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` }
func (*Organization) Get ¶
func (o *Organization) Get(db core.PostgresAPI, id int64) (*Organization, error)
type OrganizationStorage ¶
type OrganizationStorage struct { OrganizationId int64 `json:"organization_id"` Size int64 `json:"size"` }
func (*OrganizationStorage) Increment ¶
func (d *OrganizationStorage) Increment(db core.PostgresAPI, organizationId int64, size int64) error
Increment increases the storage associated with the provided organization.
type OrganizationUser ¶
type OrganizationUser struct { OrganizationId int64 `json:"organization_id"` UserId int64 `json:"user_id"` DbPermission DbPermission `json:"permission_bit"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` }
func (*OrganizationUser) GetByUserId ¶
func (o *OrganizationUser) GetByUserId(db core.PostgresAPI, id int64) (*OrganizationUser, error)
type Package ¶
type Package struct { Id int64 `json:"id"` Name string `json:"name"` PackageType packageType.Type `json:"type"` PackageState packageState.State `json:"state"` NodeId string `json:"node_id"` ParentId sql.NullInt64 `json:"parent_id"` DatasetId int `json:"dataset_id"` OwnerId int `json:"owner_id"` Size sql.NullInt64 `json:"size"` ImportId sql.NullString `json:"import_id"` Attributes []packageInfo.PackageAttribute `json:"attributes"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` }
Package is a representation of a container on Pennsieve that contains one or more sourceFiles
func (*Package) Add ¶
func (p *Package) Add(db core.PostgresAPI, records []PackageParams) ([]Package, error)
Add adds multiple packages to the Pennsieve Postgres DB
type PackageParams ¶
type PackageParams struct { Name string `json:"name"` PackageType packageType.Type `json:"type"` PackageState packageState.State `json:"state"` NodeId string `json:"node_id"` ParentId int64 `json:"parent_id"` DatasetId int `json:"dataset_id"` OwnerId int `json:"owner_id"` Size int64 `json:"size"` ImportId sql.NullString `json:"import_id"` Attributes []packageInfo.PackageAttribute `json:"attributes"` }
PackageParams is used as the input to create a package
type PackageStorage ¶
func (*PackageStorage) Increment ¶
func (p *PackageStorage) Increment(db core.PostgresAPI, packageId int64, size int64) error
Increment increases the storage associated with the provided package.
func (*PackageStorage) IncrementAncestors ¶
func (p *PackageStorage) IncrementAncestors(db core.PostgresAPI, parentId int64, size int64) error
IncrementAncestors increases the storage associated with the parents of the provided package.
type Token ¶
type Token struct { Id int64 `json:"id"` Name string `json:"name"` Token string `json:"token"` OrganizationId string `json:"organization_id"` UserId bool `json:"user_id"` CognitoId string `json:"cognito_id"` LastUsed int64 `json:"last_used"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` }
func (*Token) GetByCognitoId ¶
GetByCognitoId returns a user from Postgress based on his/her cognito-id This function also returns the preferred org and whether the user is a super-admin.
func (*Token) GetUserByCognitoId ¶
GetUserByCognitoId returns a Pennsieve User based on the cognito id in the token pool.
type User ¶
type User struct { Id int64 `json:"id"` NodeId string `json:"node_id"` Email string `json:"email"` FirstName string `json:"first_name"` LastName string `json:"last_name"` IsSuperAdmin bool `json:"is_super_admin"` PreferredOrg int64 `json:"preferred_org_id"` }
func (*User) GetByCognitoId ¶
GetByCognitoId returns a user from Postgress based on his/her cognito-id This function also returns the preferred org and whether the user is a super-admin.