ignite

package
v0.12.2 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2019 License: Apache-2.0 Imports: 15 Imported by: 11

Documentation

Index

Constants

View Source
const (
	// CacheAtomicityModeTransactional is TRANSACTIONAL = 0
	CacheAtomicityModeTransactional = 0
	// CacheAtomicityModeAtomic is ATOMIC = 1
	CacheAtomicityModeAtomic = 1

	// CacheModeLocal is LOCAL = 0
	CacheModeLocal = 0
	// CacheModeReplicated is REPLICATED = 1
	CacheModeReplicated = 1
	// CacheModePartitioned is PARTITIONED  = 2
	CacheModePartitioned = 2

	// PartitionLossPolicyReadOnlySafe is READ_ONLY_SAFE = 0
	PartitionLossPolicyReadOnlySafe = 0
	// PartitionLossPolicyReadOnlyAll is READ_ONLY_ALL = 1
	PartitionLossPolicyReadOnlyAll = 1
	// PartitionLossPolicyReadWriteSafe is READ_WRITE_SAFE = 2
	PartitionLossPolicyReadWriteSafe = 2
	// PartitionLossPolicyReadWriteAll is READ_WRITE_ALL = 3
	PartitionLossPolicyReadWriteAll = 3
	// PartitionLossPolicyIgnore is IGNORE = 4
	PartitionLossPolicyIgnore = 4

	// RebalanceModeSync is SYNC = 0
	RebalanceModeSync = 0
	// RebalanceModeASync is ASYNC = 1
	RebalanceModeASync = 0
	// RebalanceModeNone is NONE = 2
	RebalanceModeNone = 2

	// WriteSynchronizationModeFullSync is FULL_SYNC = 0
	WriteSynchronizationModeFullSync = 0
	// WriteSynchronizationModeFullASync is FULL_ASYNC = 1
	WriteSynchronizationModeFullASync = 1
	// WriteSynchronizationModePrimarySync is PRIMARY_SYNC = 2
	WriteSynchronizationModePrimarySync = 2

	// QueryIndexTypeSorted is SORTED = 0
	QueryIndexTypeSorted = 0
	// QueryIndexTypeFullText is FULLTEXT = 1
	QueryIndexTypeFullText = 1
	// QueryIndexTypeGeospatial is GEOSPATIAL = 2
	QueryIndexTypeGeospatial = 2
)
View Source
const (
	// PeekModeAll is ALL
	PeekModeAll = 0
	// PeekModeNear is NEAR
	PeekModeNear = 1
	// PeekModePrimary is PRIMARY
	PeekModePrimary = 2
	// PeekModeBackup is BACKUP
	PeekModeBackup = 3
)
View Source
const (
	// StatementTypeAny is ANY = 0
	StatementTypeAny byte = 0

	// StatementTypeSelect is SELECT = 1
	StatementTypeSelect byte = 1

	// StatementTypeUpdate is UPDATE = 2
	StatementTypeUpdate byte = 2
)
View Source
const (

	// OpCacheGetNames gets existing cache names.
	OpCacheGetNames = 1050
	// OpCacheCreateWithName creates a cache with a given name.
	OpCacheCreateWithName = 1051
	// OpCacheGetOrCreateWithName creates a cache with a given name.
	// Does nothing if the cache exists.
	OpCacheGetOrCreateWithName = 1052
	// OpCacheCreateWithConfiguration creates cache with provided configuration.
	OpCacheCreateWithConfiguration = 1053
	// OpCacheGetOrCreateWithConfiguration creates cache with provided configuration.
	// Does nothing if the name is already in use.
	OpCacheGetOrCreateWithConfiguration = 1054
	// OpCacheGetConfiguration gets configuration for the given cache.
	OpCacheGetConfiguration = 1055
	// OpCacheDestroy destroys cache with a given name.
	OpCacheDestroy = 1056

	// OpCacheGet retrieves a value from cache by key.
	OpCacheGet = 1000
	// OpCachePut puts a value with a given key to cache (overwriting existing value if any).
	OpCachePut = 1001
	// OpCachePutIfAbsent puts a value with a given key to cache only if the key does not already exist.
	OpCachePutIfAbsent = 1002
	// OpCacheGetAll retrieves multiple key-value pairs from cache.
	OpCacheGetAll = 1003
	// OpCachePutAll puts multiple key-value pairs to cache (overwriting existing associations if any).
	OpCachePutAll = 1004
	// OpCacheGetAndPut puts a value with a given key to cache, and returns the previous value for that key.
	OpCacheGetAndPut = 1005
	// OpCacheGetAndReplace puts a value with a given key to cache, returning previous value for that key,
	// if and only if there is a value currently mapped for that key.
	OpCacheGetAndReplace = 1006
	// OpCacheGetAndRemove removes the cache entry with specified key, returning the value.
	OpCacheGetAndRemove = 1007
	// OpCacheGetAndPutIfAbsent puts a value with a given key to cache only if the key does not already exist.
	OpCacheGetAndPutIfAbsent = 1008
	// OpCacheReplace puts a value with a given key to cache only if the key already exists.
	OpCacheReplace = 1009
	// OpCacheReplaceIfEquals puts a value with a given key to cache only if the key already exists and value equals provided value.
	OpCacheReplaceIfEquals = 1010
	// OpCacheContainsKey returns a value indicating whether given key is present in cache.
	OpCacheContainsKey = 1011
	// OpCacheContainsKeys returns a value indicating whether all given keys are present in cache.
	OpCacheContainsKeys = 1012
	// OpCacheClear clears the cache without notifying listeners or cache writers.
	OpCacheClear = 1013
	// OpCacheClearKey clears the cache key without notifying listeners or cache writers.
	OpCacheClearKey = 1014
	// OpCacheClearKeys clears the cache keys without notifying listeners or cache writers.
	OpCacheClearKeys = 1015
	// OpCacheRemoveKey removes an entry with a given key, notifying listeners and cache writers.
	OpCacheRemoveKey = 1016
	// OpCacheRemoveIfEquals removes an entry with a given key if provided value is equal to actual value,
	// notifying listeners and cache writers.
	OpCacheRemoveIfEquals = 1017
	// OpCacheRemoveKeys removes entries with given keys, notifying listeners and cache writers.
	OpCacheRemoveKeys = 1018
	// OpCacheRemoveAll removes all entries from cache, notifying listeners and cache writers.
	OpCacheRemoveAll = 1019
	// OpCacheGetSize gets the number of entries in cache.
	OpCacheGetSize = 1020

	// OpQuerySQL executes an SQL query over data stored in the cluster.
	// The query returns the whole record (key and value).
	OpQuerySQL = 2002
	// OpQuerySQLCursorGetPage retrieves the next SQL query cursor page by cursor id from OP_QUERY_SQL.
	OpQuerySQLCursorGetPage = 2003
	// OpQuerySQLFields performs SQL fields query.
	OpQuerySQLFields = 2004
	// OpQuerySQLFieldsCursorGetPage retrieves the next query result page by cursor id from OP_QUERY_SQL_FIELDS.
	OpQuerySQLFieldsCursorGetPage = 2005
	// OpQueryScan performs scan query.
	OpQueryScan = 2000
	// OpQueryScanCursorGetPage fetches the next SQL query cursor page by cursor id that is obtained from OP_QUERY_SCAN.
	OpQueryScanCursorGetPage = 2001
	// OpResourceClose closes a resource, such as query cursor.
	OpResourceClose = 0
)
View Source
const (
	// ComplexObjectHeaderLength is complex object header length
	ComplexObjectHeaderLength = 24

	// ComplexObjectVersion is version of complex format
	ComplexObjectVersion = 1

	// ComplexObjectUserType is user type FLAG_USR_TYP = 0x0001
	ComplexObjectUserType = 0x0001
	// ComplexObjectHasSchema is only raw data exists FLAG_HAS_SCHEMA = 0x0002
	ComplexObjectHasSchema = 0x0002
	// ComplexObjectHasRaw is indicating that object has raw data FLAG_HAS_RAW = 0x0004
	ComplexObjectHasRaw = 0x0004
	// ComplexObjectOffsetOneByte is offsets take 1 byte FLAG_OFFSET_ONE_BYTE = 0x0008
	ComplexObjectOffsetOneByte = 0x0008
	// ComplexObjectOffsetTwoBytes is offsets take 2 bytes FLAG_OFFSET_TWO_BYTES = 0x0010
	ComplexObjectOffsetTwoBytes = 0x0010
	// ComplexObjectCompactFooter is compact footer, no field IDs. FLAG_COMPACT_FOOTER = 0x0020
	ComplexObjectCompactFooter = 0x0020
)
View Source
const (
	// OperationStatusSuccess means success
	OperationStatusSuccess = 0
)

