util

package
v0.0.0-...-4aac04f Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: BSD-2-Clause Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ShardSet int64 = 0x1ffff //this 1.517

)

Variables

View Source
var (
	ErrUploadInProgress    = errors.New("Shard upload already in progress")
	ErrUploadNotInProgress = errors.New("Shard upload not in progress")
)

Functions

func AddShardFilesToPacker

func AddShardFilesToPacker(spath, id string, pkr *shardpacker.Packer) (err error)

func ShardNameToDateRange

func ShardNameToDateRange(nm string) (s, e time.Time, err error)

Types

type ShardID

type ShardID int64

func GetShardId

func GetShardId(t time.Time) ShardID

this should generally be inlined everywhere

func NextShardId

func NextShardId(curr ShardID) ShardID

type Timeframe

type Timeframe struct {
	Start time.Time
	End   time.Time
}

type UploadID

type UploadID struct {
	CID     uint64    //customer ID
	IdxUUID uuid.UUID //indexer UUID
	Well    string    //well name
	Shard   string    //shard ID
}

type UploadTracker

type UploadTracker struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewUploadTracker

func NewUploadTracker() UploadTracker

func (*UploadTracker) EnterUpload

func (t *UploadTracker) EnterUpload(uid UploadID) (err error)

EnterUpload attempts to claim an upload ID, if an upload with the existing ID exists an error is returnd

func (*UploadTracker) ExitUpload

func (t *UploadTracker) ExitUpload(uid UploadID) (err error)

ExitUpload releases an existing upload lock for a given shard if the shard wasn't locked, and error is returned

Jump to

Keyboard shortcuts

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