application

package
v1.112.0 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2026 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const AccessTokenKey contextKey = "access_token"

Variables

View Source
var Approved = State{
	Name:      "approved",
	EnterFunc: ApproveVersion,
}
View Source
var Associated = State{
	Name:      "associated",
	EnterFunc: AssociateVersion,
}
View Source
var EditionConfirmed = State{
	Name:      "edition-confirmed",
	EnterFunc: EditionConfirmVersion,
}
View Source
var Published = State{
	Name:      "published",
	EnterFunc: PublishVersion,
}

Functions

func ApproveVersion added in v1.81.2

func ApproveVersion(ctx context.Context, smDS *StateMachineDatasetAPI,
	currentVersion *models.Version,
	versionUpdate *models.Version,
	versionDetails VersionDetails,
	hasDownloads string,
	authEntityData *sdk.EntityData,
	accessToken string) error

func AssociateVersion

func AssociateVersion(ctx context.Context, smDS *StateMachineDatasetAPI,
	currentVersion *models.Version,
	versionUpdate *models.Version,
	versionDetails VersionDetails,
	hasDownloads string,
	authEntityData *sdk.EntityData,
	accessToken string) error

func EditionConfirmVersion

func EditionConfirmVersion(ctx context.Context, smDS *StateMachineDatasetAPI,
	currentVersion *models.Version,
	versionUpdate *models.Version,
	versionDetails VersionDetails,
	_ string,
	authEntityData *sdk.EntityData,
	accessToken string) error

func PublishDataset

func PublishDataset(ctx context.Context, smDS *StateMachineDatasetAPI,
	currentVersion *models.Version,
	versionUpdate *models.Version,
	versionDetails VersionDetails,
	data log.Data) error

func PublishEdition

func PublishEdition(ctx context.Context, smDS *StateMachineDatasetAPI,
	versionUpdate *models.Version,
	versionDetails VersionDetails, data log.Data) error

func PublishInstance

func PublishInstance(ctx context.Context, smDS *StateMachineDatasetAPI,
	versionUpdate *models.Version,
	data log.Data) error

func PublishVersion

func PublishVersion(ctx context.Context, smDS *StateMachineDatasetAPI,
	currentVersion *models.Version,
	versionUpdate *models.Version,
	versionDetails VersionDetails,
	hasDownloads string,
	authEntityData *sdk.EntityData,
	accessToken string) error

func PublishVersionInfo added in v1.112.0

func PublishVersionInfo(ctx context.Context, smDS *StateMachineDatasetAPI,
	currentVersion *models.Version,
	versionUpdate *models.Version,
	versionDetails VersionDetails,
	authEntityData *sdk.EntityData,
	accessToken string) (updatedVersion *models.Version, err error)

func UpdateVersionInfo

func UpdateVersionInfo(ctx context.Context, smDS *StateMachineDatasetAPI,
	currentVersion *models.Version,
	versionUpdate *models.Version,
	versionDetails VersionDetails) (updatedVersion *models.Version, err error)

Types

type AuditService added in v1.98.0

type AuditService interface {
	RecordDatasetAuditEvent(ctx context.Context, requestedBy models.RequestedBy, action models.Action, resource string, dataset *models.Dataset) error
	RecordVersionAuditEvent(ctx context.Context, requestedBy models.RequestedBy, action models.Action, resource string, version *models.Version) error
	RecordEditionAuditEvent(ctx context.Context, requestedBy models.RequestedBy, action models.Action, resource string, edition *models.Edition) error
	RecordMetadataAuditEvent(ctx context.Context, requestedBy models.RequestedBy, action models.Action, resource string, metadata *models.Metadata) error
}

AuditService defines the interface for audit logging

func NewAuditService added in v1.98.0

func NewAuditService(dataStore store.DataStore) AuditService

NewAuditService creates a new instance of AuditService

type DownloadsGenerator

type DownloadsGenerator interface {
	Generate(ctx context.Context, datasetID, instanceID, edition, version string) error
}

type KeyVal

