lib

package
v1.999.300 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2024 License: MIT Imports: 24 Imported by: 11

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultBufferLength = 4096
)

Functions

func GenerateSelfSignedCert

func GenerateSelfSignedCert(org string, hosts ...string) (tls.Certificate, error)

GenerateSelfSignedCert

func NewFlusher

func NewFlusher(conn net.Conn) io.Writer

func NewFlusherWithKeepAlive

func NewFlusherWithKeepAlive(conn net.Conn, keepalive []byte, keepalivePeriod time.Duration) io.Writer

func RandomString

func RandomString(length int) string

RandomString

func Recover

func Recover() bool

func ReleaseBuffer

func ReleaseBuffer(b *Buffer)

ReleaseBuffer

func ReleaseTimer

func ReleaseTimer(t *time.Timer)

ReleaseTimer

func StatBuffers

func StatBuffers()

func TakeTimer

func TakeTimer() *time.Timer

TakeTimer

func Trace

func Trace() bool

Types

type Buffer

type Buffer struct {
	B []byte
	// contains filtered or unexported fields
}

Buffer

func CompressGZIP

func CompressGZIP(src *Buffer, preallocate uint, level int) (dst *Buffer, err error)

CompressGZIP level: 0 - default, 1 - best speed, 2 - best size

func CompressLZW

func CompressLZW(src *Buffer, preallocate uint) (dst *Buffer, err error)

CompressLZW

func CompressZLIB

func CompressZLIB(src *Buffer, preallocate uint) (dst *Buffer, err error)

CompressZLIB

func DecompressGZIP

func DecompressGZIP(src *Buffer, skip uint) (dst *Buffer, err error)

func DecompressLZW

func DecompressLZW(src *Buffer, skip uint) (dst *Buffer, err error)

func DecompressZLIB

func DecompressZLIB(src *Buffer, skip uint) (dst *Buffer, err error)

func TakeBuffer

func TakeBuffer() *Buffer

TakeBuffer

func (*Buffer) Allocate

func (b *Buffer) Allocate(n int)

Allocate

func (*Buffer) Append

func (b *Buffer) Append(v []byte)

Append

func (*Buffer) AppendByte

func (b *Buffer) AppendByte(v byte)

AppendByte

func (*Buffer) AppendString

func (b *Buffer) AppendString(s string)

AppendString

func (*Buffer) Cap

func (b *Buffer) Cap() int

func (*Buffer) Extend

func (b *Buffer) Extend(n int) []byte

Extend

func (*Buffer) Len

func (b *Buffer) Len() int

Len

func (*Buffer) Read

func (b *Buffer) Read(v []byte) (n int, err error)

func (*Buffer) ReadDataFrom

func (b *Buffer) ReadDataFrom(r io.Reader, limit int) (int, error)

ReadDataFrom

func (*Buffer) Reset

func (b *Buffer) Reset()

Reset

func (*Buffer) Set

func (b *Buffer) Set(v []byte)

Set

func (*Buffer) String

func (b *Buffer) String() string

String

func (*Buffer) Write

func (b *Buffer) Write(v []byte) (n int, err error)

func (*Buffer) WriteDataTo

func (b *Buffer) WriteDataTo(w io.Writer) error

WriteDataTo

type ItemMPSC

type ItemMPSC interface {
	Next() ItemMPSC
	Value() any
	Clear()
}

type Map

type Map[K comparable, V any] struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func (*Map[K, V]) Delete

func (m *Map[K, V]) Delete(key K)

func (*Map[K, V]) DeleteNoLock

func (m *Map[K, V]) DeleteNoLock(key K)

DeleteNoLock to be used within RangeLock method

func (*Map[K, V]) Len

func (m *Map[K, V]) Len() int

func (*Map[K, V]) Load

func (m *Map[K, V]) Load(key K) (V, bool)

func (*Map[K, V]) LoadAndDelete

func (m *Map[K, V]) LoadAndDelete(key K) (V, bool)

func (*Map[K, V]) LoadOrStore

func (m *Map[K, V]) LoadOrStore(key K, value V) (V, bool)

func (*Map[K, V]) Range

func (m *Map[K, V]) Range(f func(k K, v V) bool)

func (*Map[K, V]) RangeLock

func (m *Map[K, V]) RangeLock(f func(k K, v V) bool)

RangeLock locks map during iterating. You can use DeleteNoLock/StoreNoLock within your f-function

func (*Map[K, V]) Store

func (m *Map[K, V]) Store(key K, value V)

type QueueMPSC

type QueueMPSC interface {
	Push(value any) bool
	Pop() (any, bool)
	Item() ItemMPSC
	// Len returns the number of items in the queue
	Len() int64
	// Size returns the limit for the queue. -1 - for unlimited
	Size() int64

	Lock() bool
	Unlock() bool
}

func NewQueueLimitMPSC

func NewQueueLimitMPSC(limit int64, flush bool) QueueMPSC

NewQueueLimitMPSC creates MPSC queue with limited length. Enabling "flush" options makes this queue flush out the tail item if the limit has been reached. Warning: enabled "flush" option also makes this queue unusable for the concurrent environment

func NewQueueMPSC

func NewQueueMPSC() QueueMPSC

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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