storage

package
v1.1.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2024 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

This section is 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(ctx context.Context, id string) (*MW, error)
	GetMWByAPIID(ctx context.Context, APIID string) (*MW, error)
	GetAllActive(ctx context.Context) ([]*MW, error)
	CreateMW(ctx context.Context, mw *MW) (string, error)
	UpdateMW(ctx context.Context, mw *MW) (string, error)
	DeleteMW(ctx context.Context, id string) error
	InitMservStore(ctx context.Context, 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