type KeyVal struct {
	StateVal string
	Type     string
}

type SearchContentUpdatedProducer added in v1.112.0

type SearchContentUpdatedProducer struct {
	Producer download.KafkaProducer
}

type State

type State struct {
	Name      string
	EnterFunc func(ctx context.Context, smDS *StateMachineDatasetAPI,
		currentVersion *models.Version,
		versionUpdate *models.Version,
		versionDetails VersionDetails,
		hasDownloads string,
		authEntityData *sdk.EntityData,
		accessToken string) error
}

func (State) String

func (s State) String() string

type StateMachine

type StateMachine struct {
	DataStore store.DataStore
	// contains filtered or unexported fields
}

func NewStateMachine

func NewStateMachine(ctx context.Context, states []State, transitions []Transition, dataStore store.DataStore) *StateMachine

func (*StateMachine) Transition

func (sm *StateMachine) Transition(ctx context.Context, smDS *StateMachineDatasetAPI,
	currentVersion *models.Version,
	versionUpdate *models.Version,
	versionDetails VersionDetails,
	hasDownloads string,
	authEntityData *sdk.EntityData,
	accessToken string) error

type StateMachineDatasetAPI

type StateMachineDatasetAPI struct {
	DataStore                    store.DataStore
	DownloadGenerators           map[models.DatasetType]DownloadsGenerator
	StateMachine                 *StateMachine
	FilesAPIClient               filesAPISDK.Clienter
	SearchContentUpdatedProducer *SearchContentUpdatedProducer
	CloudflareClient             cloudflare.Clienter
	CloudflareEnabled            bool
	UrlBuilder                   *url.Builder
}

func Setup

func Setup(dataStoreVal store.DataStore, downloadGenerators map[models.DatasetType]DownloadsGenerator, stateMachine *StateMachine, searchContentUpdatedProducer *SearchContentUpdatedProducer, cloudflareClient cloudflare.Clienter, cloudflareEnabled bool, urlBuilder *url.Builder, filesAPIClient filesAPISDK.Clienter) *StateMachineDatasetAPI

func (*StateMachineDatasetAPI) AmendVersion

func (smDS *StateMachineDatasetAPI) AmendVersion(ctx context.Context, vars map[string]string, version *models.Version, authEntityData *sdk.EntityData, accessToken string) (*models.Version, error)

func (*StateMachineDatasetAPI) DeleteStaticVersion added in v1.89.0

func (smDS *StateMachineDatasetAPI) DeleteStaticVersion(ctx context.Context, datasetID, edition string, version int, filesAPIClient filesAPISDK.Clienter, accessToken string) (*models.Version, error)

func (*StateMachineDatasetAPI) PopulateVersionInfo

func (smDS *StateMachineDatasetAPI) PopulateVersionInfo(ctx context.Context, versionUpdate *models.Version, versionDetails VersionDetails) (currentVersion, combinedVersionUpdate *models.Version, err error)

type StaticDatasetService added in v1.112.0

type StaticDatasetService interface {
	GetVersionPublic(ctx context.Context, datasetID, editionID string, versionID int) (*models.Version, error)
	GetVersionPrivate(ctx context.Context, datasetID, editionID string, versionID int) (*models.Version, error)
}

StaticDatasetService defines the interface for operations related to static datasets, editions, and versions.

WARNING: Before calling any method, the caller must ensure the following conditions are met:

  • The dataset exists
  • The dataset type is "static"

These checks are not performed here to avoid duplicate database calls and optimise performance. Handlers are expected to have already performed these checks before calling this service.

func NewStaticDatasetService added in v1.112.0

func NewStaticDatasetService(dataStore store.DataStore) StaticDatasetService

NewStaticDatasetService creates a new instance of StaticDatasetService.

type Transition

type Transition struct {
	Label               string
	TargetState         State
	AllowedSourceStates []string
	Type                string
}

type VersionDetails

type VersionDetails struct {
	// contains filtered or unexported fields
}

VersionDetails contains the details that uniquely identify a version resource

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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