Documentation ¶
Overview ¶
Package versions handles config upgrades and downgrades
Versions must be stateful, and not rely upon type definitions in the config pkg
Instead versions should localise types into vN/types.go to avoid issues with subsequent changes
Versions must upgrade to the next version. Do not retrospectively change versions to match new type changes. Create a new version
Versions must implement ExchangeVersion or ConfigVersion, and may implement both
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Manager = &manager{}
Manager is a public instance of the config version manager
Functions ¶
This section is empty.
Types ¶
type ConfigVersion ¶
type ConfigVersion interface { UpgradeConfig(context.Context, []byte) ([]byte, error) DowngradeConfig(context.Context, []byte) ([]byte, error) }
ConfigVersion is a version that affects the general configuration
type ExchangeVersion ¶
type ExchangeVersion interface { Exchanges() []string // Use `*` for all exchanges UpgradeExchange(context.Context, []byte) ([]byte, error) DowngradeExchange(context.Context, []byte) ([]byte, error) }
ExchangeVersion is a version that affects specific exchange configurations
type Version0 ¶
type Version0 struct { }
Version0 is a baseline version with no changes, so we can downgrade back to nothing It does not implement any upgrade interfaces
func (*Version0) DowngradeConfig ¶
DowngradeConfig is an empty stub
type Version1 ¶
type Version1 struct { }
Version1 is an ExchangeVersion to upgrade currency pair format for exchanges
func (*Version1) DowngradeExchange ¶
DowngradeExchange doesn't do anything for v1; There's no downgrade path since the original state is lossy and v1 was before versioning