statestore

package
v2.14.1 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2022 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CopyMigrationState

func CopyMigrationState(src, dest MigrationsStateStore, srcdatabase, destdatabase string) error

func CopySettingsState

func CopySettingsState(src, dest SettingsStateStore) error

Types

type CLICatalogState

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

func NewCLICatalogState

func NewCLICatalogState(client hasura.CatalogStateOperations) *CLICatalogState

func (*CLICatalogState) Get

func (c *CLICatalogState) Get() (*CLIState, error)

func (*CLICatalogState) Set

func (c *CLICatalogState) Set(state CLIState) (io.Reader, error)

type CLIState

type CLIState struct {
	Migrations MigrationsState   `json:"migrations,omitempty" mapstructure:"migrations,omitempty"`
	Settings   map[string]string `json:"settings" mapstructure:"settings"`
	// IsStateCopyCompleted is a utility variable
	// pre config v3 state was stored in users database connected to hasura in `hdb_catalog.*` tables
	// this variable is set to true when state copy happens from hdb_catalog.* tables
	// this process is carried out during a scripts update-project-v3 command or an implicit state copy
	// introduced in https://github.com/hasura/graphql-engine-mono/pull/1298
	IsStateCopyCompleted bool `json:"isStateCopyCompleted" mapstructure:"isStateCopyCompleted"`
}

func (*CLIState) GetMigrations

func (c *CLIState) GetMigrations() *MigrationsState

func (*CLIState) GetMigrationsByDatabase

func (c *CLIState) GetMigrationsByDatabase(database string) map[string]bool

func (*CLIState) GetSetting

func (c *CLIState) GetSetting(key string) string

func (*CLIState) GetSettings

func (c *CLIState) GetSettings() map[string]string

func (*CLIState) Init

func (c *CLIState) Init()

func (*CLIState) SetMigration

func (c *CLIState) SetMigration(database, key string, value bool)

func (*CLIState) SetSetting

func (c *CLIState) SetSetting(key, value string)

func (*CLIState) UnsetMigration

func (c *CLIState) UnsetMigration(database, key string)

type MigrationsState

type MigrationsState map[string]map[string]bool

"default:

Version			     Dirty
--------------------------
"12321312321321321": true

type MigrationsStateStore

type MigrationsStateStore interface {
	InsertVersion(database string, version int64) error
	RemoveVersion(database string, version int64) error
	SetVersion(database string, version int64, dirty bool) error
	GetVersions(database string) (map[uint64]bool, error)
	SetVersions(database string, versions []Version) error

	PrepareMigrationsStateStore(database string) error
}

Abstraction for the storage layer for migration state

type SettingsStateStore

type SettingsStateStore interface {
	GetSetting(name string) (value string, err error)
	UpdateSetting(name string, value string) error
	GetAllSettings() (map[string]string, error)
	PrepareSettingsDriver() error
}

Abstraction for storage layer of CLI settings

type Version

type Version struct {
	Version int64
	Dirty   bool
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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