storage

package
v0.9.9-beta.4 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2021 License: MPL-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package storage defines a runtime store and associated types for use with mserv.

Index

Constants

This section is empty.

Variables

View Source
var ErrEmptyUID = errors.New("UID cannot be empty")

Functions

func GenerateStoreKey

func GenerateStoreKey(org, api, hType, name string) string

Types

type DiffReport

type DiffReport struct {
	Added   []*MW
	Removed []*MW
}

type MW

type MW struct {
	Added        time.Time
	Manifest     *apidef.BundleManifest
	APIID        string
	OrgID        string
	UID          string
	BundleRef    string
	Plugins      []*Plugin
	Active       bool
	DownloadOnly bool
}

type MservStore

type MservStore interface {
	GetMWByID(id string) (*MW, error)
	GetMWByAPIID(APIID string) (*MW, error)
	GetAllActive() ([]*MW, error)
	CreateMW(mw *MW) (string, error)
	UpdateMW(mw *MW) (string, error)
	DeleteMW(id string) error
	InitMservStore(tag string) error
}

type Plugin

type Plugin struct {
	UID      string
	Name     string
	FileName string
	FileRef  string
	Type     coprocess.HookType
}

type RuntimeStore

type RuntimeStore struct {
	// contains filtered or unexported fields
}
var GlobalRtStore *RuntimeStore

func NewRuntimeStore

func NewRuntimeStore() *RuntimeStore

func (*RuntimeStore) AddMW

func (s *RuntimeStore) AddMW(name string, mw *MW)

func (*RuntimeStore) FilterNewMW

func (s *RuntimeStore) FilterNewMW(fetched []*MW) (*DiffReport, error)

func (*RuntimeStore) GetHookFunc

func (s *RuntimeStore) GetHookFunc(name string) (func(*coprocess.Object) (*coprocess.Object, error), error)

func (*RuntimeStore) GetManifest

func (s *RuntimeStore) GetManifest(apiID string) (*apidef.BundleManifest, error)

func (*RuntimeStore) UpdateOrStoreHook

func (s *RuntimeStore) UpdateOrStoreHook(name string, hook func(*coprocess.Object) (*coprocess.Object, error)) (bool, error)

func (*RuntimeStore) UpdateOrStoreManifest

func (s *RuntimeStore) UpdateOrStoreManifest(apiID string, manifest *apidef.BundleManifest) (bool, error)

Jump to

Keyboard shortcuts

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