Variables

This section is empty.

Functions

func HashCode

func HashCode(s string) int32

HashCode calculates Java hash code for string

func HashCodeForSlice added in v0.8.0

func HashCodeForSlice(b []byte) int32

HashCodeForSlice calculates Java hash code for byte array

func ReadArrayBinaryObject added in v0.8.0

func ReadArrayBinaryObject(r io.Reader) (interface{}, error)

ReadArrayBinaryObject reads "binary object" value wrapped by array

func ReadArrayBools added in v0.8.0

func ReadArrayBools(r io.Reader) ([]bool, error)

ReadArrayBools reads "bool" array value

func ReadArrayBytes added in v0.8.0

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

ReadArrayBytes reads "byte" array value

func ReadArrayDoubles added in v0.8.0

func ReadArrayDoubles(r io.Reader) ([]float64, error)

ReadArrayDoubles reads "double" array value

func ReadArrayFloats added in v0.8.0

func ReadArrayFloats(r io.Reader) ([]float32, error)

ReadArrayFloats reads "float" array value

func ReadArrayInts added in v0.8.0

func ReadArrayInts(r io.Reader) ([]int32, error)

ReadArrayInts reads "int" array value

func ReadArrayLongs added in v0.8.0

func ReadArrayLongs(r io.Reader) ([]int64, error)

ReadArrayLongs reads "long" array value

func ReadArrayODates added in v0.8.0

func ReadArrayODates(r io.Reader) ([]time.Time, error)

ReadArrayODates reads "Date" array value

func ReadArrayOStrings added in v0.8.0

func ReadArrayOStrings(r io.Reader) ([]string, error)

ReadArrayOStrings reads "String" array value

func ReadArrayOTimes added in v0.8.0

func ReadArrayOTimes(r io.Reader) ([]time.Time, error)

ReadArrayOTimes reads "Time" array value

func ReadArrayOTimestamps added in v0.8.0

func ReadArrayOTimestamps(r io.Reader) ([]time.Time, error)

ReadArrayOTimestamps reads "Timestamp" array value

func ReadArrayOUUIDs added in v0.8.0

