dataset

package
v1.2.3 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2023 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Access

type Access map[string]string

Access contains necessary information in order to access a dataset

type Attachment added in v0.5.0

type Attachment struct {
	Name     string
	Modified time.Time
	Size     int64
	URL      string `json:",omitempty"`
}

Attachment contains information about a dataset attachment

type AttachmentRepository added in v0.5.0

type AttachmentRepository interface {
	CreateAttachment(ctx context.Context, id, attachmentName string, attachmentBody multipart.File) error
	DeleteAttachment(ctx context.Context, id, attachmentName string) error
	ListAttachments(ctx context.Context, id string, showURL bool) ([]Attachment, error)
}

AttachmentRepository is an interface for attachment repository

type AuditLogRepository added in v1.0.0

type AuditLogRepository interface {
	CreateLog(ctx context.Context, group, stream string, retention int64, tags []*Tag) error
	GetLog(ctx context.Context, group, stream string) ([]string, error)
	Log(ctx context.Context, account, id string) chan string
}

AuditLogRepository is an interface for audit log repository

type DataRepository

type DataRepository interface {
	Provision(ctx context.Context, id string, tags []*Tag) (string, error)
	Deprovision(ctx context.Context, id string) error
	Delete(ctx context.Context, id string) error
	Describe(ctx context.Context, id string) (*Repository, error)
	SetPolicy(ctx context.Context, id string, derivative bool) error
	GrantAccess(ctx context.Context, id, instanceID string) (Access, error)
	ListAccess(ctx context.Context, id string) (Access, error)
	RevokeAccess(ctx context.Context, id, instanceID string) error
	CreateUser(ctx context.Context, id string) (interface{}, error)
	DeleteUser(ctx context.Context, id string) error
	ListUsers(ctx context.Context, id string) (map[string]interface{}, error)
	UpdateUser(ctx context.Context, id string) (map[string]interface{}, error)
}

DataRepository is an interface for data repository

type Metadata

type Metadata struct {
	ID                  string     `json:"id"`
	Name                string     `json:"name"`
	Description         string     `json:"description"`
	CreatedAt           *time.Time `json:"created_at"`
	CreatedBy           string     `json:"created_by"`
	DataClassifications []string   `json:"data_classifications"`
	DataFormat          string     `json:"data_format"`
	DataStorage         string     `json:"data_storage"`
	Derivative          bool       `json:"derivative"`
	DuaURL              *url.URL   `json:"dua_url"`
	FinalizedAt         *time.Time `json:"finalized_at"`
	FinalizedBy         string     `json:"finalized_by"`
	ModifiedAt          *time.Time `json:"modified_at"`
	ModifiedBy          string     `json:"modified_by"`
	ProctorResponseURL  *url.URL   `json:"proctor_response_url"`
	SourceIDs           []string   `json:"source_ids"`
}

Metadata is the structure of dataset metadata

func (Metadata) MarshalJSON

func (m Metadata) MarshalJSON() ([]byte, error)

MarshalJSON is a custom JSON marshaller for metadata

func (*Metadata) UnmarshalJSON

func (m *Metadata) UnmarshalJSON(j []byte) error

UnmarshalJSON is a custom JSON unmarshaller for metadata

type MetadataRepository

type MetadataRepository interface {
	Create(ctx context.Context, account, id string, metadata *Metadata) (*Metadata, error)
	Get(ctx context.Context, account, id string) (*Metadata, error)
	Promote(ctx context.Context, account, id, user string) (*Metadata, error)
	Update(ctx context.Context, account, id string, metadata *Metadata) (*Metadata, error)
	Delete(ctx context.Context, account, id string) error
}

MetadataRepository is an interface for metadata repository

type Repository

type Repository struct {
	Name  string `json:"name"`
	Empty bool   `json:"empty"`
	Tags  []*Tag `json:"tags"`
}

Repository is information about a data repository

type Service

type Service struct {
	MetadataRepository   MetadataRepository
	AuditLogRepository   AuditLogRepository
	DataRepository       map[string]DataRepository
	AttachmentRepository map[string]AttachmentRepository
}

Service is a collection of the following: - a Metadata Repository for storing dataset metadata - an Audit Log Repository for storing audit logs - one or more Data Repositories for storing datasets - one or more Attachment Repositories for storing attachments

func NewService

func NewService(opts ...ServiceOption) *Service

NewService creates a new dataset service with the provided ServiceOption functions

func (*Service) NewID

func (s *Service) NewID() string

NewID generates a new dataset id

type ServiceOption

type ServiceOption func(*Service)

ServiceOption is a function to set service options

func WithAttachmentRepository added in v0.5.0

func WithAttachmentRepository(repos map[string]AttachmentRepository) ServiceOption

WithAttachmentRepository sets the AttachmentRepository list for the service

func WithAuditLogRepository added in v1.0.0

func WithAuditLogRepository(repo AuditLogRepository) ServiceOption

WithAuditLogRepository sets the AuditLogRepository for the service

func WithDataRepository

func WithDataRepository(repos map[string]DataRepository) ServiceOption

WithDataRepository sets the DataRepository list for the service

func WithMetadataRepository

func WithMetadataRepository(repo MetadataRepository) ServiceOption

WithMetadataRepository sets the MetadataRepository for the service

type Tag

type Tag struct {
	Key   *string `json:"key"`
	Value *string `json:"value"`
}

Tag is the structure of a data repository tag

Jump to

Keyboard shortcuts

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