manifest

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2022 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Overview

Package manifest provides an alternative data format for representing poolstores that is easier to edit by hand, because default options can be specified for activities within a given pool, where usually the details are similar except for the stream details

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetConfigModel

func GetConfigModel(c Config) *models.Config

GetConfigModel returns a pointer of type model.Config representing the configuration

func GetStreamsModel

func GetStreamsModel(streams map[string]*Stream) []*models.Stream

GetStreamsModel returns an array of pointers to models.Streams representing the stream map

func UploadManifest

func UploadManifest(bc *apiclient.Bc, auth runtime.ClientAuthInfoWriter, timeout time.Duration, m Manifest) (*models.StoreStatus, error)

UploadManifest uploads a manifest to the booking server

Types

type Activity

type Activity struct {
	Config Config `yaml:"config"`

	Description Ref `yaml:"description"`

	UISet Ref `yaml:"UISet"`

	ExpiresAt int64 `yaml:"exp"`

	Streams map[string]*Stream `yaml:"streams"`
}

Activity represents an activity

type Config

type Config struct {
	URL string `yaml:"url"`
}

Config represents a configuration for a user interface

type Description

type Description struct {
	Name    string `json:"name"`
	Type    string `json:"type"`
	Short   string `json:"short,omitempty"`
	Long    string `json:"long,omitempty"`
	Further string `json:"further,omitempty"`
	Thumb   string `json:"thumb,omitempty"`
	Image   string `json:"image,omitempty"`
}

Description represents a description of an activity, for displaying in the booking system / application

func (*Description) ToModel

func (d *Description) ToModel() *models.Description

ToModel returns a pointer of type models.Description representing the description

type Group

type Group struct {
	// Pools represents all the pools in the group
	Pools []Ref
}

Group represnts a booking group (a list of pools)

type Manifest

type Manifest struct {

	// Groups represents all the groups in the poolstore
	Groups map[Ref]*Group `yaml:"groups"`

	// Pools represents all the pools in the poolstore
	Pools map[Ref]*Pool `yaml:"pools"`

	Activities map[Ref]*Activity `yaml:"activities"`

	UIs map[Ref]*UI

	UISets map[Ref]*UISet `yaml:"UISets"`

	Descriptions map[Ref]*Description
}

Manifest represents a complete listing of the experiments available to book

func Example

func Example(exp int64) *Manifest

Example returns a pointer to an example manifest (used for testing)

func (*Manifest) GetActivitiesInPool

func (m *Manifest) GetActivitiesInPool(pref Ref) []*models.Activity

GetActivitiesInPool rehydrates activities into a complete models.Activity type It needs data outside of the pool, hence method on Manifest, with pool as a ref just so it is not tempting to refactor to a method on a pool pointer like in pkg/pool (which won't work here due to refactoring the structure to make it easier to human edit - activities here are not childs of the pool in the data structure but siblings with a link-by-Ref scheme to let the parent-child r'ship be recreated in the models representation

func (*Manifest) GetActivityModel

func (m *Manifest) GetActivityModel(aref Ref) *models.Activity

GetActivityModel returns a pointer of type models.Activity type representing the referenced activity

func (*Manifest) GetPool

func (m *Manifest) GetPool(pref Ref) *models.Pool

GetPool returns a pointer to the referenced pool

func (*Manifest) GetUIModel

func (m *Manifest) GetUIModel(uiref Ref) *models.UserInterface

GetUIModel returns a pointer to the referenced UI as type models.UserInterface

func (*Manifest) GetUISetModel

func (m *Manifest) GetUISetModel(usref Ref) []*models.UserInterface

GetUISetModel returns an array of pointers type models.UserInterface representing the referenced UISet

type Pool

type Pool struct {
	Description

	MinSession uint64

	MaxSession uint64

	Activities []Ref
}

Pool represents a booking Pool (a list of activities)

func (*Pool) ToModel

func (p *Pool) ToModel() *models.Pool

ToModel returns a pointer of type models.Pool type, representing the referenced pool

type Ref

type Ref string //manifest reference

Ref represents a reference to a manifest

type Stream

type Stream struct {
	For            string   `yaml:"for"`
	URL            string   `yaml:"url"`
	Audience       string   `yaml:"audience"`
	ConnectionType string   `yaml:"ct"`
	Topic          string   `yaml:"topic"`
	Verb           string   `yaml:"verb"`
	Scopes         []string `yaml:"scopes"`
}

Stream represents a connection to a relay instance

func (*Stream) ToModel

func (s *Stream) ToModel() *models.Stream

ToModel returns a pointer of type models.Stream representing the stream

type StreamSet

type StreamSet []Ref

StreamSet is an array of references to streams to be used with an activity

type UI

type UI struct {
	// URL with moustache {{key}} templating for stream connections
	Description
	URL             string   `json:"url"`
	StreamsRequired []string `json:"streamsRequired"`
}

UI represents a UI (User Interface)

type UISet

type UISet []Ref

UISet is an array of references to UI to be used with an activity

Jump to

Keyboard shortcuts

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