core

package
v0.0.0-...-43c9aad Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2024 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ReservedBit  uint64 = 1 << 63
	MaxTimestamp uint64 = 1<<41 - 1
	MaxHash      uint64 = 1<<16 - 1
	MaxSequence  uint64 = 1<<6 - 1
)
View Source
const DomainFilelock = "D.lock"
View Source
const UsersFilename = "U"
View Source
const UsersFilesign = "U.sign"

Variables

View Source
var ClockOffset time.Duration
View Source
var ErrInvalidChangeFilePath = fmt.Errorf("a change file is not in a valid Woland folder")
View Source
var ErrInvalidFilePath = fmt.Errorf("a file is not in a valid Woland folder")
View Source
var ErrInvalidId = fmt.Errorf("the id is invalid")
View Source
var ErrInvalidSignature = fmt.Errorf("signature does not match the user id")
View Source
var ErrInvalidSize = fmt.Errorf("provided slice has not enough data")
View Source
var ErrInvalidVersion = fmt.Errorf("version of protocol is not compatible")
View Source
var ErrNoDriver = fmt.Errorf("no driver found for the provided configuration")
View Source
var ErrNoExchange = fmt.Errorf("no exchange reachable for the domain")
View Source
var ErrNotAuthorized = fmt.Errorf("user is not authorized in the domain")
View Source
var ErrNotInitialized = fmt.Errorf("woland not initialized")
View Source
var MaxRecentErrors = 4096
View Source
var MaxStacktraceOut = 5
View Source
var NtpRetries = 10
View Source
var NtpServers = []string{
	"time.google.com",
	"0.beevik-ntp.pool.ntp.org",
}
View Source
var RecentLog []string
View Source
var SnowFlakeStart = time.Date(2023, 1, 1, 0, 0, 0, 0, time.UTC)

Functions

func Assert

func Assert(t *testing.T, cond bool, msg string, args ...interface{})

func Debug

func Debug(format string, args ...any)

func DecodeBinary

func DecodeBinary(data string) ([]byte, error)

func EncodeBinary

func EncodeBinary(data []byte) string

func ErrLike

func ErrLike(err error, format string) bool

func FatalIf

func FatalIf(err error, msg string, args ...interface{})

func GenerateRandomBytes

func GenerateRandomBytes(length int) []byte

func If

func If[T any](cond bool, whenTrue T, whenFalse T) T

func Info

func Info(format string, args ...any)

func IsErr

func IsErr(err error, format *string, msg string, args ...interface{}) bool

func IsWarn

func IsWarn(err error, msg string, args ...interface{}) bool

func MatchOrigId

func MatchOrigId(id uint64, orig uint64) bool

func NewBytesReader

func NewBytesReader(bs []byte) io.ReadSeekCloser

func NewStringReader

func NewStringReader(s string) io.ReadSeekCloser

func NextID

func NextID(n uint64) uint64

func Now

func Now() time.Time

func ReadBytes

func ReadBytes(r io.Reader) ([]byte, error)

func Since

func Since(t time.Time) time.Duration

func TestErr

func TestErr(t *testing.T, err error, msg string, args ...interface{})

func TimeFromID

func TimeFromID(id uint64) time.Time

func TimeIsSync

func TimeIsSync() bool

func Trace

func Trace(format string, args ...any)

func WriteBytes

func WriteBytes(data []byte, w io.Writer) error

Types

type BytesReader

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

func (BytesReader) Close

func (r BytesReader) Close() error

func (BytesReader) Read

func (r BytesReader) Read(p []byte) (n int, err error)

func (BytesReader) Seek

func (r BytesReader) Seek(offset int64, whence int) (int64, error)

func (BytesReader) WriteTo

func (r BytesReader) WriteTo(w io.Writer) (n int64, err error)

Jump to

Keyboard shortcuts

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