util

package
v1.8.1-0...-0157f87 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2024 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrStorageUndefined = errors.New("storage undefined")

ErrStorageUndefined is an error for undefined storage

Functions

func ContainsColl

func ContainsColl(ns string) bool

ContainsColl inspects if collection is explicitly specified by name within the namespace

func ContainsSpecifiedColl

func ContainsSpecifiedColl(nss []string) bool

ContainsSpecifiedColl inspects if any collection exists for multi-ns

func DropTMPcoll

func DropTMPcoll(ctx context.Context, cn *mongo.Client) error

func GetStorage

func GetStorage(ctx context.Context, m connect.Client, node string, l log.LogEvent) (storage.Storage, error)

GetStorage reads current storage config and creates and returns respective storage.Storage object.

func Initialize

func Initialize(ctx context.Context, stg storage.Storage) error

Initialize write current PBM version to PBM init file.

It does not handle "file already exists" error.

func IsSelective

func IsSelective(ids []string) bool

func MakeSelectedPred

func MakeSelectedPred(nss []string) archive.NSFilterFn

func NewErrorGroup

func NewErrorGroup(limit int) *errorGroup

func NewNSChunkSelector

func NewNSChunkSelector() nsChunkMap

func NewUUIDChunkSelector

func NewUUIDChunkSelector() uuidChunkMap

func ParseNS

func ParseNS(ns string) (string, string)

ParseNS breaks namespace into database and collection parts

func Ref

func Ref[T any](v T) *T

func Reinitialize

func Reinitialize(ctx context.Context, stg storage.Storage) error

Reinitialize delete existing PBM init file and create new once with current PBM version.

It expects that the file exists.

func RetryableWrite

func RetryableWrite(stg storage.Storage, name string, data []byte) error

func StorageFromConfig

func StorageFromConfig(cfg *config.StorageConf, node string, l log.LogEvent) (storage.Storage, error)

StorageFromConfig creates and returns a storage object based on a given config and node name. Node name is used for fetching endpoint url from config for specific cluster member (node).

Types

type ChunkSelector

type ChunkSelector interface {
	Add(bson.Raw)
	Selected(bson.Raw) bool

	BuildFilter() bson.D
}

type RSMapFunc

type RSMapFunc func(string) string

func MakeRSMapFunc

func MakeRSMapFunc(m map[string]string) RSMapFunc

func MakeReverseRSMapFunc

func MakeReverseRSMapFunc(m map[string]string) RSMapFunc

Jump to

Keyboard shortcuts

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