func ReadArrayOUUIDs(r io.Reader) ([]uuid.UUID, error)

ReadArrayOUUIDs reads "UUID" array value

func ReadArrayShorts added in v0.8.0

func ReadArrayShorts(r io.Reader) ([]int16, error)

ReadArrayShorts reads "short" array value

func ReadBool added in v0.8.0

func ReadBool(r io.Reader) (bool, error)

ReadBool reads "bool" value

func ReadByte added in v0.8.0

func ReadByte(r io.Reader) (byte, error)

ReadByte reads "byte" value

func ReadDate added in v0.8.0

func ReadDate(r io.Reader) (time.Time, error)

ReadDate reads "Date" object value

func ReadDouble added in v0.8.0

func ReadDouble(r io.Reader) (float64, error)

ReadDouble reads "Double" value

func ReadFloat added in v0.8.0

func ReadFloat(r io.Reader) (float32, error)

ReadFloat reads "float" value

func ReadInt added in v0.8.0

func ReadInt(r io.Reader) (int32, error)

ReadInt reads "int" value

func ReadLong added in v0.8.0

func ReadLong(r io.Reader) (int64, error)

ReadLong reads "long" value

func ReadOString added in v0.8.0

func ReadOString(r io.Reader) (string, error)

ReadOString reads "string" object value or NULL (returns "")

func ReadObject added in v0.8.0

func ReadObject(r io.Reader) (interface{}, error)

ReadObject read object

func ReadShort added in v0.8.0

func ReadShort(r io.Reader) (int16, error)

ReadShort reads "short" value

func ReadString added in v0.8.0

func ReadString(r io.Reader) (string, error)

ReadString reads "string" value

func ReadTime added in v0.8.0

func ReadTime(r io.Reader) (time.Time, error)

ReadTime reads "Time" object value

func ReadTimestamp added in v0.8.0

func ReadTimestamp(r io.Reader) (time.Time, error)

ReadTimestamp reads "Timestamp" object value

func ReadUUID added in v0.8.0

func ReadUUID(r io.Reader) (uuid.UUID, error)

ReadUUID reads "UUID" object value

func WriteBool added in v0.8.0

func WriteBool(w io.Writer, v bool) error

WriteBool writes "bool" value

func WriteByte added in v0.8.0

func WriteByte(w io.Writer, v byte) error

WriteByte writes "byte" value

func WriteBytes added in v0.8.0

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

WriteBytes writes byte slice

func WriteChar added in v0.8.0

func WriteChar(w io.Writer, v Char) error

WriteChar writes "char" value

func WriteDouble added in v0.8.0

func WriteDouble(w io.Writer, v float64) error

WriteDouble writes "double" value

func WriteFloat added in v0.8.0

func WriteFloat(w io.Writer, v float32) error

WriteFloat writes "float" value

func WriteInt added in v0.8.0

func WriteInt(w io.Writer, v int32) error

WriteInt writes "int" value

func WriteLong added in v0.8.0

func WriteLong(w io.Writer, v int64) error

WriteLong writes "long" value

func WriteNull added in v0.8.0

func WriteNull(w io.Writer) error

WriteNull writes NULL

func WriteOArrayBools added in v0.8.0

func WriteOArrayBools(w io.Writer, v []bool) error

WriteOArrayBools writes "Bool" array object value

func WriteOArrayBytes added in v0.8.0

func WriteOArrayBytes(w io.Writer, v []byte) error

WriteOArrayBytes writes "byte" array object value

func WriteOArrayChars added in v0.8.0

func WriteOArrayChars(w io.Writer, v []Char) error

WriteOArrayChars writes "char" array object value

func WriteOArrayDoubles added in v0.8.0

func WriteOArrayDoubles(w io.Writer, v []float64) error

WriteOArrayDoubles writes "double" array object value

func WriteOArrayFloats added in v0.8.0

func WriteOArrayFloats(w io.Writer, v []float32) error

WriteOArrayFloats writes "float" array object value

func WriteOArrayGoInts added in v0.12.2

func WriteOArrayGoInts(w io.Writer, v []int) error

WriteOArrayGoInts writes "Go int" array object value

func WriteOArrayInts added in v0.8.0

func WriteOArrayInts(w io.Writer, v []int32) error

WriteOArrayInts writes "int" array object value

func WriteOArrayLongs added in v0.8.0

func WriteOArrayLongs(w io.Writer, v []int64) error

WriteOArrayLongs writes "long" array object value

func WriteOArrayODates added in v0.8.0

func WriteOArrayODates(w io.Writer, v []Date) error

WriteOArrayODates writes "Date" array object value

func WriteOArrayOStrings added in v0.8.0

func WriteOArrayOStrings(w io.Writer, v []string) error

WriteOArrayOStrings writes "String" array object value

func WriteOArrayOTimes added in v0.8.0

func WriteOArrayOTimes(w io.Writer, v []Time) error

WriteOArrayOTimes writes "Time" array object value

func WriteOArrayOTimestamps added in v0.8.0

func WriteOArrayOTimestamps(w io.Writer, v []time.Time) error

WriteOArrayOTimestamps writes "Timestamp" array object value

func WriteOArrayOUUIDs added in v0.8.0

func WriteOArrayOUUIDs(w io.Writer, v []uuid.UUID) error

WriteOArrayOUUIDs writes "UUID" array object value

func WriteOArrayShorts added in v0.8.0

func WriteOArrayShorts(w io.Writer, v []int16) error

WriteOArrayShorts writes "short" array object value

