util

package
v0.0.0-...-d5f0689 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// PrivateFileMode grants owner to read/write a wal.
	PrivateFileMode = 0600
)

Variables

This section is empty.

Functions

func BytesToInt64

func BytesToInt64(b []byte) uint64

BytesToInt64 for byte array to int64

func CreateDirAll

func CreateDirAll(dir string) error

func Exist

func Exist(name string) bool

Exist returns true if a wal or directory exists.

func Int64ToBytes

func Int64ToBytes(n uint64) []byte

Int64ToBytes for int64 to byte array

func IsDirWriteable

func IsDirWriteable(dir string) error

func OpenFile

func OpenFile(path string, flag int, perm os.FileMode) (*os.File, error)

func Preallocate

func Preallocate(f *os.File, sizeInBytes int64, extendFile bool) error

func ReadDirInc

func ReadDirInc(d string) ([]string, error)

func TouchDirAll

func TouchDirAll(dir string) error

Types

type SnowflakeIDGenerator

type SnowflakeIDGenerator struct {
	// contains filtered or unexported fields
}

SnowflakeIDGenerator is a thread-safe ID generator with semantic ID

func NewSnowflakeIDGenerator

func NewSnowflakeIDGenerator(nodeID uint64) *SnowflakeIDGenerator

NewSnowflakeIDGenerator creates a new ID generator with a node ID

func (*SnowflakeIDGenerator) GenerateID

func (g *SnowflakeIDGenerator) GenerateID() uint64

GenerateID generates a unique and ordered ID with time, node, and sequence

Jump to

Keyboard shortcuts

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