application

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Draft     = State{Name: "DRAFT"}
	InReview  = State{Name: "IN_REVIEW"}
	Approved  = State{Name: "APPROVED"}
	Published = State{Name: "PUBLISHED"}
)

list of states for the state machine

Functions

This section is empty.

Types

type State

type State struct {
	Name string
}

func (State) String

func (s State) String() string

type StateMachine

type StateMachine struct {
	// 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, stateMachineBundleAPI *StateMachineBundleAPI, currentBundle, bundleUpdate *models.Bundle) error

type StateMachineBundleAPI

type StateMachineBundleAPI struct {
	Datastore    store.Datastore
	StateMachine *StateMachine
}

func Setup

func Setup(datastore store.Datastore, stateMachine *StateMachine) *StateMachineBundleAPI

func (*StateMachineBundleAPI) CheckAllBundleContentsAreApproved

func (s *StateMachineBundleAPI) CheckAllBundleContentsAreApproved(ctx context.Context, bundleID string) (bool, error)

func (*StateMachineBundleAPI) CheckBundleExists added in v1.3.0

func (s *StateMachineBundleAPI) CheckBundleExists(ctx context.Context, bundleID string) (bool, error)

func (*StateMachineBundleAPI) CheckContentItemExistsByDatasetEditionVersion added in v1.3.0

func (s *StateMachineBundleAPI) CheckContentItemExistsByDatasetEditionVersion(ctx context.Context, datasetID, editionID string, versionID int) (bool, error)

func (*StateMachineBundleAPI) CreateBundleEvent added in v1.3.0

func (s *StateMachineBundleAPI) CreateBundleEvent(ctx context.Context, event *models.Event) error

func (*StateMachineBundleAPI) CreateContentItem added in v1.3.0

func (s *StateMachineBundleAPI) CreateContentItem(ctx context.Context, contentItem *models.ContentItem) error

func (*StateMachineBundleAPI) GetBundle added in v1.3.0

func (s *StateMachineBundleAPI) GetBundle(ctx context.Context, bundleID string) (*models.Bundle, error)

func (*StateMachineBundleAPI) ListBundleEvents added in v1.3.0

func (s *StateMachineBundleAPI) ListBundleEvents(ctx context.Context, offset, limit int, bundleID string, after, before *time.Time) ([]*models.Event, int, error)

func (*StateMachineBundleAPI) ListBundles

func (s *StateMachineBundleAPI) ListBundles(ctx context.Context, offset, limit int, filters *filters.BundleFilters) ([]*models.Bundle, int, error)

func (*StateMachineBundleAPI) UpdateBundleETag added in v1.3.0

func (s *StateMachineBundleAPI) UpdateBundleETag(ctx context.Context, bundleID, email string) (*models.Bundle, error)

type Transition

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

Jump to

Keyboard shortcuts

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