Documentation ¶
Overview ¶
Package migrate provides helper functions for creation and migration of dynamic YT tables.
Index ¶
- Variables
- func Create(ctx context.Context, yc yt.Client, path ypath.Path, schema schema.Schema) error
- func EnsureTables(ctx context.Context, yc yt.Client, tables map[ypath.Path]Table, ...) error
- func FreezeAndWait(ctx context.Context, yc yt.Client, path ypath.Path) error
- func MountAndWait(ctx context.Context, yc yt.Client, path ypath.Path) error
- func OnConflictFail(path ypath.Path, actual, expected schema.Schema) (err error)
- func UnfreezeAndWait(ctx context.Context, yc yt.Client, path ypath.Path) error
- func UnmountAndWait(ctx context.Context, yc yt.Client, path ypath.Path) error
- type ConflictFn
- type RetentionConfig
- type Table
Constants ¶
This section is empty.
Variables ¶
var ErrConflict = xerrors.NewSentinel("detected schema conflict during migration")
var RetryConflict error = &retrySentinel{}
RetryConflict is a sentinel value that might be returned from ConflictFn.
Functions ¶
func EnsureTables ¶
func EnsureTables( ctx context.Context, yc yt.Client, tables map[ypath.Path]Table, onConflict ConflictFn, ) error
EnsureTables creates and mounts dynamic tables.
If table with a given path already exists, but have a different schema, onConflict handler is invoked.
func FreezeAndWait ¶
FreezeAndWait freezes dynamic table and waits for a table to become frozen.
func MountAndWait ¶
MountAndWait mounts dynamic table and waits for a table to become mounted.
func OnConflictFail ¶
OnConflictFail is ConflictFn that will just return ErrConflict.
func UnfreezeAndWait ¶
UnfreezeAndWait unfreezes dynamic table and waits for a table to become mounted.
Types ¶
type ConflictFn ¶
ConflictFn is function called from migration routine for table that already exists but got unexpected schema.
func OnConflictDrop ¶
func OnConflictDrop(ctx context.Context, yc yt.Client) ConflictFn
OnConflictDrop returns ConflictFn that will drop previous version for the table.
func OnConflictTryAlter ¶
func OnConflictTryAlter(ctx context.Context, yc yt.Client) ConflictFn
OnConflictTryAlter returns ConflictFn that will try to alter previous version of the table.
type RetentionConfig ¶
type RetentionConfig struct { MinDataVersions *int MaxDataVersions *int MinDataTTL *int MaxDataTTL *int }
RetentionConfig stores dynamic table retention policy.
func DeleteDataAfterTTL ¶
func DeleteDataAfterTTL(ttl time.Duration) RetentionConfig
DeleteDataAfterTTL is retention config that would remove versions after specified ttl.
func (RetentionConfig) FillAttrs ¶
func (c RetentionConfig) FillAttrs(attrs map[string]any)