cassandra

package
v6.2.3+incompatible Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2018 License: Apache-2.0, BSD-3-Clause Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const Deflate string = "deflate"
View Source
const LZ4 string = "lz4"
View Source
const Snappy string = "snappy"

Variables

View Source
var (
	ErrFrameTooBig = errors.New("frame length is bigger than the maximum allowed")
)

Functions

This section is empty.

Types

type ByteArrayDecoder

type ByteArrayDecoder struct {
	Data *[]byte
}

func (ByteArrayDecoder) ReadByte

func (f ByteArrayDecoder) ReadByte() (byte, error)

func (ByteArrayDecoder) ReadBytes

func (f ByteArrayDecoder) ReadBytes() []byte

func (ByteArrayDecoder) ReadBytesInternal

func (f ByteArrayDecoder) ReadBytesInternal() []byte

func (ByteArrayDecoder) ReadBytesMap

func (f ByteArrayDecoder) ReadBytesMap() map[string][]byte

func (ByteArrayDecoder) ReadConsistency

func (f ByteArrayDecoder) ReadConsistency() Consistency

func (ByteArrayDecoder) ReadInet

func (f ByteArrayDecoder) ReadInet() (net.IP, int)

func (ByteArrayDecoder) ReadInt

func (f ByteArrayDecoder) ReadInt() (n int)

func (ByteArrayDecoder) ReadLong

func (f ByteArrayDecoder) ReadLong() (n int64)

func (ByteArrayDecoder) ReadLongString

func (f ByteArrayDecoder) ReadLongString() (s string)

func (ByteArrayDecoder) ReadShort

func (f ByteArrayDecoder) ReadShort() (n uint16)

func (ByteArrayDecoder) ReadShortBytes

func (f ByteArrayDecoder) ReadShortBytes() []byte

func (ByteArrayDecoder) ReadString

func (f ByteArrayDecoder) ReadString() (s string)

func (ByteArrayDecoder) ReadStringList

func (f ByteArrayDecoder) ReadStringList() []string

func (ByteArrayDecoder) ReadStringMap

func (f ByteArrayDecoder) ReadStringMap() map[string]string

func (ByteArrayDecoder) ReadStringMultiMap

func (f ByteArrayDecoder) ReadStringMultiMap() map[string][]string

func (ByteArrayDecoder) ReadUUID

func (f ByteArrayDecoder) ReadUUID() *UUID

type CollectionType

type CollectionType struct {
	NativeType
	Key  TypeInfo // only used for TypeMap
	Elem TypeInfo // only used for TypeMap, TypeList and TypeSet
}

func (CollectionType) New

func (t CollectionType) New() interface{}

func (CollectionType) String

func (c CollectionType) String() string

type ColumnInfo

type ColumnInfo struct {
	Keyspace string
	Table    string
	Name     string
	TypeInfo TypeInfo
}

type Compressor

type Compressor interface {
	Name() string
	Encode(data []byte) ([]byte, error)
	Decode(data []byte) ([]byte, error)
}

type Consistency

type Consistency uint16
const (
	Any         Consistency = 0x00
	One         Consistency = 0x01
	Two         Consistency = 0x02
	Three       Consistency = 0x03
	Quorum      Consistency = 0x04
	All         Consistency = 0x05
	LocalQuorum Consistency = 0x06
	EachQuorum  Consistency = 0x07
	LocalOne    Consistency = 0x0A
)

func (Consistency) String

func (c Consistency) String() string

type Decoder

type Decoder interface {
	ReadByte() (byte, error)

	ReadInt() (n int)

	ReadShort() (n uint16)

	ReadLong() (n int64)

	ReadString() (s string)

	ReadLongString() (s string)

	ReadUUID() *UUID

	ReadStringList() []string

	ReadBytesInternal() []byte

	ReadBytes() []byte

	ReadShortBytes() []byte

	ReadInet() (net.IP, int)

	ReadConsistency() Consistency

	ReadStringMap() map[string]string

	ReadBytesMap() map[string][]byte

	ReadStringMultiMap() map[string][]string
}

type DeflateCompressor

type DeflateCompressor struct {
}

type ErrType

type ErrType int

error Types

func (ErrType) String

func (this ErrType) String() string

type FrameOp

type FrameOp byte

func FrameOpFromString

func FrameOpFromString(s string) (FrameOp, error)

func (FrameOp) String

func (f FrameOp) String() string

func (*FrameOp) Unpack

func (f *FrameOp) Unpack(s string) error

type Framer

type Framer struct {

	// if this frame was read then the header will be here
	Header *frameHeader
	// contains filtered or unexported fields
}

a framer is responsible for reading, writing and parsing frames on a single stream

func NewFramer

func NewFramer(r *streambuf.Buffer, compressor Compressor) *Framer

func (*Framer) ReadFrame

func (f *Framer) ReadFrame() (data map[string]interface{}, err error)

reads a frame form the wire into the framers buffer

func (*Framer) ReadHeader

func (f *Framer) ReadHeader() (head *frameHeader, err error)

read header frame from stream

type LZ4Compressor

type LZ4Compressor struct {
}

type NativeType

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

func (NativeType) Custom

func (s NativeType) Custom() string

func (NativeType) New

func (t NativeType) New() interface{}

func (NativeType) String

func (s NativeType) String() string