func WriteOBool added in v0.8.0

func WriteOBool(w io.Writer, v bool) error

WriteOBool writes "bool" object value

func WriteOByte added in v0.8.0

func WriteOByte(w io.Writer, v byte) error

WriteOByte writes "byte" object value

func WriteOChar added in v0.8.0

func WriteOChar(w io.Writer, v Char) error

WriteOChar writes "char" object value

func WriteOComplexObject added in v0.8.0

func WriteOComplexObject(w io.Writer, v ComplexObject) error

WriteOComplexObject writes complex object

func WriteODate added in v0.8.0

func WriteODate(w io.Writer, v Date) error

WriteODate writes "Date" object value

func WriteODouble added in v0.8.0

func WriteODouble(w io.Writer, v float64) error

WriteODouble writes "double" object value

func WriteOFloat added in v0.8.0

func WriteOFloat(w io.Writer, v float32) error

WriteOFloat writes "float" object value

func WriteOInt added in v0.8.0

func WriteOInt(w io.Writer, v int32) error

WriteOInt writes "int" object value

func WriteOLong added in v0.8.0

func WriteOLong(w io.Writer, v int64) error

WriteOLong writes "long" object value

func WriteOShort added in v0.8.0

func WriteOShort(w io.Writer, v int16) error

WriteOShort writes "short" object value

func WriteOString added in v0.8.0

func WriteOString(w io.Writer, v string) error

WriteOString writes "string" object value String is marshalling as object in all cases.

func WriteOTime added in v0.8.0

func WriteOTime(w io.Writer, v Time) error

WriteOTime writes "Time" object value Time is marshaled as object in all cases.

func WriteOTimestamp added in v0.8.0

func WriteOTimestamp(w io.Writer, v time.Time) error

WriteOTimestamp writes "Timestamp" object value Timestamp is marshaled as object in all cases.

func WriteOUUID added in v0.8.0

func WriteOUUID(w io.Writer, v uuid.UUID) error

WriteOUUID writes "UUID" object value UUID is marshaled as object in all cases.

func WriteObject added in v0.8.0

func WriteObject(w io.Writer, o interface{}) error

WriteObject writes object

func WriteShort added in v0.8.0

func WriteShort(w io.Writer, v int16) error

WriteShort writes "short" value

func WriteType added in v0.8.0

func WriteType(w io.Writer, code byte) error

WriteType writes object type code

Types

type CacheConfiguration

type CacheConfiguration struct {
	AtomicityMode                 int32
	Backups                       int32
	CacheMode                     int32
	CopyOnRead                    bool
	DataRegionName                string
	EagerTTL                      bool
	EnableStatistics              bool
	GroupName                     string
	LockTimeout                   int64
	MaxConcurrentAsyncOperations  int32
	MaxQueryIterators             int32
	Name                          string
	OnheapCacheEnabled            bool
	PartitionLossPolicy           int32
	QueryDetailMetricsSize        int32
	QueryParellelism              int32
	ReadFromBackup                bool
	RebalanceBatchSize            int32
	RebalanceBatchesPrefetchCount int64
	RebalanceDelay                int64
	RebalanceMode                 int32
	RebalanceOrder                int32
	RebalanceThrottle             int64
	RebalanceTimeout              int64
	SQLEscapeAll                  bool
	SQLIndexInlineMaxSize         int32
	SQLSchema                     string
	WriteSynchronizationMode      int32
	CacheKeyConfigurations        []CacheKeyConfiguration
	QueryEntities                 []QueryEntity
}

CacheConfiguration describes cache configuration

type CacheConfigurationRefs

type CacheConfigurationRefs struct {
	AtomicityMode                 *int32
	Backups                       *int32
	CacheMode                     *int32
	CopyOnRead                    *bool
	DataRegionName                *string
	EagerTTL                      *bool
	EnableStatistics              *bool
	GroupName                     *string
	LockTimeout                   *int64
	MaxConcurrentAsyncOperations  *int32
	MaxQueryIterators             *int32
	Name                          *string
	OnheapCacheEnabled            *bool
	PartitionLossPolicy           *int32
	QueryDetailMetricsSize        *int32
	QueryParellelism              *int32
	ReadFromBackup                *bool
	RebalanceBatchSize            *int32
	RebalanceBatchesPrefetchCount *int64
	RebalanceDelay                *int64
	RebalanceMode                 *int32
	RebalanceOrder                *int32
	RebalanceThrottle             *int64
	RebalanceTimeout              *int64
	SQLEscapeAll                  *bool
	SQLIndexInlineMaxSize         *int32
	SQLSchema                     *string
	WriteSynchronizationMode      *int32
	CacheKeyConfigurations        []CacheKeyConfiguration
	QueryEntities                 []QueryEntity
}

CacheConfigurationRefs describes cache configuration to create new cache

type CacheKeyConfiguration

type CacheKeyConfiguration struct {
	TypeName             string
	AffinityKeyFieldName string
}

CacheKeyConfiguration is struct

type Char

type Char rune

Char is Apache Ignite "char" type

func ReadArrayChars added in v0.8.0

func ReadArrayChars(r io.Reader) ([]Char, error)

ReadArrayChars reads "char" array value

func ReadChar added in v0.8.0

func ReadChar(r io.Reader) (Char, error)

ReadChar reads "char" value

type Client

