Help us shape the future of Go! Take the 2026 Go Developer Survey

compatibility

package
v0.10.2 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2026 License: Apache-2.0, MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CompatibilityCheck

type CompatibilityCheck[T comptypes.CompatibilityComparer[T]] struct {
	RequireStorageContentCompatibility bool
	RuntimeDataGetter                  RuntimeDataGetterFunc[T]
	Storage                            CompatibilityDataStorager[T]
	Logger                             common.Logger
}

CompatibilityCheck is the object that checks the compatibility between the runtime data and the data stored in the storage. It's the implementation of the CompatibilityChecker interface

func NewCompatibilityCheck

func NewCompatibilityCheck[T comptypes.CompatibilityComparer[T]](
	requireStorageContentCompatibility bool,
	runtimeDataGetter RuntimeDataGetterFunc[T],
	storage CompatibilityDataStorager[T]) *CompatibilityCheck[T]

NewCompatibilityCheck creates a new CompatibilityCheck object

func (*CompatibilityCheck[T]) Check

func (s *CompatibilityCheck[T]) Check(ctx context.Context, tx types.Querier) error

Check checks the compatibility between the runtime data and the data stored in the storage

type CompatibilityChecker

type CompatibilityChecker interface {
	Check(ctx context.Context, tx types.Querier) error
}

CompatibilityChecker is the interface that defines the methods to check the compatibility the object CompatibilityCheck[T] implements this interface

type CompatibilityDataStorager

type CompatibilityDataStorager[T any] interface {
	// GetCompatibilityData returns the compatibility data from the storage:
	// true -> if data is stored / false -> if data is not stored yet
	// T -> the data stored
	// error -> if there is an error
	GetCompatibilityData(ctx context.Context, tx types.Querier) (bool, T, error)
	// SetCompatibilityData stores the compatibility data in the storage
	// error -> if there is an error
	SetCompatibilityData(ctx context.Context, tx types.Querier, data T) error
}

CompatibilityDataStorager is the interface that defines the methods to interact with the storage

type KeyValueToCompatibilityStorage

type KeyValueToCompatibilityStorage[T any] struct {
	KVStorage types.KeyValueStorager
	OwnerName string
}

KeyValueToCompatibilityStorage is the object that implements the CompatibilityDataStorager interface using a KeyValueStorager object

func NewKeyValueToCompatibilityStorage

func NewKeyValueToCompatibilityStorage[T any](kvStorage types.KeyValueStorager,
	ownerName string) *KeyValueToCompatibilityStorage[T]

NewKeyValueToCompatibilityStorage creates a new KeyValueToCompatibilityStorage object

func (*KeyValueToCompatibilityStorage[T]) GetCompatibilityData

func (s *KeyValueToCompatibilityStorage[T]) GetCompatibilityData(ctx context.Context,
	tx types.Querier) (bool, T, error)

GetCompatibilityData returns the compatibility data from the storage: true -> if data is stored / false -> if data is not stored yet T -> the data stored error -> if there is an error

func (*KeyValueToCompatibilityStorage[T]) SetCompatibilityData

func (s *KeyValueToCompatibilityStorage[T]) SetCompatibilityData(ctx context.Context, tx types.Querier, data T) error

SetCompatibilityData stores the compatibility data in the storage error -> if there is an error

type RuntimeDataGetterFunc

type RuntimeDataGetterFunc[T comptypes.CompatibilityComparer[T]] func(ctx context.Context) (T, error)

RuntimeDataGetterFunc is a function that returns the runtime data

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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