func (NativeType) Type

func (s NativeType) Type() Type

func (NativeType) Version

func (s NativeType) Version() byte

type SerialConsistency

type SerialConsistency uint16
const (
	Serial      SerialConsistency = 0x08
	LocalSerial SerialConsistency = 0x09
)

func (SerialConsistency) String

func (s SerialConsistency) String() string

type SnappyCompressor

type SnappyCompressor struct{}

SnappyCompressor implements the Compressor interface and can be used to compress incoming and outgoing frames. The snappy compression algorithm aims for very high speeds and reasonable compression.

func (SnappyCompressor) Decode

func (s SnappyCompressor) Decode(data []byte) ([]byte, error)

func (SnappyCompressor) Encode

func (s SnappyCompressor) Encode(data []byte) ([]byte, error)

func (SnappyCompressor) Name

func (s SnappyCompressor) Name() string

type StreamDecoder

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

func (StreamDecoder) ReadByte

func (f StreamDecoder) ReadByte() (byte, error)

func (StreamDecoder) ReadBytes

func (f StreamDecoder) ReadBytes() []byte

func (StreamDecoder) ReadBytesInternal

func (f StreamDecoder) ReadBytesInternal() []byte

func (StreamDecoder) ReadBytesMap

func (f StreamDecoder) ReadBytesMap() map[string][]byte

func (StreamDecoder) ReadConsistency

func (f StreamDecoder) ReadConsistency() Consistency

func (StreamDecoder) ReadInet

func (f StreamDecoder) ReadInet() (net.IP, int)

func (StreamDecoder) ReadInt

func (f StreamDecoder) ReadInt() (n int)

func (StreamDecoder) ReadLong

func (f StreamDecoder) ReadLong() (n int64)

func (StreamDecoder) ReadLongString

func (f StreamDecoder) ReadLongString() (s string)

func (StreamDecoder) ReadShort

func (f StreamDecoder) ReadShort() (n uint16)

func (StreamDecoder) ReadShortBytes

func (f StreamDecoder) ReadShortBytes() []byte

func (StreamDecoder) ReadString

func (f StreamDecoder) ReadString() (s string)

func (StreamDecoder) ReadStringList

func (f StreamDecoder) ReadStringList() []string

func (StreamDecoder) ReadStringMap

func (f StreamDecoder) ReadStringMap() map[string]string

func (StreamDecoder) ReadStringMultiMap

func (f StreamDecoder) ReadStringMultiMap() map[string][]string

func (StreamDecoder) ReadUUID

func (f StreamDecoder) ReadUUID() *UUID

type TupleTypeInfo

type TupleTypeInfo struct {
	NativeType
	Elems []TypeInfo
}

func (TupleTypeInfo) New

func (t TupleTypeInfo) New() interface{}

type Type

type Type int

String returns a human readable name for the Cassandra datatype described by t. Type is the identifier of a Cassandra internal datatype.

const (
	TypeCustom    Type = 0x0000
	TypeASCII     Type = 0x0001
	TypeBigInt    Type = 0x0002
	TypeBlob      Type = 0x0003
	TypeBoolean   Type = 0x0004
	TypeCounter   Type = 0x0005
	TypeDecimal   Type = 0x0006
	TypeDouble    Type = 0x0007
	TypeFloat     Type = 0x0008
	TypeInt       Type = 0x0009
	TypeText      Type = 0x000A
	TypeTimestamp Type = 0x000B
	TypeUUID      Type = 0x000C
	TypeVarchar   Type = 0x000D
	TypeVarint    Type = 0x000E
	TypeTimeUUID  Type = 0x000F
	TypeInet      Type = 0x0010
	TypeDate      Type = 0x0011
	TypeTime      Type = 0x0012
	TypeSmallInt  Type = 0x0013
	TypeTinyInt   Type = 0x0014
	TypeList      Type = 0x0020
	TypeMap       Type = 0x0021
	TypeSet       Type = 0x0022
	TypeUDT       Type = 0x0030
	TypeTuple     Type = 0x0031
)

func (Type) String

func (t Type) String() string

String returns the name of the identifier.

type TypeInfo

type TypeInfo interface {
	Type() Type
	Version() byte
	Custom() string

	// New creates a pointer to an empty version of whatever type
	// is referenced by the TypeInfo receiver
	New() interface{}
}

TypeInfo describes a Cassandra specific data type.

type UDTField

type UDTField struct {
	Name string
	Type TypeInfo
}

type UDTTypeInfo

type UDTTypeInfo struct {
	NativeType
	KeySpace string
	Name     string
	Elements []UDTField
}

func (UDTTypeInfo) New

func (u UDTTypeInfo) New() interface{}

func (UDTTypeInfo) String

func (u UDTTypeInfo) String() string

type UUID

type UUID [16]byte

func UUIDFromBytes

func UUIDFromBytes(input []byte) (UUID, error)

UUIDFromBytes converts a raw byte slice to an UUID.

func (UUID) Bytes

func (u UUID) Bytes() []byte

Bytes returns the raw byte slice for this UUID. A UUID is always 128 bits (16 bytes) long.

func (UUID) String

func (u UUID) String() string

String returns the UUID in it's canonical form, a 32 digit hexadecimal number in the form of xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.

Jump to

Keyboard shortcuts

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