type Client interface {
	// Connected return true if connection to the cluster is active
	Connected() bool

	// Do sends request and receives response
	Do(req Request, res Response) error

	// Close closes connection.
	// Returns:
	// nil in case of success.
	// error object in case of error.
	Close() error

	// CacheCreateWithName Creates a cache with a given name.
	// Cache template can be applied if there is a '*' in the cache name.
	// https://apacheignite.readme.io/docs/binary-client-protocol-cache-configuration-operations#section-op_cache_create_with_name
	CacheCreateWithName(cache string) error

	// CacheGetOrCreateWithName creates a cache with a given name.
	// Cache template can be applied if there is a '*' in the cache name.
	// Does nothing if the cache exists.
	// https://apacheignite.readme.io/docs/binary-client-protocol-cache-configuration-operations#section-op_cache_get_or_create_with_name
	CacheGetOrCreateWithName(cache string) error

	// CacheGetNames returns existing cache names.
	// https://apacheignite.readme.io/docs/binary-client-protocol-cache-configuration-operations#section-op_cache_get_names
	CacheGetNames() ([]string, error)

	// CacheGetConfiguration gets configuration for the given cache.
	// https://apacheignite.readme.io/docs/binary-client-protocol-cache-configuration-operations#section-op_cache_get_configuration
	CacheGetConfiguration(cache string, flag byte) (*CacheConfiguration, error)

	// CacheCreateWithConfiguration creates cache with provided configuration.
	// An error is returned if the name is already in use.
	// https://apacheignite.readme.io/docs/binary-client-protocol-cache-configuration-operations#section-op_cache_create_with_configuration
	CacheCreateWithConfiguration(cc *CacheConfigurationRefs) error

	// CacheGetOrCreateWithConfiguration creates cache with provided configuration.
	// Does nothing if the name is already in use.
	// https://apacheignite.readme.io/docs/binary-client-protocol-cache-configuration-operations#section-op_cache_get_or_create_with_configuration
	CacheGetOrCreateWithConfiguration(cc *CacheConfigurationRefs) error

	// CacheDestroy destroys cache with a given name.
	// https://apacheignite.readme.io/docs/binary-client-protocol-cache-configuration-operations#section-op_cache_destroy
	CacheDestroy(cache string) error

	// CacheGet retrieves a value from cache by key.
	// https://apacheignite.readme.io/docs/binary-client-protocol-key-value-operations#section-op_cache_get
	CacheGet(cache string, binary bool, key interface{}) (interface{}, error)

	// CacheGetAll retrieves multiple key-value pairs from cache.
	// https://apacheignite.readme.io/docs/binary-client-protocol-key-value-operations#section-op_cache_get_all
	CacheGetAll(cache string, binary bool, keys []interface{}) (map[interface{}]interface{}, error)

	// CachePut puts a value with a given key to cache (overwriting existing value if any).
	// https://apacheignite.readme.io/docs/binary-client-protocol-key-value-operations#section-op_cache_put
	CachePut(cache string, binary bool, key interface{}, value interface{}) error

	// CachePutAll puts a value with a given key to cache (overwriting existing value if any).
	// https://apacheignite.readme.io/docs/binary-client-protocol-key-value-operations#section-op_cache_put_all
	CachePutAll(cache string, binary bool, data map[interface{}]interface{}) error

	// CacheContainsKey returns a value indicating whether given key is present in cache.
	// https://apacheignite.readme.io/docs/binary-client-protocol-key-value-operations#section-op_cache_contains_key
	CacheContainsKey(cache string, binary bool, key interface{}) (bool, error)

	// CacheContainsKeys returns a value indicating whether all given keys are present in cache.
	// https://apacheignite.readme.io/docs/binary-client-protocol-key-value-operations#section-op_cache_contains_keys
	CacheContainsKeys(cache string, binary bool, keys []interface{}) (bool, error)

	// CacheGetAndPut puts a value with a given key to cache, and returns the previous value for that key.
	// https://apacheignite.readme.io/docs/binary-client-protocol-key-value-operations#section-op_cache_get_and_put
	CacheGetAndPut(cache string, binary bool, key interface{}, value interface{}) (interface{}, error)

	// CacheGetAndReplace puts a value with a given key to cache, returning previous value for that key,
	// if and only if there is a value currently mapped for that key.
	// https://apacheignite.readme.io/docs/binary-client-protocol-key-value-operations#section-op_cache_get_and_replace
	CacheGetAndReplace(cache string, binary bool, key interface{}, value interface{}) (interface{}, error)

	// CacheGetAndRemove removes the cache entry with specified key, returning the value.
	// https://apacheignite.readme.io/docs/binary-client-protocol-key-value-operations#section-op_cache_get_and_remove
	CacheGetAndRemove(cache string, binary bool, key interface{}) (interface{}, error)

	// CachePutIfAbsent puts a value with a given key to cache only if the key does not already exist.
	// https://apacheignite.readme.io/docs/binary-client-protocol-key-value-operations#section-op_cache_put_if_absent
	CachePutIfAbsent(cache string, binary bool, key interface{}, value interface{}) (bool, error)

	// CacheGetAndPutIfAbsent puts a value with a given key to cache only if the key does not already exist.
	// https://apacheignite.readme.io/docs/binary-client-protocol-key-value-operations#section-op_cache_get_and_put_if_absent
	CacheGetAndPutIfAbsent(cache string, binary bool, key interface{}, value interface{}) (interface{}, error)

	// CacheReplace puts a value with a given key to cache only if the key already exists.
	// https://apacheignite.readme.io/docs/binary-client-protocol-key-value-operations#section-op_cache_replace
	CacheReplace(cache string, binary bool, key interface{}, value interface{}) (bool, error)

	// CacheReplaceIfEquals puts a value with a given key to cache only if
	// the key already exists and value equals provided value.
	// https://apacheignite.readme.io/docs/binary-client-protocol-key-value-operations#section-op_cache_replace_if_equals
	CacheReplaceIfEquals(cache string, binary bool, key interface{}, valueCompare interface{}, valueNew interface{}) (bool, error)

	// CacheClear clears the cache without notifying listeners or cache writers.
	// https://apacheignite.readme.io/docs/binary-client-protocol-key-value-operations#section-op_cache_clear
	CacheClear(cache string, binary bool) error

	// CacheClearKey clears the cache key without notifying listeners or cache writers.
	// https://apacheignite.readme.io/docs/binary-client-protocol-key-value-operations#section-op_cache_clear_key
	CacheClearKey(cache string, binary bool, key interface{}) error

	// CacheClearKeys clears the cache keys without notifying listeners or cache writers.
	// https://apacheignite.readme.io/docs/binary-client-protocol-key-value-operations#section-op_cache_clear_keys
	CacheClearKeys(cache string, binary bool, keys []interface{}) error

	// CacheRemoveKey removes an entry with a given key, notifying listeners and cache writers.
	// https://apacheignite.readme.io/docs/binary-client-protocol-key-value-operations#section-op_cache_remove_key
	CacheRemoveKey(cache string, binary bool, key interface{}) (bool, error)

	// CacheRemoveIfEquals removes an entry with a given key if provided value is equal to actual value,
	// notifying listeners and cache writers.
	// https://apacheignite.readme.io/docs/binary-client-protocol-key-value-operations#section-op_cache_remove_if_equals
	CacheRemoveIfEquals(cache string, binary bool, key interface{}, value interface{}) (bool, error)

	// CacheGetSize gets the number of entries in cache.
	// https://apacheignite.readme.io/docs/binary-client-protocol-key-value-operations#section-op_cache_get_size
	CacheGetSize(cache string, binary bool, modes []byte) (int64, error)

	// CacheRemoveKeys removes entries with given keys, notifying listeners and cache writers.
	// https://apacheignite.readme.io/docs/binary-client-protocol-key-value-operations#section-op_cache_remove_keys
	CacheRemoveKeys(cache string, binary bool, keys []interface{}) error

	// CacheRemoveAll destroys cache with a given name.
	// https://apacheignite.readme.io/docs/binary-client-protocol-key-value-operations#section-op_cache_remove_all
	CacheRemoveAll(cache string, binary bool) error

	// QuerySQL executes an SQL query over data stored in the cluster. The query returns the whole record (key and value).
	// https://apacheignite.readme.io/docs/binary-client-protocol-sql-operations#section-op_query_sql
	QuerySQL(cache string, binary bool, data QuerySQLData) (QuerySQLResult, error)

	// QuerySQLCursorGetPage retrieves the next SQL query cursor page by cursor id from QuerySQL.
	// https://apacheignite.readme.io/docs/binary-client-protocol-sql-operations#section-op_query_sql_cursor_get_page
	QuerySQLCursorGetPage(id int64) (QuerySQLPage, error)

	// QuerySQLFieldsRaw is equal to QuerySQLFields but return raw Response object.
	// Used for SQL driver to reduce memory allocations.
	QuerySQLFieldsRaw(cache string, binary bool, data QuerySQLFieldsData) (*ResponseOperation, error)

	// QuerySQLFields performs SQL fields query.
	// https://apacheignite.readme.io/docs/binary-client-protocol-sql-operations#section-op_query_sql_fields
	QuerySQLFields(cache string, binary bool, data QuerySQLFieldsData) (QuerySQLFieldsResult, error)

	// QuerySQLFieldsCursorGetPageRaw is equal to QuerySQLFieldsCursorGetPage but return raw Response object.
	// Used for SQL driver to reduce memory allocations.
	QuerySQLFieldsCursorGetPageRaw(id int64) (*ResponseOperation, error)

	// QuerySQLFieldsCursorGetPage retrieves the next query result page by cursor id from QuerySQLFields.
	// https://apacheignite.readme.io/docs/binary-client-protocol-sql-operations#section-op_query_sql_fields_cursor_get_page
	QuerySQLFieldsCursorGetPage(id int64, fieldCount int) (QuerySQLFieldsPage, error)

	// QueryScan performs scan query.
	// https://apacheignite.readme.io/docs/binary-client-protocol-sql-operations#section-op_query_scan
	QueryScan(cache string, binary bool, data QueryScanData) (QueryScanResult, error)

	// QueryScanCursorGetPage fetches the next SQL query cursor page by cursor id that is obtained from OP_QUERY_SCAN.
	// https://apacheignite.readme.io/docs/binary-client-protocol-sql-operations#section-op_query_scan_cursor_get_page
	QueryScanCursorGetPage(id int64) (QueryScanPage, error)

	// ResourceClose closes a resource, such as query cursor.
	// https://apacheignite.readme.io/docs/binary-client-protocol-sql-operations#section-op_resource_close
	ResourceClose(id int64) error
}

