Documentation ¶
Index ¶
- Constants
- Variables
- func BytesRelease(b BytesPackage)
- func Chunker(sliceLen, chunkSize int, callable func(from, to int) error) (err error)
- func Equal(u1 UUID, u2 UUID) bool
- func MultiListener(ll ...net.Listener) net.Listener
- func WaitTimeout(c *sync.Cond, timeout time.Duration)
- type AutoIncSequence
- type BytePool
- type BytesPackage
- type IOLoop
- type NullReader
- type Reader
- func (r *Reader) Len() int
- func (r *Reader) Read(b []byte) (n int, err error)
- func (r *Reader) ReadAt(b []byte, off int64) (n int, err error)
- func (r *Reader) ReadByte() (b byte, err error)
- func (r *Reader) ReadRune() (ch rune, size int, err error)
- func (r *Reader) Reset(b []byte) (n int64, err error)
- func (r *Reader) Seek(offset int64, whence int) (int64, error)
- func (r *Reader) Size() int64
- func (r *Reader) UnreadByte() error
- func (r *Reader) UnreadRune() error
- func (r *Reader) WriteTo(w io.Writer) (n int64, err error)
- type RingBuffer
- func (rb *RingBuffer) Cap() uint64
- func (rb *RingBuffer) Dispose()
- func (rb *RingBuffer) Get() (interface{}, error)
- func (rb *RingBuffer) IsDisposed() bool
- func (rb *RingBuffer) Len() uint64
- func (rb *RingBuffer) Offer(item interface{}) (bool, error)
- func (rb *RingBuffer) Put(item interface{}) error
- type SkipHash
- type SliceBuf
- type SliceBufAgent
- type UUID
- func And(u1 UUID, u2 UUID) UUID
- func FromBytes(input []byte) (u UUID, err error)
- func FromBytesOrNil(input []byte) UUID
- func FromString(input string) (u UUID, err error)
- func FromStringOrNil(input string) UUID
- func NewV1() UUID
- func NewV2(domain byte) UUID
- func NewV3(ns UUID, name string) UUID
- func NewV4() UUID
- func NewV5(ns UUID, name string) UUID
- func Or(u1 UUID, u2 UUID) UUID
- func (u UUID) Bytes() []byte
- func (u UUID) MarshalBinary() (data []byte, err error)
- func (u UUID) MarshalText() (text []byte, err error)
- func (u *UUID) Scan(src interface{}) error
- func (u *UUID) SetVariant()
- func (u *UUID) SetVersion(v byte)
- func (u UUID) String() string
- func (u *UUID) UnmarshalBinary(data []byte) (err error)
- func (u *UUID) UnmarshalText(text []byte) (err error)
- func (u UUID) Value() (driver.Value, error)
- func (u UUID) Variant() uint
- func (u UUID) Version() uint
Constants ¶
const ( VariantNCS = iota VariantRFC4122 VariantMicrosoft VariantFuture )
UUID layout variants.
const ( DomainPerson = iota DomainGroup DomainOrg )
UUID DCE domains.
Variables ¶
var (
NamespaceDNS, _ = FromString("6ba7b810-9dad-11d1-80b4-00c04fd430c8")
NamespaceURL, _ = FromString("6ba7b811-9dad-11d1-80b4-00c04fd430c8")
NamespaceOID, _ = FromString("6ba7b812-9dad-11d1-80b4-00c04fd430c8")
NamespaceX500, _ = FromString("6ba7b814-9dad-11d1-80b4-00c04fd430c8")
)
Predefined namespace UUIDs.
var (
ErrDisposed = errors.New(`queue: disposed`)
)
var Nil = UUID{}
The nil UUID is special form of UUID that is specified to have all 128 bits set to zero.
Functions ¶
func BytesRelease ¶
func BytesRelease(b BytesPackage)
Types ¶
type AutoIncSequence ¶
type AutoIncSequence struct {
// contains filtered or unexported fields
}
func (*AutoIncSequence) Last ¶
func (self *AutoIncSequence) Last() uint64
func (*AutoIncSequence) Next ¶
func (self *AutoIncSequence) Next() uint64
func (*AutoIncSequence) Reset ¶
func (self *AutoIncSequence) Reset(v uint64)
type BytesPackage ¶
type BytesPackage struct { Bytes []byte // contains filtered or unexported fields }
func BytesNew ¶
func BytesNew(size int) BytesPackage
type NullReader ¶
type NullReader struct {
Chunk int
}
type Reader ¶
type Reader struct {
// contains filtered or unexported fields
}
A Reader implements the io.Reader, io.ReaderAt, io.WriterTo, io.Seeker, io.ByteScanner, and io.RuneScanner interfaces by reading from a byte slice. Unlike a Buffer, a Reader is read-only and supports seeking.
func (*Reader) Size ¶
Size returns the original length of the underlying byte slice. Size is the number of bytes available for reading via ReadAt. The returned value is always the same and is not affected by calls to any other method.
func (*Reader) UnreadByte ¶
func (*Reader) UnreadRune ¶
type RingBuffer ¶
type RingBuffer struct {
// contains filtered or unexported fields
}
RingBuffer is a MPMC buffer that achieves threadsafety with CAS operations only. A put on full or get on empty call will block until an item is put or retrieved. Calling Dispose on the RingBuffer will unblock any blocked threads with an error. This buffer is similar to the buffer described here: http://www.1024cores.net/home/lock-free-algorithms/queues/bounded-mpmc-queue with some minor additions.
func NewRingBuffer ¶
func NewRingBuffer(size uint64) *RingBuffer
NewRingBuffer will allocate, initialize, and return a ring buffer with the specified size.
func (*RingBuffer) Cap ¶
func (rb *RingBuffer) Cap() uint64
Cap returns the capacity of this ring buffer.
func (*RingBuffer) Dispose ¶
func (rb *RingBuffer) Dispose()
Dispose will dispose of this queue and free any blocked threads in the Put and/or Get methods. Calling those methods on a disposed queue will return an error.
func (*RingBuffer) Get ¶
func (rb *RingBuffer) Get() (interface{}, error)
Get will return the next item in the queue. This call will block if the queue is empty. This call will unblock when an item is added to the queue or Dispose is called on the queue. An error will be returned if the queue is disposed.
func (*RingBuffer) IsDisposed ¶
func (rb *RingBuffer) IsDisposed() bool
IsDisposed will return a bool indicating if this queue has been disposed.
func (*RingBuffer) Len ¶
func (rb *RingBuffer) Len() uint64
Len returns the number of items in the queue.
func (*RingBuffer) Offer ¶
func (rb *RingBuffer) Offer(item interface{}) (bool, error)
Offer adds the provided item to the queue if there is space. If the queue is full, this call will return false. An error will be returned if the queue is disposed.
func (*RingBuffer) Put ¶
func (rb *RingBuffer) Put(item interface{}) error
Put adds the provided item to the queue. If the queue is full, this call will block until an item is added to the queue or Dispose is called on the queue. An error will be returned if the queue is disposed.
type SliceBuf ¶
type SliceBuf struct {
// contains filtered or unexported fields
}
func SliceBufNew ¶
func (*SliceBuf) Acquire ¶
func (self *SliceBuf) Acquire() *SliceBufAgent
func (*SliceBuf) Release ¶
func (self *SliceBuf) Release(b *SliceBufAgent)
type SliceBufAgent ¶
type SliceBufAgent struct {
Bytes []byte
}
type UUID ¶
type UUID [16]byte
UUID representation compliant with specification described in RFC 4122.
func FromBytes ¶
FromBytes returns UUID converted from raw byte slice input. It will return error if the slice isn't 16 bytes long.
func FromBytesOrNil ¶
FromBytesOrNil returns UUID converted from raw byte slice input. Same behavior as FromBytes, but returns a Nil UUID on error.
func FromString ¶
FromString returns UUID parsed from string input. Input is expected in a form accepted by UnmarshalText.
func FromStringOrNil ¶
FromStringOrNil returns UUID parsed from string input. Same behavior as FromString, but returns a Nil UUID on error.
func (UUID) MarshalBinary ¶
MarshalBinary implements the encoding.BinaryMarshaler interface.
func (UUID) MarshalText ¶
MarshalText implements the encoding.TextMarshaler interface. The encoding is the same as returned by String.
func (*UUID) Scan ¶
Scan implements the sql.Scanner interface. A 16-byte slice is handled by UnmarshalBinary, while a longer byte slice or a string is handled by UnmarshalText.
func (*UUID) SetVariant ¶
func (u *UUID) SetVariant()
SetVariant sets variant bits as described in RFC 4122.
func (UUID) String ¶
Returns canonical string representation of UUID: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.
func (*UUID) UnmarshalBinary ¶
UnmarshalBinary implements the encoding.BinaryUnmarshaler interface. It will return error if the slice isn't 16 bytes long.
func (*UUID) UnmarshalText ¶
UnmarshalText implements the encoding.TextUnmarshaler interface. Following formats are supported: "6ba7b810-9dad-11d1-80b4-00c04fd430c8", "{6ba7b810-9dad-11d1-80b4-00c04fd430c8}", "urn:uuid:6ba7b810-9dad-11d1-80b4-00c04fd430c8"