Client is interface to communicate with Apache Ignite cluster. Client is thread safe.

func Connect

func Connect(ci ConnInfo) (Client, error)

Connect connects to the Apache Ignite cluster Returns: client

type ComplexObject added in v0.8.0

type ComplexObject struct {
	Type   int32
	Fields map[int32]interface{}
}

ComplexObject is "complex object" type

func NewComplexObject added in v0.8.0

func NewComplexObject(typeName string) ComplexObject

NewComplexObject is constructor for ComplexObject

func ReadComplexObject added in v0.8.0

func ReadComplexObject(r io.Reader) (ComplexObject, error)

ReadComplexObject reads "complex object" value

func (*ComplexObject) Get added in v0.8.0

func (c *ComplexObject) Get(field string) (interface{}, bool)

Get gets field value

func (*ComplexObject) Set added in v0.8.0

func (c *ComplexObject) Set(field string, value interface{})

Set sets field value

type ConnInfo

type ConnInfo struct {
	Network, Host       string
	Port                int
	Major, Minor, Patch int
	Username, Password  string
	Dialer              net.Dialer
	TLSConfig           *tls.Config
}

ConnInfo contains connections parameters

type Date

type Date int64

Date is Unix time, the number of MILLISECONDS elapsed since January 1, 1970 UTC.

func ToDate

func ToDate(t time.Time) Date

ToDate converts Golang time.Time to Apache Ignite Date

type Field

type Field struct {
	Name         string
	IsDescensing bool
}

Field is struct

type FieldNameAlias

type FieldNameAlias struct {
	Name  string
	Alias string
}

FieldNameAlias is struct

type QueryEntity

type QueryEntity struct {
	KeyTypeName      string
	ValueTypeName    string
	TableName        string
	KeyFieldName     string
	ValueFieldName   string
	QueryFields      []QueryField
	FieldNameAliases []FieldNameAlias
	QueryIndexes     []QueryIndex
}

QueryEntity is struct

type QueryField

type QueryField struct {
	Name                     string
	TypeName                 string
	IsKeyField               bool
	IsNotNullConstraintField bool
}

QueryField is struct

type QueryIndex

type QueryIndex struct {
	Name       string
	Type       byte
	InlineSize int32
	Fields     []Field
}

QueryIndex is struct

type QuerySQLData

type QuerySQLData struct {
	// Name of a type or SQL table.
	Table string

	// SQL query string.
	Query string

	// Query arguments.
	QueryArgs []interface{}

	// Distributed joins.
	DistributedJoins bool

	// Local query.
	LocalQuery bool

	// Replicated only - Whether query contains only replicated tables or not.
	ReplicatedOnly bool

	// Cursor page size.
	PageSize int

	// Timeout(milliseconds) value should be non-negative. Zero value disables timeout.
	Timeout int64
}

QuerySQLData input parameter for QuerySQL func

type QuerySQLFieldsData

type QuerySQLFieldsData struct {
	// Schema for the query; can be empty, in which case default PUBLIC schema will be used.
	Schema string

	// Query cursor page size.
	PageSize int

	// Max rows.
	MaxRows int

	// SQL query string.
	Query string

	// Query arguments.
	QueryArgs []interface{}

	// Statement type.
	// ANY = 0
	// SELECT = 1
	// UPDATE = 2
	StatementType byte

	// Distributed joins.
	DistributedJoins bool

	// Local query.
	LocalQuery bool

	// Replicated only - Whether query contains only replicated tables or not.
	ReplicatedOnly bool

	// Enforce join order.
	EnforceJoinOrder bool

	// Collocated - Whether your data is co-located or not.
	Collocated bool

	// Lazy query execution.
	LazyQuery bool

	// Timeout(milliseconds) value should be non-negative. Zero value disables timeout.
	Timeout int64

	// Include field names.
	IncludeFieldNames bool
}

QuerySQLFieldsData input parameter for QuerySQLFields func

type QuerySQLFieldsPage

type QuerySQLFieldsPage struct {
	// Values
	Rows [][]interface{}

	// Indicates whether more results are available to be fetched with QuerySQLFieldsCursorGetPage.
	// When true, query cursor is closed automatically.
	HasMore bool
}

QuerySQLFieldsPage is query result page

type QuerySQLFieldsResult

type QuerySQLFieldsResult struct {
	// Cursor id. Can be closed with ResourceClose func.
	ID int64

	// Field (column) count.
	FieldCount int

	// Needed only when IncludeFieldNames is true in the request.
	// Column names.
	Fields []string

	// Query result first page
	QuerySQLFieldsPage
}

QuerySQLFieldsResult output from QuerySQLFields func

type QuerySQLPage

type QuerySQLPage struct {
	// Key -> Values
	Rows map[interface{}]interface{}

	// Indicates whether more results are available to be fetched with QuerySQLCursorGetPage.
	// When true, query cursor is closed automatically.
	HasMore bool
}

QuerySQLPage is query result page

type QuerySQLResult

type QuerySQLResult struct {
	// Cursor id. Can be closed with ResourceClose func.
	ID int64

	// Query result first page
	QuerySQLPage
}

QuerySQLResult output from QuerySQL func

type QueryScanData added in v0.9.0

type QueryScanData struct {
	// Cursor page size.
	PageSize int

	// Number of partitions to query (negative to query entire cache).
	Partitions int

	// Local flag - whether this query should be executed on local node only.
	LocalQuery bool
}

QueryScanData input parameter for QueryScan func

type QueryScanPage added in v0.9.0

type QueryScanPage struct {
	// Key -> Values
	Rows map[interface{}]interface{}

	// Indicates whether more results are available to be fetched with QueryScanCursorGetPage.
	// When true, query cursor is closed automatically.
	HasMore bool
}

QueryScanPage is query result page

type QueryScanResult added in v0.9.0

type QueryScanResult struct {
	// Cursor id. Can be closed with ResourceClose func.
	ID int64

	// Query result first page
	QueryScanPage
}

QueryScanResult output from QueryScan func

type Request

type Request interface {
	// WriteTo is function to write request data to io.Writer.
	// Returns written bytes.
	WriteTo(w io.Writer) (int64, error)
}

Request is interface of base message request functionality

type RequestCacheCreateWithConfiguration

type RequestCacheCreateWithConfiguration struct {
	Count int16

	RequestOperation
}

RequestCacheCreateWithConfiguration is struct to store operation request

func NewRequestCacheCreateWithConfiguration

func NewRequestCacheCreateWithConfiguration(code int16) *RequestCacheCreateWithConfiguration

NewRequestCacheCreateWithConfiguration creates new handshake request object

func (*RequestCacheCreateWithConfiguration) Write added in v0.8.0

func (r *RequestCacheCreateWithConfiguration) Write(p []byte) (n int, err error)

Write writes len(p) bytes from p to the underlying data stream. It returns the number of bytes written from p (0 <= n <= len(p)) and any error encountered that caused the write to stop early. Write must return a non-nil error if it returns n < len(p). Write must not modify the slice data, even temporarily.

Implementations must not retain p.

func (*RequestCacheCreateWithConfiguration) WriteTo

WriteTo is function to write handshake request data to io.Writer. Returns written bytes.

type RequestHandshake

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

RequestHandshake is struct handshake request

func NewRequestHandshake

func NewRequestHandshake(major, minor, patch int, username, password string) *RequestHandshake

NewRequestHandshake creates new handshake request object

func (*RequestHandshake) Write added in v0.8.0

func (r *RequestHandshake) Write(p []byte) (n int, err error)

Write writes len(p) bytes from p to the underlying data stream. It returns the number of bytes written from p (0 <= n <= len(p)) and any error encountered that caused the write to stop early. Write must return a non-nil error if it returns n < len(p). Write must not modify the slice data, even temporarily.

Implementations must not retain p.

func (*RequestHandshake) WriteTo

func (r *RequestHandshake) WriteTo(w io.Writer) (int64, error)

WriteTo is function to write handshake request data to io.Writer. Returns written bytes.

type RequestOperation

type RequestOperation struct {
	Code int16
	UID  int64
	// contains filtered or unexported fields
}

RequestOperation is struct to store operation request

func NewRequestOperation

func NewRequestOperation(code int16) *RequestOperation

NewRequestOperation creates new handshake request object

func (*RequestOperation) Write added in v0.8.0

func (r *RequestOperation) Write(p []byte) (n int, err error)

Write writes len(p) bytes from p to the underlying data stream. It returns the number of bytes written from p (0 <= n <= len(p)) and any error encountered that caused the write to stop early. Write must return a non-nil error if it returns n < len(p). Write must not modify the slice data, even temporarily.

Implementations must not retain p.

func (*RequestOperation) WriteTo

func (r *RequestOperation) WriteTo(w io.Writer) (int64, error)

WriteTo is function to write operation request data to io.Writer. Returns written bytes.

type Response

type Response interface {
	// ReadFrom is function to read request data from io.Reader.
	// Returns read bytes.
	ReadFrom(r io.Reader) (int64, error)
}

Response is interface of base message response functionality

type ResponseHandshake

type ResponseHandshake struct {
	// Success flag
	Success bool
	// Server version major, minor, patch
	Major, Minor, Patch int
	// Error message
	Message string
	// contains filtered or unexported fields
}

ResponseHandshake is struct handshake response

func (*ResponseHandshake) Read added in v0.8.0

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

Read reads up to len(p) bytes into p. It returns the number of bytes read (0 <= n <= len(p)) and any error encountered. Even if Read returns n < len(p), it may use all of p as scratch space during the call. If some data is available but not len(p) bytes, Read conventionally returns what is available instead of waiting for more.

func (*ResponseHandshake) ReadFrom

func (r *ResponseHandshake) ReadFrom(rr io.Reader) (int64, error)

ReadFrom is function to read request data from io.Reader. Returns read bytes.

type ResponseOperation

type ResponseOperation struct {
	// Request id
	UID int64
	// Status code (0 for success, otherwise error code)
	Status int32
	// Error message (present only when status is not 0)
	Message string
	// contains filtered or unexported fields
}

ResponseOperation is struct operation response

func NewResponseOperation

func NewResponseOperation(uid int64) *ResponseOperation

NewResponseOperation is ResponseOperation constructor

func (*ResponseOperation) CheckStatus

func (r *ResponseOperation) CheckStatus() error

CheckStatus checks status of operation execution. Returns: nil in case of success. error object in case of operation failed.

func (*ResponseOperation) Read added in v0.8.0

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

Read reads up to len(p) bytes into p. It returns the number of bytes read (0 <= n <= len(p)) and any error encountered. Even if Read returns n < len(p), it may use all of p as scratch space during the call. If some data is available but not len(p) bytes, Read conventionally returns what is available instead of waiting for more.

func (*ResponseOperation) ReadFrom

func (r *ResponseOperation) ReadFrom(rr io.Reader) (int64, error)

ReadFrom is function to read request data from io.Reader. Returns read bytes.

type Time

type Time int64

Time is Apache Ignite Time type

func ToTime

func ToTime(t time.Time) Time

ToTime converts Golang time.Time to Apache Ignite Time

Jump to

Keyboard shortcuts

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