riak

package module
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2016 License: Apache-2.0 Imports: 24 Imported by: 87

README

Riak Go Client

The Riak Go Client is a client which makes it easy to communicate with Riak, an open source, distributed database that focuses on high availability, horizontal scalability, and predictable latency. Both Riak and this code is maintained by Basho.

  1. Installation
  2. Documentation
  3. Contributing
  4. Roadmap
  5. License and Authors

Build Status

Build Status

Installation

go get github.com/basho/riak-go-client

Documentation

Contributing

Note: Please clone this repository in such a manner that submodules are also cloned:

git clone --recursive https://github.com/basho/riak-go-client

OR:

git clone https://github.com/basho/riak-go-client
git submodule init --update

This repository's maintainers are engineers at Basho and we welcome your contribution to the project! Review the details in CONTRIBUTING.md in order to give back to this project.

An honest disclaimer

Due to our obsession with stability and our rich ecosystem of users, community updates on this repo may take a little longer to review.

The most helpful way to contribute is by reporting your experience through issues. Issues may not be updated while we review internally, but they're still incredibly appreciated.

Thank you for being part of the community! We love you for it.

Roadmap

  • 1.0.0 - Full Riak 2 support with command queuing and retries.

License

The Riak Go Client is Open Source software released under the Apache 2.0 License. Please see the LICENSE file for full license details.

These excellent community projects inspired this client and parts of their code are in riak-go-client as well:

Authors

Contributors

Thank you to all of our contributors!

Documentation

Overview

Package riak provides the interfaces needed to interact with Riak KV using Protocol Buffers. Riak KV is a distributed key-value datastore designed to be fault tolerant, scalable, and flexible.

Currently, this library was written for and tested against Riak KV 2.0+.

TL;DR;

import (
	"fmt"
	"os"
	riak "github.com/basho/riak-go-client"
)

func main() {
	nodeOpts := &riak.NodeOptions{
		RemoteAddress: "127.0.0.1:8087",
	}

	var node *riak.Node
	var err error
	if node, err = riak.NewNode(nodeOpts); err != nil {
		fmt.Println(err.Error())
		os.Exit(1)
	}

	nodes := []*riak.Node{node}
	opts := &riak.ClusterOptions{
		Nodes: nodes,
	}

	cluster, err := riak.NewCluster(opts)
	if err != nil {
		fmt.Println(err.Error())
		os.Exit(1)
	}

	defer func() {
		if err := cluster.Stop(); err != nil {
			fmt.Println(err.Error())
			os.Exit(1)
		}
	}()

	if err := cluster.Start(); err != nil {
		fmt.Println(err.Error())
		os.Exit(1)
	}

	obj := &riak.Object{
		ContentType:     "text/plain",
		Charset:         "utf-8",
		ContentEncoding: "utf-8",
		Value:           []byte("this is a value in Riak"),
	}

	cmd, err := riak.NewStoreValueCommandBuilder().
		WithBucket("testBucketName").
		WithContent(obj).
		Build()
	if err != nil {
		fmt.Println(err.Error())
		os.Exit(1)
	}

	if err := cluster.Execute(cmd); err != nil {
		fmt.Println(err.Error())
		os.Exit(1)
	}

	svc := cmd.(*riak.StoreValueCommand)
	rsp := svc.Response
	fmt.Println(rsp.GeneratedKey)
}

Index

Examples

Constants

View Source
const ErrClientInvalidRemoteAddress = "[Client] invalid RemoteAddress '%s'"
View Source
const ErrClusterNoNodesAvailable = "[Cluster] all retries exhausted and/or no nodes available to execute command"

Variables

View Source
var (
	ErrClientOptionsRequired     = newClientError("[Client] options are required", nil)
	ErrClientMissingRequiredData = newClientError("[Client] options must specify either a Cluster or a set of RemoteAddresses", nil)
)
View Source
var (
	ErrClusterNodesMustBeNonNil               = newClientError("[Cluster] all nodes must be non-nil", nil)
	ErrClusterCommandRequired                 = newClientError("[Cluster] Command must be non-nil", nil)
	ErrClusterAsyncRequiresChannelOrWaitGroup = newClientError("[Cluster] ExecuteAsync argument requires a channel or sync.WaitGroup to indicate completion", nil)
	ErrClusterEnqueueWhileShuttingDown        = newClientError("[Cluster] will not enqueue command, shutting down", nil)
	ErrClusterShuttingDown                    = newClientError("[Cluster] will not execute command, shutting down", nil)
	ErrClusterNodeMustBeNonNil                = newClientError("[Cluster] node argument must be non-nil", nil)
)

Cluster errors

View Source
var (
	ErrCannotRead  = errors.New("Cannot read from a non-active or closed connection")
	ErrCannotWrite = errors.New("Cannot write to a non-active or closed connection")
)

Connection errors

View Source
var (
	ErrConnectionManagerRequiresOptions         = newClientError("[connectionManager] new manager requires options", nil)
	ErrConnectionManagerRequiresAddress         = newClientError("[connectionManager] new manager requires non-nil address", nil)
	ErrConnectionManagerMaxMustBeGreaterThanMin = newClientError("[connectionManager] new connection manager maxConnections must be greater than minConnections", nil)
	ErrConnMgrAllConnectionsInUse               = newClientError("[connectionManager] all connections in use / max connections reached", nil)
)
View Source
var (
	ErrAddressRequired      = newClientError("RemoteAddress is required in options", nil)
	ErrAuthMissingConfig    = newClientError("[Connection] authentication is missing TLS config", nil)
	ErrAuthTLSUpgradeFailed = newClientError("[Connection] upgrading to TLS connection failed", nil)
	ErrBucketRequired       = newClientError("Bucket is required", nil)
	ErrKeyRequired          = newClientError("Key is required", nil)
	ErrNilOptions           = newClientError("[Command] options must be non-nil", nil)
	ErrOptionsRequired      = newClientError("Options are required", nil)
	ErrZeroLength           = newClientError("[Command] 0 byte data response", nil)
	ErrTableRequired        = newClientError("Table is required", nil)
	ErrQueryRequired        = newClientError("Query is required", nil)
)

Client errors

View Source
var EnableDebugLogging = false

If true, debug messages will be written to the log

View Source
var ErrDefaultNodeManagerRequiresNode = newClientError("Must pass at least one node to default node manager", nil)

Functions

func ToUnixMillis added in v1.7.0

func ToUnixMillis(t time.Time) int64

ToUnixMillis converts a time.Time to Unix milliseconds since UTC epoch

Types

type Async

type Async struct {
	Command Command
	Done    chan Command
	Wait    *sync.WaitGroup
	Error   error
	// contains filtered or unexported fields
}

Async object is used to pass required arguments to execute a Command asynchronously

type AuthOptions

type AuthOptions struct {
	User      string
	Password  string
	TlsConfig *tls.Config
}

AuthOptions object contains the authentication credentials and tls config

type Client

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

Client object contains your cluster object

func NewClient

func NewClient(opts *NewClientOptions) (*Client, error)

NewClient generates a new Client object using the provided options

func (*Client) Cluster

func (c *Client) Cluster() *Cluster

func (*Client) Execute

func (c *Client) Execute(cmd Command) error

Execute (synchronously) the provided Command against the cluster

func (*Client) ExecuteAsync

func (c *Client) ExecuteAsync(a *Async) error

Execute (asynchronously) the provided Command against the cluster

func (*Client) Ping added in v1.3.0

func (c *Client) Ping() (bool, error)

Pings the cluster

func (*Client) Stop

func (c *Client) Stop() error

Stop the nodes in the cluster and the cluster itself

type ClientError

type ClientError struct {
	Errmsg     string
	InnerError error
}

func (ClientError) Error

func (e ClientError) Error() (s string)

type Cluster

type Cluster struct {
	sync.Mutex
	// contains filtered or unexported fields
}

Cluster object contains your pool of Node objects, the NodeManager and the current stateData object of the cluster

func NewCluster

func NewCluster(options *ClusterOptions) (*Cluster, error)

NewCluster generates a new Cluster object using the provided ClusterOptions object

Example
cluster, err := NewCluster(nil)
if err != nil {
	panic(fmt.Sprintf("Error building cluster object: %s", err.Error()))
}
fmt.Println(cluster.nodes[0].addr.String())
Output:

127.0.0.1:8087

func (*Cluster) AddNode

func (c *Cluster) AddNode(n *Node) error

Adds a node to the cluster and starts it

func (*Cluster) Execute

func (c *Cluster) Execute(command Command) error

Execute (synchronously) the provided Command against the active pooled Nodes using the NodeManager

func (*Cluster) ExecuteAsync

func (c *Cluster) ExecuteAsync(async *Async) error

Execute (asynchronously) the provided Command against the active pooled Nodes using the NodeManager

func (*Cluster) RemoveNode

func (c *Cluster) RemoveNode(n *Node) error

Stops the node and removes from the cluster

func (*Cluster) Start

func (c *Cluster) Start() error

Start opens connections with your configured nodes and adds them to the active pool

func (*Cluster) Stop

func (c *Cluster) Stop() (err error)

Stop closes the connections with your configured nodes and removes them from the active pool

func (*Cluster) String

func (c *Cluster) String() string

String returns a formatted string that lists status information for the Cluster

type ClusterOptions

type ClusterOptions struct {
	Nodes                  []*Node
	NoDefaultNode          bool
	NodeManager            NodeManager
	ExecutionAttempts      byte
	QueueMaxDepth          uint16
	QueueExecutionInterval time.Duration
}

ClusterOptions object contains your pool of Node objects and the NodeManager If the NodeManager is not defined, the defaultNodeManager is used

type Command

type Command interface {
	Name() string
	Success() bool
	Error() error
	// contains filtered or unexported methods
}

Command interface enforces proper structure of a Command object

type CommandBuilder

type CommandBuilder interface {
	Build() (Command, error)
}

CommandBuilder interface requires Build() method for generating the Command to be executed

type CommitHook

type CommitHook struct {
	Name   string
	ModFun *ModFun
}

CommitHook object is used when fetching or updating pre- or post- commit hook bucket properties on Riak

type ConflictResolver

type ConflictResolver interface {
	Resolve([]*Object) []*Object
}

ConflictResolver is an interface to handle sibling conflicts for a key

type DeleteIndexCommand

type DeleteIndexCommand struct {
	Response bool
	// contains filtered or unexported fields
}

DeleteIndexCommand is used to delete a search index from Riak

func (*DeleteIndexCommand) Error added in v1.2.0

func (cmd *DeleteIndexCommand) Error() error

func (*DeleteIndexCommand) Name

func (cmd *DeleteIndexCommand) Name() string

Name identifies this command

func (*DeleteIndexCommand) Success added in v1.2.0

func (cmd *DeleteIndexCommand) Success() bool

type DeleteIndexCommandBuilder

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

DeleteIndexCommandBuilder type is required for creating new instances of DeleteIndexCommand

command := NewDeleteIndexCommandBuilder().
	WithIndexName("myIndexName").
	Build()

func NewDeleteIndexCommandBuilder

func NewDeleteIndexCommandBuilder() *DeleteIndexCommandBuilder

NewDeleteIndexCommandBuilder is a factory function for generating the command builder struct

func (*DeleteIndexCommandBuilder) Build

func (builder *DeleteIndexCommandBuilder) Build() (Command, error)

Build validates the configuration options provided then builds the command

func (*DeleteIndexCommandBuilder) WithIndexName

func (builder *DeleteIndexCommandBuilder) WithIndexName(indexName string) *DeleteIndexCommandBuilder

WithIndexName sets the index to use for the command

type DeleteValueCommand

type DeleteValueCommand struct {
	Response bool
	// contains filtered or unexported fields
}

DeleteValueCommand is used to delete a value from Riak KV.

func (*DeleteValueCommand) Error added in v1.2.0

func (cmd *DeleteValueCommand) Error() error

func (*DeleteValueCommand) Name

func (cmd *DeleteValueCommand) Name() string

Name identifies this command

func (*DeleteValueCommand) Success added in v1.2.0

func (cmd *DeleteValueCommand) Success() bool

type DeleteValueCommandBuilder

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

DeleteValueCommandBuilder type is required for creating new instances of DeleteValueCommand

deleteValue := NewDeleteValueCommandBuilder().
	WithBucketType("myBucketType").
	WithBucket("myBucket").
	WithKey("myKey").
	WithVClock(vclock).
	Build()

func NewDeleteValueCommandBuilder

func NewDeleteValueCommandBuilder() *DeleteValueCommandBuilder

NewDeleteValueCommandBuilder is a factory function for generating the command builder struct

func (*DeleteValueCommandBuilder) Build

func (builder *DeleteValueCommandBuilder) Build() (Command, error)

Build validates the configuration options provided then builds the command

func (*DeleteValueCommandBuilder) WithBucket

func (builder *DeleteValueCommandBuilder) WithBucket(bucket string) *DeleteValueCommandBuilder

WithBucket sets the bucket to be used by the command

func (*DeleteValueCommandBuilder) WithBucketType

func (builder *DeleteValueCommandBuilder) WithBucketType(bucketType string) *DeleteValueCommandBuilder

WithBucketType sets the bucket-type to be used by the command. If omitted, 'default' is used

func (*DeleteValueCommandBuilder) WithDw

WithDw (durable writes) sets the number of nodes that must report back a successful write to backend storage in order for the command operation to be considered a success by Riak. If ommitted, the bucket default is used.

See http://basho.com/posts/technical/riaks-config-behaviors-part-2/

func (*DeleteValueCommandBuilder) WithKey

WithKey sets the key to be used by the command to read / write values

func (*DeleteValueCommandBuilder) WithPr

WithPr sets the number of primary nodes (N) that must be read from in order for the command operation to be considered a success by Riak. If ommitted, the bucket default is used.

See http://basho.com/posts/technical/riaks-config-behaviors-part-2/

func (*DeleteValueCommandBuilder) WithPw

WithPw sets the number of primary nodes (N) that must report back a successful write in order for the command operation to be considered a success by Riak. If ommitted, the bucket default is used.

See http://basho.com/posts/technical/riaks-config-behaviors-part-2/

func (*DeleteValueCommandBuilder) WithR

WithR sets the number of nodes that must report back a successful read in order for the command operation to be considered a success by Riak. If ommitted, the bucket default is used.

See http://basho.com/posts/technical/riaks-config-behaviors-part-2/

func (*DeleteValueCommandBuilder) WithRw

WithRw (delete quorum) sets the number of nodes that must report back a successful delete to backend storage in order for the command operation to be considered a success by Riak. It represents the read and write operations that are completed internal to Riak to complete a delete. If ommitted, the bucket default is used.

See http://basho.com/posts/technical/riaks-config-behaviors-part-2/

func (*DeleteValueCommandBuilder) WithTimeout

func (builder *DeleteValueCommandBuilder) WithTimeout(timeout time.Duration) *DeleteValueCommandBuilder

WithTimeout sets a timeout to be used for this command operation

func (*DeleteValueCommandBuilder) WithVClock

func (builder *DeleteValueCommandBuilder) WithVClock(vclock []byte) *DeleteValueCommandBuilder

WithVClock sets the vector clock.

If not set siblings may be created depending on bucket properties.

func (*DeleteValueCommandBuilder) WithW

WithW sets the number of nodes that must report back a successful write in order for then command operation to be considered a success by Riak. If ommitted, the bucket default is used.

See http://basho.com/posts/technical/riaks-config-behaviors-part-2/

type FetchBucketPropsCommand

type FetchBucketPropsCommand struct {
	Response *FetchBucketPropsResponse
	// contains filtered or unexported fields
}

FetchBucketPropsCommand is used to fetch the active / non-default properties for a bucket

func (*FetchBucketPropsCommand) Error added in v1.2.0

func (cmd *FetchBucketPropsCommand) Error() error

func (*FetchBucketPropsCommand) Name

func (cmd *FetchBucketPropsCommand) Name() string

func (*FetchBucketPropsCommand) Success added in v1.2.0

func (cmd *FetchBucketPropsCommand) Success() bool

type FetchBucketPropsCommandBuilder

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

FetchBucketPropsCommandBuilder type is required for creating new instances of FetchBucketPropsCommand

command := NewFetchBucketPropsCommandBuilder().
	WithBucketType("myBucketType").
	WithBucket("myBucket").
	Build()

func NewFetchBucketPropsCommandBuilder

func NewFetchBucketPropsCommandBuilder() *FetchBucketPropsCommandBuilder

NewFetchBucketPropsCommandBuilder is a factory function for generating the command builder struct

func (*FetchBucketPropsCommandBuilder) Build

func (builder *FetchBucketPropsCommandBuilder) Build() (Command, error)

Build validates the configuration options provided then builds the command

func (*FetchBucketPropsCommandBuilder) WithBucket

WithBucket sets the bucket to be used by the command

func (*FetchBucketPropsCommandBuilder) WithBucketType

func (builder *FetchBucketPropsCommandBuilder) WithBucketType(bucketType string) *FetchBucketPropsCommandBuilder

WithBucketType sets the bucket-type to be used by the command. If omitted, 'default' is used

type FetchBucketPropsResponse

type FetchBucketPropsResponse struct {
	NVal          uint32
	AllowMult     bool
	LastWriteWins bool
	HasPrecommit  bool
	HasPostcommit bool
	OldVClock     uint32
	YoungVClock   uint32
	BigVClock     uint32
	SmallVClock   uint32
	R             uint32
	Pr            uint32
	W             uint32
	Pw            uint32
	Dw            uint32
	Rw            uint32
	BasicQuorum   bool
	NotFoundOk    bool
	Search        bool
	Consistent    bool
	Repl          ReplMode
	Backend       string
	SearchIndex   string
	DataType      string
	PreCommit     []*CommitHook
	PostCommit    []*CommitHook
	ChashKeyFun   *ModFun
	LinkFun       *ModFun
}

FetchBucketPropsResponse contains the response data for both FetchBucketPropsCommand and FetchBucketTypePropsCommand

type FetchBucketTypePropsCommand added in v1.5.0

type FetchBucketTypePropsCommand struct {
	Response *FetchBucketPropsResponse
	// contains filtered or unexported fields
}

FetchBucketTypePropsCommand is used to fetch the active / non-default properties for a bucket type

func (*FetchBucketTypePropsCommand) Error added in v1.5.0

func (cmd *FetchBucketTypePropsCommand) Error() error

func (*FetchBucketTypePropsCommand) Name added in v1.5.0

func (cmd *FetchBucketTypePropsCommand) Name() string

func (*FetchBucketTypePropsCommand) Success added in v1.5.0

func (cmd *FetchBucketTypePropsCommand) Success() bool

type FetchBucketTypePropsCommandBuilder added in v1.5.0

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

FetchBucketTypePropsCommandBuilder type is required for creating new instances of FetchBucketTypePropsCommand

command := NewFetchBucketTypePropsCommandBuilder().
	WithBucketType("myBucketType").
	Build()

func NewFetchBucketTypePropsCommandBuilder added in v1.5.0

func NewFetchBucketTypePropsCommandBuilder() *FetchBucketTypePropsCommandBuilder

NewFetchBucketTypePropsCommandBuilder is a factory function for generating the command builder struct

func (*FetchBucketTypePropsCommandBuilder) Build added in v1.5.0

func (builder *FetchBucketTypePropsCommandBuilder) Build() (Command, error)

Build validates the configuration options provided then builds the command

func (*FetchBucketTypePropsCommandBuilder) WithBucketType added in v1.5.0

WithBucketType sets the bucket-type to be used by the command. If omitted, 'default' is used

type FetchCounterCommand

type FetchCounterCommand struct {
	Response *FetchCounterResponse
	// contains filtered or unexported fields
}

FetchCounterCommand fetches a counter CRDT from Riak

func (*FetchCounterCommand) Error added in v1.2.0

func (cmd *FetchCounterCommand) Error() error

func (*FetchCounterCommand) Name

func (cmd *FetchCounterCommand) Name() string

Name identifies this command

func (*FetchCounterCommand) Success added in v1.2.0

func (cmd *FetchCounterCommand) Success() bool

type FetchCounterCommandBuilder

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

FetchCounterCommandBuilder type is required for creating new instances of FetchCounterCommand

command := NewFetchCounterCommandBuilder().
	WithBucketType("myBucketType").
	WithBucket("myBucket").
	WithKey("myKey").
	Build()

func NewFetchCounterCommandBuilder

func NewFetchCounterCommandBuilder() *FetchCounterCommandBuilder

NewFetchCounterCommandBuilder is a factory function for generating the command builder struct

func (*FetchCounterCommandBuilder) Build

func (builder *FetchCounterCommandBuilder) Build() (Command, error)

Build validates the configuration options provided then builds the command

func (*FetchCounterCommandBuilder) WithBasicQuorum

func (builder *FetchCounterCommandBuilder) WithBasicQuorum(basicQuorum bool) *FetchCounterCommandBuilder

WithBasicQuorum sets basic_quorum, whether to return early in some failure cases (eg. when r=1 and you get 2 errors and a success basic_quorum=true would return an error)

See http://basho.com/posts/technical/riaks-config-behaviors-part-3/

func (*FetchCounterCommandBuilder) WithBucket

func (builder *FetchCounterCommandBuilder) WithBucket(bucket string) *FetchCounterCommandBuilder

WithBucket sets the bucket to be used by the command

func (*FetchCounterCommandBuilder) WithBucketType

func (builder *FetchCounterCommandBuilder) WithBucketType(bucketType string) *FetchCounterCommandBuilder

WithBucketType sets the bucket-type to be used by the command. If omitted, 'default' is used

func (*FetchCounterCommandBuilder) WithKey

WithKey sets the key to be used by the command to read / write values

func (*FetchCounterCommandBuilder) WithNotFoundOk

func (builder *FetchCounterCommandBuilder) WithNotFoundOk(notFoundOk bool) *FetchCounterCommandBuilder

WithNotFoundOk sets notfound_ok, whether to treat notfounds as successful reads for the purposes of R

See http://basho.com/posts/technical/riaks-config-behaviors-part-3/

func (*FetchCounterCommandBuilder) WithPr

WithPr sets the number of primary nodes (N) that must be read from in order for the command operation to be considered a success by Riak. If ommitted, the bucket default is used.

See http://basho.com/posts/technical/riaks-config-behaviors-part-2/

func (*FetchCounterCommandBuilder) WithR

WithR sets the number of nodes that must report back a successful read in order for the command operation to be considered a success by Riak. If ommitted, the bucket default is used.

See http://basho.com/posts/technical/riaks-config-behaviors-part-2/

func (*FetchCounterCommandBuilder) WithTimeout

func (builder *FetchCounterCommandBuilder) WithTimeout(timeout time.Duration) *FetchCounterCommandBuilder

WithTimeout sets a timeout to be used for this command operation

type FetchCounterResponse

type FetchCounterResponse struct {
	IsNotFound   bool
	CounterValue int64
}

FetchCounterResponse contains the response data for a FetchCounterCommand

type FetchIndexCommand

type FetchIndexCommand struct {
	Response []*SearchIndex
	// contains filtered or unexported fields
}

FetchIndexCommand is used to fetch a search index from Riak

func (*FetchIndexCommand) Error added in v1.2.0

func (cmd *FetchIndexCommand) Error() error

func (*FetchIndexCommand) Name

func (cmd *FetchIndexCommand) Name() string

Name identifies this command

func (*FetchIndexCommand) Success added in v1.2.0

func (cmd *FetchIndexCommand) Success() bool

type FetchIndexCommandBuilder

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

FetchIndexCommandBuilder type is required for creating new instances of FetchIndexCommand

command := NewFetchIndexCommandBuilder().
	WithIndexName("myIndexName").
	Build()

func NewFetchIndexCommandBuilder

func NewFetchIndexCommandBuilder() *FetchIndexCommandBuilder

NewFetchIndexCommandBuilder is a factory function for generating the command builder struct

func (*FetchIndexCommandBuilder) Build

func (builder *FetchIndexCommandBuilder) Build() (Command, error)

Build validates the configuration options provided then builds the command

func (*FetchIndexCommandBuilder) WithIndexName

func (builder *FetchIndexCommandBuilder) WithIndexName(indexName string) *FetchIndexCommandBuilder

WithIndexName sets the index to use for the command

type FetchMapCommand

type FetchMapCommand struct {
	Response *FetchMapResponse
	// contains filtered or unexported fields
}

FetchMapCommand fetches a map CRDT from Riak

func (*FetchMapCommand) Error added in v1.2.0

func (cmd *FetchMapCommand) Error() error

func (*FetchMapCommand) Name

func (cmd *FetchMapCommand) Name() string

Name identifies this command

func (*FetchMapCommand) Success added in v1.2.0

func (cmd *FetchMapCommand) Success() bool

type FetchMapCommandBuilder

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

FetchMapCommandBuilder type is required for creating new instances of FetchMapCommand

command := NewFetchMapCommandBuilder().
	WithBucketType("myBucketType").
	WithBucket("myBucket").
	WithKey("myKey").
	Build()

func NewFetchMapCommandBuilder

func NewFetchMapCommandBuilder() *FetchMapCommandBuilder

NewFetchMapCommandBuilder is a factory function for generating the command builder struct

func (*FetchMapCommandBuilder) Build

func (builder *FetchMapCommandBuilder) Build() (Command, error)

Build validates the configuration options provided then builds the command

func (*FetchMapCommandBuilder) WithBasicQuorum

func (builder *FetchMapCommandBuilder) WithBasicQuorum(basicQuorum bool) *FetchMapCommandBuilder

WithBasicQuorum sets basic_quorum, whether to return early in some failure cases (eg. when r=1 and you get 2 errors and a success basic_quorum=true would return an error)

See http://basho.com/posts/technical/riaks-config-behaviors-part-3/

func (*FetchMapCommandBuilder) WithBucket

func (builder *FetchMapCommandBuilder) WithBucket(bucket string) *FetchMapCommandBuilder

WithBucket sets the bucket to be used by the command

func (*FetchMapCommandBuilder) WithBucketType

func (builder *FetchMapCommandBuilder) WithBucketType(bucketType string) *FetchMapCommandBuilder

WithBucketType sets the bucket-type to be used by the command. If omitted, 'default' is used

func (*FetchMapCommandBuilder) WithKey

func (builder *FetchMapCommandBuilder) WithKey(key string) *FetchMapCommandBuilder

WithKey sets the key to be used by the command to read / write values

func (*FetchMapCommandBuilder) WithNotFoundOk

func (builder *FetchMapCommandBuilder) WithNotFoundOk(notFoundOk bool) *FetchMapCommandBuilder

WithNotFoundOk sets notfound_ok, whether to treat notfounds as successful reads for the purposes of R

See http://basho.com/posts/technical/riaks-config-behaviors-part-3/

func (*FetchMapCommandBuilder) WithPr

WithPr sets the number of primary nodes (N) that must be read from in order for the command operation to be considered a success by Riak. If ommitted, the bucket default is used.

See http://basho.com/posts/technical/riaks-config-behaviors-part-2/

func (*FetchMapCommandBuilder) WithR

WithR sets the number of nodes that must report back a successful read in order for the command operation to be considered a success by Riak. If ommitted, the bucket default is used.

See http://basho.com/posts/technical/riaks-config-behaviors-part-2/

func (*FetchMapCommandBuilder) WithTimeout

func (builder *FetchMapCommandBuilder) WithTimeout(timeout time.Duration) *FetchMapCommandBuilder

WithTimeout sets a timeout in milliseconds to be used for this command operation

type FetchMapResponse

type FetchMapResponse struct {
	IsNotFound bool
	Context    []byte
	Map        *Map
}

FetchMapResponse contains the response data for a FetchMapCommand

type FetchPreflistCommand

type FetchPreflistCommand struct {
	Response *FetchPreflistResponse
	// contains filtered or unexported fields
}

FetchPreflistCommand is used to fetch the preference list for a key from Riak KV

func (*FetchPreflistCommand) Error added in v1.2.0

func (cmd *FetchPreflistCommand) Error() error

func (*FetchPreflistCommand) Name

func (cmd *FetchPreflistCommand) Name() string

Name identifies this command

func (*FetchPreflistCommand) Success added in v1.2.0

func (cmd *FetchPreflistCommand) Success() bool

type FetchPreflistCommandBuilder

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

FetchPreflistCommandBuilder type is required for creating new instances of FetchPreflistCommand

preflist := NewFetchPreflistCommandBuilder().
	WithBucketType("myBucketType").
	WithBucket("myBucket").
	WithKey("myKey").
	Build()

func NewFetchPreflistCommandBuilder

func NewFetchPreflistCommandBuilder() *FetchPreflistCommandBuilder

NewFetchPreflistCommandBuilder is a factory function for generating the command builder struct

func (*FetchPreflistCommandBuilder) Build

func (builder *FetchPreflistCommandBuilder) Build() (Command, error)

Build validates the configuration options provided then builds the command

func (*FetchPreflistCommandBuilder) WithBucket

func (builder *FetchPreflistCommandBuilder) WithBucket(bucket string) *FetchPreflistCommandBuilder

WithBucket sets the bucket to be used by the command

func (*FetchPreflistCommandBuilder) WithBucketType

func (builder *FetchPreflistCommandBuilder) WithBucketType(bucketType string) *FetchPreflistCommandBuilder

WithBucketType sets the bucket-type to be used by the command. If omitted, 'default' is used

func (*FetchPreflistCommandBuilder) WithKey

WithKey sets the key to be used by the command to read / write values

type FetchPreflistResponse

type FetchPreflistResponse struct {
	Preflist []*PreflistItem
}

FetchPreflistResponse contains the response data for a FetchPreflistCommand

type FetchSchemaCommand

type FetchSchemaCommand struct {
	Response *Schema
	// contains filtered or unexported fields
}

FetchSchemaCommand is used to GET a search schema from Riak

func (*FetchSchemaCommand) Error added in v1.2.0

func (cmd *FetchSchemaCommand) Error() error

func (*FetchSchemaCommand) Name

func (cmd *FetchSchemaCommand) Name() string

Name identifies this command

func (*FetchSchemaCommand) Success added in v1.2.0

func (cmd *FetchSchemaCommand) Success() bool

type FetchSchemaCommandBuilder

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

FetchSchemaCommandBuilder type is required for creating new instances of FetchSchemaCommand

command := NewFetchSchemaCommandBuilder().
	WithSchemaName("mySchemaName").
	Build()

func NewFetchSchemaCommandBuilder

func NewFetchSchemaCommandBuilder() *FetchSchemaCommandBuilder

NewFetchSchemaCommandBuilder is a factory function for generating the command builder struct

func (*FetchSchemaCommandBuilder) Build

func (builder *FetchSchemaCommandBuilder) Build() (Command, error)

Build validates the configuration options provided then builds the command

func (*FetchSchemaCommandBuilder) WithSchemaName

func (builder *FetchSchemaCommandBuilder) WithSchemaName(schemaName string) *FetchSchemaCommandBuilder

WithSchemaName sets the schema that the command will use

type FetchSetCommand

type FetchSetCommand struct {
	Response *FetchSetResponse
	// contains filtered or unexported fields
}

FetchSetCommand fetches a set CRDT from Riak

func (*FetchSetCommand) Error added in v1.2.0

func (cmd *FetchSetCommand) Error() error

func (*FetchSetCommand) Name

func (cmd *FetchSetCommand) Name() string

Name identifies this command

func (*FetchSetCommand) Success added in v1.2.0

func (cmd *FetchSetCommand) Success() bool

type FetchSetCommandBuilder

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

FetchSetCommandBuilder type is required for creating new instances of FetchSetCommand

command := NewFetchSetCommandBuilder().
	WithBucketType("myBucketType").
	WithBucket("myBucket").
	WithKey("myKey").
	Build()

func NewFetchSetCommandBuilder

func NewFetchSetCommandBuilder() *FetchSetCommandBuilder

NewFetchSetCommandBuilder is a factory function for generating the command builder struct

func (*FetchSetCommandBuilder) Build

func (builder *FetchSetCommandBuilder) Build() (Command, error)

Build validates the configuration options provided then builds the command

func (*FetchSetCommandBuilder) WithBasicQuorum

func (builder *FetchSetCommandBuilder) WithBasicQuorum(basicQuorum bool) *FetchSetCommandBuilder

WithBasicQuorum sets basic_quorum, whether to return early in some failure cases (eg. when r=1 and you get 2 errors and a success basic_quorum=true would return an error)

See http://basho.com/posts/technical/riaks-config-behaviors-part-3/

func (*FetchSetCommandBuilder) WithBucket

func (builder *FetchSetCommandBuilder) WithBucket(bucket string) *FetchSetCommandBuilder

WithBucket sets the bucket to be used by the command

func (*FetchSetCommandBuilder) WithBucketType

func (builder *FetchSetCommandBuilder) WithBucketType(bucketType string) *FetchSetCommandBuilder

WithBucketType sets the bucket-type to be used by the command. If omitted, 'default' is used

func (*FetchSetCommandBuilder) WithKey

func (builder *FetchSetCommandBuilder) WithKey(key string) *FetchSetCommandBuilder

WithKey sets the key to be used by the command to read / write values

func (*FetchSetCommandBuilder) WithNotFoundOk

func (builder *FetchSetCommandBuilder) WithNotFoundOk(notFoundOk bool) *FetchSetCommandBuilder

WithNotFoundOk sets notfound_ok, whether to treat notfounds as successful reads for the purposes of R

See http://basho.com/posts/technical/riaks-config-behaviors-part-3/

func (*FetchSetCommandBuilder) WithPr

WithPr sets the number of primary nodes (N) that must be read from in order for the command operation to be considered a success by Riak. If ommitted, the bucket default is used.

See http://basho.com/posts/technical/riaks-config-behaviors-part-2/

func (*FetchSetCommandBuilder) WithR

WithR sets the number of nodes that must report back a successful read in order for the command operation to be considered a success by Riak. If ommitted, the bucket default is used.

See http://basho.com/posts/technical/riaks-config-behaviors-part-2/

func (*FetchSetCommandBuilder) WithTimeout

func (builder *FetchSetCommandBuilder) WithTimeout(timeout time.Duration) *FetchSetCommandBuilder

WithTimeout sets a timeout to be used for this command operation

type FetchSetResponse

type FetchSetResponse struct {
	IsNotFound bool
	Context    []byte
	SetValue   [][]byte
}

FetchSetResponse contains the response data for a FetchSetCommand

type FetchValueCommand

type FetchValueCommand struct {
	Response *FetchValueResponse
	// contains filtered or unexported fields
}

FetchValueCommand is used to fetch / get a value from Riak KV

func (*FetchValueCommand) Error added in v1.2.0

func (cmd *FetchValueCommand) Error() error

func (*FetchValueCommand) Name

func (cmd *FetchValueCommand) Name() string

Name identifies this command

func (*FetchValueCommand) Success added in v1.2.0

func (cmd *FetchValueCommand) Success() bool

type FetchValueCommandBuilder

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

FetchValueCommandBuilder type is required for creating new instances of FetchValueCommand

command := NewFetchValueCommandBuilder().
	WithBucketType("myBucketType").
	WithBucket("myBucket").
	WithKey("myKey").
	Build()

func NewFetchValueCommandBuilder

func NewFetchValueCommandBuilder() *FetchValueCommandBuilder

NewFetchValueCommandBuilder is a factory function for generating the command builder struct

func (*FetchValueCommandBuilder) Build

func (builder *FetchValueCommandBuilder) Build() (Command, error)

Build validates the configuration options provided then builds the command

func (*FetchValueCommandBuilder) WithBasicQuorum

func (builder *FetchValueCommandBuilder) WithBasicQuorum(basicQuorum bool) *FetchValueCommandBuilder

WithBasicQuorum sets basic_quorum, whether to return early in some failure cases (eg. when r=1 and you get 2 errors and a success basic_quorum=true would return an error)

See http://basho.com/posts/technical/riaks-config-behaviors-part-3/

func (*FetchValueCommandBuilder) WithBucket

func (builder *FetchValueCommandBuilder) WithBucket(bucket string) *FetchValueCommandBuilder

WithBucket sets the bucket to be used by the command

func (*FetchValueCommandBuilder) WithBucketType

func (builder *FetchValueCommandBuilder) WithBucketType(bucketType string) *FetchValueCommandBuilder

WithBucketType sets the bucket-type to be used by the command. If omitted, 'default' is used

func (*FetchValueCommandBuilder) WithConflictResolver

func (builder *FetchValueCommandBuilder) WithConflictResolver(resolver ConflictResolver) *FetchValueCommandBuilder

WithConflictResolver builds the command object with a user defined ConflictResolver for handling conflicting key values

func (*FetchValueCommandBuilder) WithHeadOnly

func (builder *FetchValueCommandBuilder) WithHeadOnly(headOnly bool) *FetchValueCommandBuilder

WithHeadOnly returns only the meta data for the value, useful when objects contain large amounts of data

func (*FetchValueCommandBuilder) WithIfModified

func (builder *FetchValueCommandBuilder) WithIfModified(ifModified []byte) *FetchValueCommandBuilder

WithIfModified tells Riak to only return the object if the vclock in Riak differs from what is provided

func (*FetchValueCommandBuilder) WithKey

WithKey sets the key to be used by the command to read / write values

func (*FetchValueCommandBuilder) WithNVal

func (builder *FetchValueCommandBuilder) WithNVal(nval uint32) *FetchValueCommandBuilder

WithNVal sets the number of times this command operation is replicated in the Cluster. If ommitted, the ring default is used.

See http://basho.com/posts/technical/riaks-config-behaviors-part-2/

func (*FetchValueCommandBuilder) WithNotFoundOk

func (builder *FetchValueCommandBuilder) WithNotFoundOk(notFoundOk bool) *FetchValueCommandBuilder

WithNotFoundOk sets notfound_ok, whether to treat notfounds as successful reads for the purposes of R

See http://basho.com/posts/technical/riaks-config-behaviors-part-3/

func (*FetchValueCommandBuilder) WithPr

WithPr sets the number of primary nodes (N) that must be read from in order for the command operation to be considered a success by Riak. If ommitted, the bucket default is used.

See http://basho.com/posts/technical/riaks-config-behaviors-part-2/

func (*FetchValueCommandBuilder) WithR

WithR sets the number of nodes that must report back a successful read in order for the command operation to be considered a success by Riak. If ommitted, the bucket default is used.

See http://basho.com/posts/technical/riaks-config-behaviors-part-2/

func (*FetchValueCommandBuilder) WithReturnDeletedVClock

func (builder *FetchValueCommandBuilder) WithReturnDeletedVClock(returnDeletedVClock bool) *FetchValueCommandBuilder

WithReturnDeletedVClock sets the command to return a Tombstone if any our found for the key across all of the vnodes

func (*FetchValueCommandBuilder) WithSloppyQuorum

func (builder *FetchValueCommandBuilder) WithSloppyQuorum(sloppyQuorum bool) *FetchValueCommandBuilder

WithSloppyQuorum sets the sloppy_quorum for this Command

See http://docs.basho.com/riak/latest/theory/concepts/Eventual-Consistency/

func (*FetchValueCommandBuilder) WithTimeout

func (builder *FetchValueCommandBuilder) WithTimeout(timeout time.Duration) *FetchValueCommandBuilder

WithTimeout sets a timeout to be used for this command operation

type FetchValueResponse

type FetchValueResponse struct {
	IsNotFound  bool
	IsUnchanged bool
	VClock      []byte
	Values      []*Object
}

FetchValueResponse contains the response data for a FetchValueCommand

type GetServerInfoCommand added in v1.6.0

type GetServerInfoCommand struct {
	Response *GetServerInfoResponse
	// contains filtered or unexported fields
}

GetServerInfoCommand is used to get Riak server information

func (*GetServerInfoCommand) Error added in v1.6.0

func (cmd *GetServerInfoCommand) Error() error

func (*GetServerInfoCommand) Name added in v1.6.0

func (cmd *GetServerInfoCommand) Name() string

Name identifies this command

func (*GetServerInfoCommand) Success added in v1.6.0

func (cmd *GetServerInfoCommand) Success() bool

type GetServerInfoResponse added in v1.6.0

type GetServerInfoResponse struct {
	Node          string
	ServerVersion string
}

GetServerInfoResponse contains the response data for Riak server information

type Link struct {
	Bucket string
	Key    string
	Tag    string
}

Link is used to represent a Riak KV object link, which is a one way link to another object within Riak

type ListBucketsCommand

type ListBucketsCommand struct {
	Response *ListBucketsResponse
	// contains filtered or unexported fields
}

ListBucketsCommand is used to list buckets in a bucket type

func (*ListBucketsCommand) Error added in v1.2.0

func (cmd *ListBucketsCommand) Error() error

func (*ListBucketsCommand) Name

func (cmd *ListBucketsCommand) Name() string

Name identifies this command

func (*ListBucketsCommand) Success added in v1.2.0

func (cmd *ListBucketsCommand) Success() bool

type ListBucketsCommandBuilder

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

ListBucketsCommandBuilder type is required for creating new instances of ListBucketsCommand

cb := func(buckets []string) error {
	// Do something with the result
	return nil
}
cmd := NewListBucketsCommandBuilder().
	WithBucketType("myBucketType").
	WithStreaming(true).
	WithCallback(cb).
	Build()

func NewListBucketsCommandBuilder

func NewListBucketsCommandBuilder() *ListBucketsCommandBuilder

NewListBucketsCommandBuilder is a factory function for generating the command builder struct

func (*ListBucketsCommandBuilder) Build

func (builder *ListBucketsCommandBuilder) Build() (Command, error)

Build validates the configuration options provided then builds the command

func (*ListBucketsCommandBuilder) WithBucketType

func (builder *ListBucketsCommandBuilder) WithBucketType(bucketType string) *ListBucketsCommandBuilder

WithBucketType sets the bucket-type to be used by the command. If omitted, 'default' is used

func (*ListBucketsCommandBuilder) WithCallback

func (builder *ListBucketsCommandBuilder) WithCallback(callback func([]string) error) *ListBucketsCommandBuilder

WithCallback sets the callback to be used when handling a streaming response

Requires WithStreaming(true)

func (*ListBucketsCommandBuilder) WithStreaming

func (builder *ListBucketsCommandBuilder) WithStreaming(streaming bool) *ListBucketsCommandBuilder

WithStreaming sets the command to provide a streamed response

If true, a callback must be provided via WithCallback()

func (*ListBucketsCommandBuilder) WithTimeout

func (builder *ListBucketsCommandBuilder) WithTimeout(timeout time.Duration) *ListBucketsCommandBuilder

WithTimeout sets a timeout in milliseconds to be used for this command operation

type ListBucketsResponse

type ListBucketsResponse struct {
	Buckets []string
}

ListBucketsResponse contains the response data for a ListBucketsCommand

type ListKeysCommand

type ListKeysCommand struct {
	Response *ListKeysResponse
	// contains filtered or unexported fields
}

ListKeysCommand is used to fetch a list of keys within a bucket from Riak KV

func (*ListKeysCommand) Error added in v1.2.0

func (cmd *ListKeysCommand) Error() error

func (*ListKeysCommand) Name

func (cmd *ListKeysCommand) Name() string

Name identifies this command

func (*ListKeysCommand) Success added in v1.2.0

func (cmd *ListKeysCommand) Success() bool

type ListKeysCommandBuilder

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

ListKeysCommandBuilder type is required for creating new instances of ListKeysCommand

cb := func(buckets []string) error {
	// Do something with the result
	return nil
}
cmd := NewListKeysCommandBuilder().
	WithBucketType("myBucketType").
	WithBucket("myBucket").
	WithStreaming(true).
	WithCallback(cb).
	Build()

func NewListKeysCommandBuilder

func NewListKeysCommandBuilder() *ListKeysCommandBuilder

NewListKeysCommandBuilder is a factory function for generating the command builder struct

func (*ListKeysCommandBuilder) Build

func (builder *ListKeysCommandBuilder) Build() (Command, error)

Build validates the configuration options provided then builds the command

func (*ListKeysCommandBuilder) WithBucket

func (builder *ListKeysCommandBuilder) WithBucket(bucket string) *ListKeysCommandBuilder

WithBucket sets the bucket to be used by the command

func (*ListKeysCommandBuilder) WithBucketType

func (builder *ListKeysCommandBuilder) WithBucketType(bucketType string) *ListKeysCommandBuilder

WithBucketType sets the bucket-type to be used by the command. If omitted, 'default' is used

func (*ListKeysCommandBuilder) WithCallback

func (builder *ListKeysCommandBuilder) WithCallback(callback func([]string) error) *ListKeysCommandBuilder

WithCallback sets the callback to be used when handling a streaming response

Requires WithStreaming(true)

func (*ListKeysCommandBuilder) WithStreaming

func (builder *ListKeysCommandBuilder) WithStreaming(streaming bool) *ListKeysCommandBuilder

WithStreaming sets the command to provide a streamed response

If true, a callback must be provided via WithCallback()

func (*ListKeysCommandBuilder) WithTimeout

func (builder *ListKeysCommandBuilder) WithTimeout(timeout time.Duration) *ListKeysCommandBuilder

WithTimeout sets a timeout to be used for this command operation

type ListKeysResponse

type ListKeysResponse struct {
	Keys []string
}

ListKeysResponse contains the response data for a ListKeysCommand

type Map

type Map struct {
	Counters  map[string]int64
	Sets      map[string][][]byte
	Registers map[string][]byte
	Flags     map[string]bool
	Maps      map[string]*Map
}

Map object represents the Riak Map object and is returned within the Response objects for both UpdateMapCommand and FetchMapCommand

type MapOperation

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

MapOperation contains the instructions to send to Riak what updates to the Map you want to complete

func (*MapOperation) AddToSet

func (mapOp *MapOperation) AddToSet(key string, value []byte) *MapOperation

AddToSet adds an element to the child set CRDT of the map at the specified key

func (*MapOperation) IncrementCounter

func (mapOp *MapOperation) IncrementCounter(key string, increment int64) *MapOperation

IncrementCounter increments a child counter CRDT of the map at the specified key

func (*MapOperation) Map

func (mapOp *MapOperation) Map(key string) *MapOperation

Map returns a nested map operation for manipulation

func (*MapOperation) RemoveCounter

func (mapOp *MapOperation) RemoveCounter(key string) *MapOperation

RemoveCounter removes a child counter CRDT from the map at the specified key

func (*MapOperation) RemoveFlag

func (mapOp *MapOperation) RemoveFlag(key string) *MapOperation

RemoveFlag removes a flag CRDT from the map

func (*MapOperation) RemoveFromSet

func (mapOp *MapOperation) RemoveFromSet(key string, value []byte) *MapOperation

RemoveFromSet removes elements from the child set CRDT of the map at the specified key

func (*MapOperation) RemoveMap

func (mapOp *MapOperation) RemoveMap(key string) *MapOperation

RemoveMap removes a nested map from the map

func (*MapOperation) RemoveRegister

func (mapOp *MapOperation) RemoveRegister(key string) *MapOperation

RemoveRegister removes a register CRDT from the map

func (*MapOperation) RemoveSet

func (mapOp *MapOperation) RemoveSet(key string) *MapOperation

RemoveSet removes the child set CRDT from the map

func (*MapOperation) SetFlag

func (mapOp *MapOperation) SetFlag(key string, value bool) *MapOperation

SetFlag sets a flag CRDT on the map

func (*MapOperation) SetRegister

func (mapOp *MapOperation) SetRegister(key string, value []byte) *MapOperation

SetRegister sets a register CRDT on the map with the provided value

type MapReduceCommand

type MapReduceCommand struct {
	Response [][]byte
	// contains filtered or unexported fields
}

MapReduceCommand is used to fetch keys or data from Riak KV using the MapReduce technique

func (*MapReduceCommand) Error added in v1.2.0

func (cmd *MapReduceCommand) Error() error

func (*MapReduceCommand) Name

func (cmd *MapReduceCommand) Name() string

Name identifies this command

func (*MapReduceCommand) Success added in v1.2.0

func (cmd *MapReduceCommand) Success() bool

type MapReduceCommandBuilder

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

MapReduceCommandBuilder type is required for creating new instances of MapReduceCommand

command := NewMapReduceCommandBuilder().
	WithQuery("myMapReduceQuery").
	Build()

func NewMapReduceCommandBuilder

func NewMapReduceCommandBuilder() *MapReduceCommandBuilder

NewMapReduceCommandBuilder is a factory function for generating the command builder struct

func (*MapReduceCommandBuilder) Build

func (builder *MapReduceCommandBuilder) Build() (Command, error)

Build validates the configuration options provided then builds the command

func (*MapReduceCommandBuilder) WithCallback

func (builder *MapReduceCommandBuilder) WithCallback(callback func([]byte) error) *MapReduceCommandBuilder

WithCallback sets the callback to be used when handling a streaming response

Requires WithStreaming(true)

func (*MapReduceCommandBuilder) WithQuery

func (builder *MapReduceCommandBuilder) WithQuery(query string) *MapReduceCommandBuilder

WithQuery sets the map reduce query to be executed on Riak

func (*MapReduceCommandBuilder) WithStreaming

func (builder *MapReduceCommandBuilder) WithStreaming(streaming bool) *MapReduceCommandBuilder

WithStreaming sets the command to provide a streamed response

If true, a callback must be provided via WithCallback()

type ModFun

type ModFun struct {
	Module   string
	Function string
}

ModFun is used when fetching or updating LinkFun or ChashKeyfun bucket properties on Riak

type NewClientOptions

type NewClientOptions struct {
	Cluster         *Cluster
	Port            uint16   // NB: if specified, all connections will use this value if port is not provided
	RemoteAddresses []string // NB: in the form HOST|IP[:PORT]
}

Options for creating a new Client. Either Cluster or Port/RemoteAddress information must be provided

type Node

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

Node is a struct that contains all of the information needed to connect and maintain connections with a Riak KV instance

func NewNode

func NewNode(options *NodeOptions) (*Node, error)

NewNode is a factory function that takes a NodeOptions struct and returns a Node struct

func (*Node) String

func (n *Node) String() string

String returns a formatted string including the remoteAddress for the Node and its current connection count

type NodeManager

type NodeManager interface {
	ExecuteOnNode(nodes []*Node, command Command, previousNode *Node) (bool, error)
}

NodeManager enforces the structure needed to if going to implement your own NodeManager

type NodeOptions

type NodeOptions struct {
	RemoteAddress       string
	MinConnections      uint16
	MaxConnections      uint16
	TempNetErrorRetries uint16
	IdleTimeout         time.Duration
	ConnectTimeout      time.Duration
	RequestTimeout      time.Duration
	HealthCheckInterval time.Duration
	HealthCheckBuilder  CommandBuilder
	AuthOptions         *AuthOptions
}

NodeOptions defines the RemoteAddress and operational configuration for connections to a Riak KV instance

type Object

type Object struct {
	BucketType      string
	Bucket          string
	Key             string
	IsTombstone     bool
	Value           []byte
	ContentType     string
	Charset         string
	ContentEncoding string
	VTag            string
	LastModified    time.Time
	UserMeta        []*Pair
	Indexes         map[string][]string
	Links           []*Link
	VClock          []byte
}

Object structure used for representing a KV Riak object

func (*Object) AddToIndex

func (o *Object) AddToIndex(indexName string, indexValue string)

AddToIndex adds the object to the specified secondary index with the string value to be used for index searches

func (*Object) AddToIntIndex

func (o *Object) AddToIntIndex(indexName string, indexValue int)

AddToIntIndex adds the object to the specified secondary index with the integer value to be used for index searches

func (*Object) HasIndexes

func (o *Object) HasIndexes() bool

HasIndexes is a bool check to determine if the object contains any secondary indexes for searching

func (o *Object) HasLinks() bool

HasLinks is a bool check to determine if the object contains any links

func (*Object) HasUserMeta

func (o *Object) HasUserMeta() bool

HasUserMeta is a bool check to determine if the object contains any user defined meta data

type Pair

type Pair struct {
	Key   string
	Value string
}

Pair is used to store user defined meta data with a key and value

type PingCommand

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

PingCommand is used to verify Riak is online and reachable

func (*PingCommand) Error added in v1.2.0

func (cmd *PingCommand) Error() error

func (*PingCommand) Name

func (cmd *PingCommand) Name() string

Name identifies this command

func (*PingCommand) Success added in v1.2.0

func (cmd *PingCommand) Success() bool

type PingCommandBuilder

type PingCommandBuilder struct {
}

PingCommandBuilder is the command builder required for PingCommand

func (*PingCommandBuilder) Build

func (builder *PingCommandBuilder) Build() (Command, error)

Build validates the configuration options provided then builds the command

type PreflistItem

type PreflistItem struct {
	Partition int64
	Node      string
	Primary   bool
}

PreflistItem represents an individual result from the FetchPreflistResponse result set

type ReplMode

type ReplMode int32

ReplMode contains the replication mode

const (
	FALSE    ReplMode = 0
	REALTIME ReplMode = 1
	FULLSYNC ReplMode = 2
	TRUE     ReplMode = 3
)

Convenience constants for maintaining the replication mode

type ResetBucketCommand added in v1.4.0

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

PingCommand is used to verify Riak is online and reachable

func (*ResetBucketCommand) Error added in v1.4.0

func (cmd *ResetBucketCommand) Error() error

func (*ResetBucketCommand) Name added in v1.4.0

func (cmd *ResetBucketCommand) Name() string

Name identifies this command

func (*ResetBucketCommand) Success added in v1.4.0

func (cmd *ResetBucketCommand) Success() bool

type ResetBucketCommandBuilder added in v1.4.0

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

ResetBucketCommandBuilder is the command builder for ResetBucketCommand

func NewResetBucketCommandBuilder added in v1.4.0

func NewResetBucketCommandBuilder() *ResetBucketCommandBuilder

NewResetBucketCommandBuilder is a factory function for generating the command builder struct

func (*ResetBucketCommandBuilder) Build added in v1.4.0

func (builder *ResetBucketCommandBuilder) Build() (Command, error)

Build validates the configuration options provided then builds the command

func (*ResetBucketCommandBuilder) WithBucket added in v1.4.0

func (builder *ResetBucketCommandBuilder) WithBucket(bucket string) *ResetBucketCommandBuilder

WithBucket sets the bucket to be used by the command

func (*ResetBucketCommandBuilder) WithBucketType added in v1.4.0

func (builder *ResetBucketCommandBuilder) WithBucketType(bucketType string) *ResetBucketCommandBuilder

WithBucketType sets the bucket-type to be used by the command. If omitted, 'default' is used

type RiakError

type RiakError struct {
	Errcode uint32
	Errmsg  string
}

func (RiakError) Error

func (e RiakError) Error() (s string)

type Schema

type Schema struct {
	Name    string
	Content string
}

Schema object representing the solr schema that is returned from Riak

type SearchCommand

type SearchCommand struct {
	Response *SearchResponse
	// contains filtered or unexported fields
}

SearchCommand is used to search Riak for values using search indexes & schemas

func (*SearchCommand) Error added in v1.2.0

func (cmd *SearchCommand) Error() error

func (*SearchCommand) Name

func (cmd *SearchCommand) Name() string

Name identifies this command

func (*SearchCommand) Success added in v1.2.0

func (cmd *SearchCommand) Success() bool

type SearchCommandBuilder

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

SearchCommandBuilder type is required for creating new instances of SearchCommand

command := NewSearchCommandBuilder().
	WithIndexName("myIndexName").
	WithQuery("mySolrQuery").
	WithNumRows(100).
	Build()

func NewSearchCommandBuilder

func NewSearchCommandBuilder() *SearchCommandBuilder

NewSearchCommandBuilder is a factory function for generating the command builder struct

func (*SearchCommandBuilder) Build

func (builder *SearchCommandBuilder) Build() (Command, error)

Build validates the configuration options provided then builds the command

func (*SearchCommandBuilder) WithDefaultField

func (builder *SearchCommandBuilder) WithDefaultField(defaultField string) *SearchCommandBuilder

WithDefaultField sets the default field to be used by Riak the search query

See https://wiki.apache.org/solr/SolrQuerySyntax

func (*SearchCommandBuilder) WithDefaultOperation

func (builder *SearchCommandBuilder) WithDefaultOperation(op string) *SearchCommandBuilder

WithDefaultOperation sets the default operation to be used by Riak for the search query

See https://wiki.apache.org/solr/SolrQuerySyntax

func (*SearchCommandBuilder) WithFilterQuery

func (builder *SearchCommandBuilder) WithFilterQuery(filterQuery string) *SearchCommandBuilder

WithFilterQuery sets the solr filter query to be used, the main query runs first, the filter query reduces the scope of the result set even further

func (*SearchCommandBuilder) WithIndexName

func (builder *SearchCommandBuilder) WithIndexName(index string) *SearchCommandBuilder

WithIndexName sets the index to use for the command

func (*SearchCommandBuilder) WithNumRows

func (builder *SearchCommandBuilder) WithNumRows(numRows uint32) *SearchCommandBuilder

WithNumRows sets the number of documents to be returned by Riak

func (*SearchCommandBuilder) WithPresort

func (builder *SearchCommandBuilder) WithPresort(presort string) *SearchCommandBuilder

WithPresort allows you to configure Riak to presort the result set by Key or Score

func (*SearchCommandBuilder) WithQuery

func (builder *SearchCommandBuilder) WithQuery(query string) *SearchCommandBuilder

WithQuery sets the solr query to be executed on Riak

func (*SearchCommandBuilder) WithReturnFields

func (builder *SearchCommandBuilder) WithReturnFields(fields ...string) *SearchCommandBuilder

WithReturnFields sets the fields to be returned within each document

func (*SearchCommandBuilder) WithSortField

func (builder *SearchCommandBuilder) WithSortField(sortField string) *SearchCommandBuilder

WithSortField defines which field should be used for sorting the result set

func (*SearchCommandBuilder) WithStart

func (builder *SearchCommandBuilder) WithStart(start uint32) *SearchCommandBuilder

WithStart sets the document to start the result set with

type SearchDoc

type SearchDoc struct {
	BucketType string
	Bucket     string
	Key        string
	Id         string
	Score      string
	Fields     map[string][]string
}

SearchDoc object representing solr document returned from Riak

type SearchIndex

type SearchIndex struct {
	Name   string
	Schema string
	NVal   uint32
}

SearchIndex object representing the solr index that is returned from Riak

type SearchResponse

type SearchResponse struct {
	Docs     []*SearchDoc
	MaxScore float32
	NumFound uint32
}

SearchResponse contains the response data for a SearchCommand

type SecondaryIndexQueryCommand

type SecondaryIndexQueryCommand struct {
	Response *SecondaryIndexQueryResponse
	// contains filtered or unexported fields
}

SecondaryIndexQueryCommand is used to query for keys from Riak KV using secondary indexes

func (*SecondaryIndexQueryCommand) Error added in v1.2.0

func (cmd *SecondaryIndexQueryCommand) Error() error

func (*SecondaryIndexQueryCommand) Name

func (cmd *SecondaryIndexQueryCommand) Name() string

Name identifies this command

func (*SecondaryIndexQueryCommand) Success added in v1.2.0

func (cmd *SecondaryIndexQueryCommand) Success() bool

type SecondaryIndexQueryCommandBuilder

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

SecondaryIndexQueryCommandBuilder type is required for creating new instances of SecondaryIndexQueryCommand

command := NewSecondaryIndexQueryCommandBuilder().
	WithBucketType("myBucketType").
	WithBucket("myBucket").
	WithIndexName("myIndexName").
	WithIndexKey("myIndexKey").
	WithIntIndexKey(1234).
	Build()

func NewSecondaryIndexQueryCommandBuilder

func NewSecondaryIndexQueryCommandBuilder() *SecondaryIndexQueryCommandBuilder

NewSecondaryIndexQueryCommandBuilder is a factory function for generating the command builder struct

func (*SecondaryIndexQueryCommandBuilder) Build

func (builder *SecondaryIndexQueryCommandBuilder) Build() (Command, error)

Build validates the configuration options provided then builds the command

func (*SecondaryIndexQueryCommandBuilder) WithBucket

WithBucket sets the bucket to be used by the command

func (*SecondaryIndexQueryCommandBuilder) WithBucketType

func (builder *SecondaryIndexQueryCommandBuilder) WithBucketType(bucketType string) *SecondaryIndexQueryCommandBuilder

WithBucketType sets the bucket-type to be used by the command. If omitted, 'default' is used

func (*SecondaryIndexQueryCommandBuilder) WithCallback

WithCallback sets the callback to be used when handling a streaming response

Requires WithStreaming(true)

func (*SecondaryIndexQueryCommandBuilder) WithContinuation

WithContinuation sets the position at which the result set should continue from, value can be found within the result set of the previous page for the same query

func (*SecondaryIndexQueryCommandBuilder) WithIndexKey

WithIndexKey defines the index to search against

func (*SecondaryIndexQueryCommandBuilder) WithIndexName

WithIndexName sets the index to use for the command

func (*SecondaryIndexQueryCommandBuilder) WithIntIndexKey added in v1.6.0

WithIntIndexKey defines the integer index to search against

func (*SecondaryIndexQueryCommandBuilder) WithIntRange

WithIntRange sets the range of integer type index values to return, useful when you want 1,3,5,11 and not 1,11,3,5

func (*SecondaryIndexQueryCommandBuilder) WithMaxResults

func (builder *SecondaryIndexQueryCommandBuilder) WithMaxResults(maxResults uint32) *SecondaryIndexQueryCommandBuilder

WithMaxResults sets the maximum number of values to return in the result set

func (*SecondaryIndexQueryCommandBuilder) WithPaginationSort

func (builder *SecondaryIndexQueryCommandBuilder) WithPaginationSort(paginationSort bool) *SecondaryIndexQueryCommandBuilder

WithPaginationSort set to true, the results of a non-paginated query will return sorted from Riak

func (*SecondaryIndexQueryCommandBuilder) WithRange

WithRange sets the range of index values to return

func (*SecondaryIndexQueryCommandBuilder) WithReturnKeyAndIndex

func (builder *SecondaryIndexQueryCommandBuilder) WithReturnKeyAndIndex(val bool) *SecondaryIndexQueryCommandBuilder

WithReturnKeyAndIndex set to true, the result set will include both index keys and object keys

func (*SecondaryIndexQueryCommandBuilder) WithStreaming

WithStreaming sets the command to provide a streamed response

If true, a callback must be provided via WithCallback()

func (*SecondaryIndexQueryCommandBuilder) WithTermRegex

WithTermRegex sets the regex pattern to filter the result set by

func (*SecondaryIndexQueryCommandBuilder) WithTimeout

WithTimeout sets a timeout to be used for this command operation

type SecondaryIndexQueryResponse

type SecondaryIndexQueryResponse struct {
	Results      []*SecondaryIndexQueryResult
	Continuation []byte
}

SecondaryIndexQueryResponse contains the response data for a SecondaryIndexQueryCommand

type SecondaryIndexQueryResult

type SecondaryIndexQueryResult struct {
	IndexKey  []byte
	ObjectKey []byte
}

SecondaryIndexQueryResult represents an individual result of the SecondaryIndexQueryResponse result set

type StoreBucketPropsCommand

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

StoreBucketPropsCommand is used to store changes to a buckets properties

func (*StoreBucketPropsCommand) Error added in v1.2.0

func (cmd *StoreBucketPropsCommand) Error() error

func (*StoreBucketPropsCommand) Name

func (cmd *StoreBucketPropsCommand) Name() string

Name identifies this command

func (*StoreBucketPropsCommand) Success added in v1.2.0

func (cmd *StoreBucketPropsCommand) Success() bool

type StoreBucketPropsCommandBuilder

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

StoreBucketPropsCommandBuilder type is required for creating new instances of StoreBucketPropsCommand

command := NewStoreBucketPropsCommandBuilder().
	WithBucketType("myBucketType").
	WithBucket("myBucket").
	WithAllowMult(true).
	Build()

func NewStoreBucketPropsCommandBuilder

func NewStoreBucketPropsCommandBuilder() *StoreBucketPropsCommandBuilder

NewStoreBucketPropsCommandBuilder is a factory function for generating the command builder struct

func (*StoreBucketPropsCommandBuilder) AddPostCommit

func (builder *StoreBucketPropsCommandBuilder) AddPostCommit(commitHook *CommitHook) *StoreBucketPropsCommandBuilder

AddPostCommit allows you to attach a postcommit hook to the bucket

See http://docs.basho.com/riak/latest/dev/using/commit-hooks/

func (*StoreBucketPropsCommandBuilder) AddPreCommit

func (builder *StoreBucketPropsCommandBuilder) AddPreCommit(commitHook *CommitHook) *StoreBucketPropsCommandBuilder

AddPreCommit allows you to attach a precommit hook to the bucket

See http://docs.basho.com/riak/latest/dev/using/commit-hooks/

func (*StoreBucketPropsCommandBuilder) Build

func (builder *StoreBucketPropsCommandBuilder) Build() (Command, error)

Build validates the configuration options provided then builds the command

func (*StoreBucketPropsCommandBuilder) WithAllowMult

func (builder *StoreBucketPropsCommandBuilder) WithAllowMult(allowMult bool) *StoreBucketPropsCommandBuilder

WithAllowMult sets whether or not to allow Riak to store siblings of an object when writes conflict

func (*StoreBucketPropsCommandBuilder) WithBackend

WithBackend sets the backend to be used for this bucket

func (*StoreBucketPropsCommandBuilder) WithBasicQuorum

func (builder *StoreBucketPropsCommandBuilder) WithBasicQuorum(basicQuorum bool) *StoreBucketPropsCommandBuilder

WithBasicQuorum sets basic_quorum, whether to return early in some failure cases (eg. when r=1 and you get 2 errors and a success basic_quorum=true would return an error)

See http://basho.com/posts/technical/riaks-config-behaviors-part-3/

func (*StoreBucketPropsCommandBuilder) WithBigVClock

func (builder *StoreBucketPropsCommandBuilder) WithBigVClock(bigVClock uint32) *StoreBucketPropsCommandBuilder

WithBigVClock sets the big_vclock value representing an epoch time value

func (*StoreBucketPropsCommandBuilder) WithBucket

WithBucket sets the bucket to be used by the command

func (*StoreBucketPropsCommandBuilder) WithBucketType

func (builder *StoreBucketPropsCommandBuilder) WithBucketType(bucketType string) *StoreBucketPropsCommandBuilder

WithBucketType sets the bucket-type to be used by the command. If omitted, 'default' is used

func (*StoreBucketPropsCommandBuilder) WithChashKeyFun

WithChashKeyFun sets the chash_keyfun property on the bucket which allows custom hashing functions Please note, this is an advanced feature, only use with caution

func (*StoreBucketPropsCommandBuilder) WithDw

WithDw (durable writes) sets the number of nodes that must report back a successful write to backend storage in order for the command operation to be considered a success by Riak. If omitted, the bucket default is used.

See http://basho.com/posts/technical/riaks-config-behaviors-part-2/

func (*StoreBucketPropsCommandBuilder) WithLastWriteWins

func (builder *StoreBucketPropsCommandBuilder) WithLastWriteWins(lww bool) *StoreBucketPropsCommandBuilder

WithLastWriteWins sets whether Riak should resolve conflicts using timestamp (most recent wins)

func (*StoreBucketPropsCommandBuilder) WithNVal

WithNVal sets the number of times this command operation is replicated in the Cluster. If omitted, the ring default is used.

See http://basho.com/posts/technical/riaks-config-behaviors-part-2/

func (*StoreBucketPropsCommandBuilder) WithNotFoundOk

func (builder *StoreBucketPropsCommandBuilder) WithNotFoundOk(notFoundOk bool) *StoreBucketPropsCommandBuilder

WithNotFoundOk sets notfound_ok, whether to treat notfounds as successful reads for the purposes of R

See http://basho.com/posts/technical/riaks-config-behaviors-part-3/

func (*StoreBucketPropsCommandBuilder) WithOldVClock

func (builder *StoreBucketPropsCommandBuilder) WithOldVClock(oldVClock uint32) *StoreBucketPropsCommandBuilder

WithOldVClock sets the old_vclock value representing an epoch time value

func (*StoreBucketPropsCommandBuilder) WithPr

WithPr sets the number of primary nodes (N) that must be read from in order for the command operation to be considered a success by Riak.

See http://basho.com/posts/technical/riaks-config-behaviors-part-2/

func (*StoreBucketPropsCommandBuilder) WithPw

WithPw sets the number of primary nodes (N) that must report back a successful write in order for the command operation to be considered a success by Riak.

See http://basho.com/posts/technical/riaks-config-behaviors-part-2/

func (*StoreBucketPropsCommandBuilder) WithR

WithR sets the number of nodes that must report back a successful read in order for the command operation to be considered a success by Riak.

See http://basho.com/posts/technical/riaks-config-behaviors-part-2/

func (*StoreBucketPropsCommandBuilder) WithRw

WithRw (delete quorum) sets the number of nodes that must report back a successful delete to backend storage in order for the command operation to be considered a success by Riak. It represents the read and write operations that are completed internal to Riak to complete a delete.

See http://basho.com/posts/technical/riaks-config-behaviors-part-2/

func (*StoreBucketPropsCommandBuilder) WithSearch

WithSearch enables / disables search features for this bucket

func (*StoreBucketPropsCommandBuilder) WithSearchIndex

func (builder *StoreBucketPropsCommandBuilder) WithSearchIndex(searchIndex string) *StoreBucketPropsCommandBuilder

WithSearchIndex sets a searchIndex to be used on the bucket

func (*StoreBucketPropsCommandBuilder) WithSmallVClock

func (builder *StoreBucketPropsCommandBuilder) WithSmallVClock(smallVClock uint32) *StoreBucketPropsCommandBuilder

WithSmallVClock sets the old_vclock value representing an epoch time value

func (*StoreBucketPropsCommandBuilder) WithW

WithW sets the number of nodes that must report back a successful write in order for the command operation to be considered a success by Riak.

See http://basho.com/posts/technical/riaks-config-behaviors-part-2/

func (*StoreBucketPropsCommandBuilder) WithYoungVClock

func (builder *StoreBucketPropsCommandBuilder) WithYoungVClock(youngVClock uint32) *StoreBucketPropsCommandBuilder

WithYoungVClock sets the old_vclock value representing an epoch time value

type StoreBucketTypePropsCommand added in v1.5.0

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

StoreBucketTypePropsCommand is used to store changes to a bucket type's properties

func (*StoreBucketTypePropsCommand) Error added in v1.5.0

func (cmd *StoreBucketTypePropsCommand) Error() error

func (*StoreBucketTypePropsCommand) Name added in v1.5.0

func (cmd *StoreBucketTypePropsCommand) Name() string

Name identifies this command

func (*StoreBucketTypePropsCommand) Success added in v1.5.0

func (cmd *StoreBucketTypePropsCommand) Success() bool

type StoreBucketTypePropsCommandBuilder added in v1.5.0

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

StoreBucketTypePropsCommandBuilder type is required for creating new instances of StoreBucketTypePropsCommand

command := NewStoreBucketTypePropsCommandBuilder().
	WithBucketType("myBucketType").
	WithAllowMult(true).
	Build()

func NewStoreBucketTypePropsCommandBuilder added in v1.5.0

func NewStoreBucketTypePropsCommandBuilder() *StoreBucketTypePropsCommandBuilder

NewStoreBucketTypePropsCommandBuilder is a factory function for generating the command builder struct

func (*StoreBucketTypePropsCommandBuilder) AddPostCommit added in v1.5.0

AddPostCommit allows you to attach a postcommit hook to the bucket

See http://docs.basho.com/riak/latest/dev/using/commit-hooks/

func (*StoreBucketTypePropsCommandBuilder) AddPreCommit added in v1.5.0

AddPreCommit allows you to attach a precommit hook to the bucket

See http://docs.basho.com/riak/latest/dev/using/commit-hooks/

func (*StoreBucketTypePropsCommandBuilder) Build added in v1.5.0

func (builder *StoreBucketTypePropsCommandBuilder) Build() (Command, error)

Build validates the configuration options provided then builds the command

func (*StoreBucketTypePropsCommandBuilder) WithAllowMult added in v1.5.0

WithAllowMult sets whether or not to allow Riak to store siblings of an object when writes conflict

func (*StoreBucketTypePropsCommandBuilder) WithBackend added in v1.5.0

WithBackend sets the backend to be used for this bucket

func (*StoreBucketTypePropsCommandBuilder) WithBasicQuorum added in v1.5.0

func (builder *StoreBucketTypePropsCommandBuilder) WithBasicQuorum(basicQuorum bool) *StoreBucketTypePropsCommandBuilder

WithBasicQuorum sets basic_quorum, whether to return early in some failure cases (eg. when r=1 and you get 2 errors and a success basic_quorum=true would return an error)

See http://basho.com/posts/technical/riaks-config-behaviors-part-3/

func (*StoreBucketTypePropsCommandBuilder) WithBigVClock added in v1.5.0

WithBigVClock sets the big_vclock value representing an epoch time value

func (*StoreBucketTypePropsCommandBuilder) WithBucketType added in v1.5.0

WithBucketType sets the bucket-type to be used by the command. If omitted, 'default' is used

func (*StoreBucketTypePropsCommandBuilder) WithChashKeyFun added in v1.5.0

WithChashKeyFun sets the chash_keyfun property on the bucket which allows custom hashing functions Please note, this is an advanced feature, only use with caution

func (*StoreBucketTypePropsCommandBuilder) WithDw added in v1.5.0

WithDw (durable writes) sets the number of nodes that must report back a successful write to backend storage in order for the command operation to be considered a success by Riak. If omitted, the bucket default is used.

See http://basho.com/posts/technical/riaks-config-behaviors-part-2/

func (*StoreBucketTypePropsCommandBuilder) WithLastWriteWins added in v1.5.0

WithLastWriteWins sets whether Riak should resolve conflicts using timestamp (most recent wins)

func (*StoreBucketTypePropsCommandBuilder) WithNVal added in v1.5.0

WithNVal sets the number of times this command operation is replicated in the Cluster. If omitted, the ring default is used.

See http://basho.com/posts/technical/riaks-config-behaviors-part-2/

func (*StoreBucketTypePropsCommandBuilder) WithNotFoundOk added in v1.5.0

func (builder *StoreBucketTypePropsCommandBuilder) WithNotFoundOk(notFoundOk bool) *StoreBucketTypePropsCommandBuilder

WithNotFoundOk sets notfound_ok, whether to treat notfounds as successful reads for the purposes of R

See http://basho.com/posts/technical/riaks-config-behaviors-part-3/

func (*StoreBucketTypePropsCommandBuilder) WithOldVClock added in v1.5.0

WithOldVClock sets the old_vclock value representing an epoch time value

func (*StoreBucketTypePropsCommandBuilder) WithPr added in v1.5.0

WithPr sets the number of primary nodes (N) that must be read from in order for the command operation to be considered a success by Riak.

See http://basho.com/posts/technical/riaks-config-behaviors-part-2/

func (*StoreBucketTypePropsCommandBuilder) WithPw added in v1.5.0

WithPw sets the number of primary nodes (N) that must report back a successful write in order for the command operation to be considered a success by Riak.

See http://basho.com/posts/technical/riaks-config-behaviors-part-2/

func (*StoreBucketTypePropsCommandBuilder) WithR added in v1.5.0

WithR sets the number of nodes that must report back a successful read in order for the command operation to be considered a success by Riak.

See http://basho.com/posts/technical/riaks-config-behaviors-part-2/

func (*StoreBucketTypePropsCommandBuilder) WithRw added in v1.5.0

WithRw (delete quorum) sets the number of nodes that must report back a successful delete to backend storage in order for the command operation to be considered a success by Riak. It represents the read and write operations that are completed internal to Riak to complete a delete.

See http://basho.com/posts/technical/riaks-config-behaviors-part-2/

func (*StoreBucketTypePropsCommandBuilder) WithSearch added in v1.5.0

WithSearch enables / disables search features for this bucket

func (*StoreBucketTypePropsCommandBuilder) WithSearchIndex added in v1.5.0

func (builder *StoreBucketTypePropsCommandBuilder) WithSearchIndex(searchIndex string) *StoreBucketTypePropsCommandBuilder

WithSearchIndex sets a searchIndex to be used on the bucket

func (*StoreBucketTypePropsCommandBuilder) WithSmallVClock added in v1.5.0

func (builder *StoreBucketTypePropsCommandBuilder) WithSmallVClock(smallVClock uint32) *StoreBucketTypePropsCommandBuilder

WithSmallVClock sets the old_vclock value representing an epoch time value

func (*StoreBucketTypePropsCommandBuilder) WithW added in v1.5.0

WithW sets the number of nodes that must report back a successful write in order for the command operation to be considered a success by Riak.

See http://basho.com/posts/technical/riaks-config-behaviors-part-2/

func (*StoreBucketTypePropsCommandBuilder) WithYoungVClock added in v1.5.0

func (builder *StoreBucketTypePropsCommandBuilder) WithYoungVClock(youngVClock uint32) *StoreBucketTypePropsCommandBuilder

WithYoungVClock sets the old_vclock value representing an epoch time value

type StoreIndexCommand

type StoreIndexCommand struct {
	Response bool
	// contains filtered or unexported fields
}

StoreIndexCommand is sused to store a new search index on Riak

func (*StoreIndexCommand) Error added in v1.2.0

func (cmd *StoreIndexCommand) Error() error

func (*StoreIndexCommand) Name

func (cmd *StoreIndexCommand) Name() string

Name identifies this command

func (*StoreIndexCommand) Success added in v1.2.0

func (cmd *StoreIndexCommand) Success() bool

type StoreIndexCommandBuilder

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

StoreIndexCommandBuilder type is required for creating new instances of StoreIndexCommand

command := NewStoreIndexCommandBuilder().
	WithIndexName("myIndexName").
	WithSchemaName("mySchemaName").
	Build()

func NewStoreIndexCommandBuilder

func NewStoreIndexCommandBuilder() *StoreIndexCommandBuilder

NewStoreIndexCommandBuilder is a factory function for generating the command builder struct

func (*StoreIndexCommandBuilder) Build

func (builder *StoreIndexCommandBuilder) Build() (Command, error)

Build validates the configuration options provided then builds the command

func (*StoreIndexCommandBuilder) WithIndexName

func (builder *StoreIndexCommandBuilder) WithIndexName(indexName string) *StoreIndexCommandBuilder

WithIndexName sets the index to use for the command

func (*StoreIndexCommandBuilder) WithNVal

func (builder *StoreIndexCommandBuilder) WithNVal(nval uint32) *StoreIndexCommandBuilder

WithNVal sets the number of times this command operation is replicated in the Cluster. If ommitted, the ring default is used.

See http://basho.com/posts/technical/riaks-config-behaviors-part-2/

func (*StoreIndexCommandBuilder) WithSchemaName

func (builder *StoreIndexCommandBuilder) WithSchemaName(schemaName string) *StoreIndexCommandBuilder

WithSchemaName sets the schema that the command will use

func (*StoreIndexCommandBuilder) WithTimeout

func (builder *StoreIndexCommandBuilder) WithTimeout(timeout time.Duration) *StoreIndexCommandBuilder

WithTimeout sets a timeout in milliseconds to be used for this command operation

type StoreSchemaCommand

type StoreSchemaCommand struct {
	Response bool
	// contains filtered or unexported fields
}

StoreSchemaCommand is used to store / update a search schema in Riak

func (*StoreSchemaCommand) Error added in v1.2.0

func (cmd *StoreSchemaCommand) Error() error

func (*StoreSchemaCommand) Name

func (cmd *StoreSchemaCommand) Name() string

Name identifies this command

func (*StoreSchemaCommand) Success added in v1.2.0

func (cmd *StoreSchemaCommand) Success() bool

type StoreSchemaCommandBuilder

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

StoreSchemaCommandBuilder type is required for creating new instances of StoreSchemaCommand

command := NewStoreSchemaCommandBuilder().
	WithSchemaName("mySchemaName").
	WithSchema("mySchemaXML").
	Build()

func NewStoreSchemaCommandBuilder

func NewStoreSchemaCommandBuilder() *StoreSchemaCommandBuilder

NewStoreSchemaCommandBuilder is a factory function for generating the command builder struct

func (*StoreSchemaCommandBuilder) Build

func (builder *StoreSchemaCommandBuilder) Build() (Command, error)

Build validates the configuration options provided then builds the command

func (*StoreSchemaCommandBuilder) WithSchema

func (builder *StoreSchemaCommandBuilder) WithSchema(schema string) *StoreSchemaCommandBuilder

WithSchema sets the actual schema that solr will use for indexing and queries

func (*StoreSchemaCommandBuilder) WithSchemaName

func (builder *StoreSchemaCommandBuilder) WithSchemaName(schemaName string) *StoreSchemaCommandBuilder

WithSchemaName sets the name for the schema to be stored

type StoreValueCommand

type StoreValueCommand struct {
	Response *StoreValueResponse
	// contains filtered or unexported fields
}

StoreValueCommand used to store a value from Riak KV.

func (*StoreValueCommand) Error added in v1.2.0

func (cmd *StoreValueCommand) Error() error

func (*StoreValueCommand) Name

func (cmd *StoreValueCommand) Name() string

Name identifies this command

func (*StoreValueCommand) Success added in v1.2.0

func (cmd *StoreValueCommand) Success() bool

type StoreValueCommandBuilder

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

StoreValueCommandBuilder type is required for creating new instances of StoreValueCommand

command := NewStoreValueCommandBuilder().
	WithBucketType("myBucketType").
	WithBucket("myBucket").
	Build()

func NewStoreValueCommandBuilder

func NewStoreValueCommandBuilder() *StoreValueCommandBuilder

NewStoreValueCommandBuilder is a factory function for generating the command builder struct

func (*StoreValueCommandBuilder) Build

func (builder *StoreValueCommandBuilder) Build() (Command, error)

Build validates the configuration options provided then builds the command

func (*StoreValueCommandBuilder) WithAsis

func (builder *StoreValueCommandBuilder) WithAsis(asis bool) *StoreValueCommandBuilder

WithAsis sets the asis option Please note, this is an advanced feature, only use with caution

func (*StoreValueCommandBuilder) WithBucket

func (builder *StoreValueCommandBuilder) WithBucket(bucket string) *StoreValueCommandBuilder

WithBucket sets the bucket to be used by the command

func (*StoreValueCommandBuilder) WithBucketType

func (builder *StoreValueCommandBuilder) WithBucketType(bucketType string) *StoreValueCommandBuilder

WithBucketType sets the bucket-type to be used by the command. If omitted, 'default' is used

func (*StoreValueCommandBuilder) WithConflictResolver

func (builder *StoreValueCommandBuilder) WithConflictResolver(resolver ConflictResolver) *StoreValueCommandBuilder

WithConflictResolver sets the ConflictResolver that should be used when sibling conflicts are found for this operation

func (*StoreValueCommandBuilder) WithContent

func (builder *StoreValueCommandBuilder) WithContent(object *Object) *StoreValueCommandBuilder

WithContent sets the object / value to be stored at the specified key

func (*StoreValueCommandBuilder) WithDw

WithDw (durable writes) sets the number of nodes that must report back a successful write to backend storage in order for the command operation to be considered a success by Riak. If ommitted, the bucket default is used.

See http://basho.com/posts/technical/riaks-config-behaviors-part-2/

func (*StoreValueCommandBuilder) WithIfNoneMatch

func (builder *StoreValueCommandBuilder) WithIfNoneMatch(ifNoneMatch bool) *StoreValueCommandBuilder

WithIfNoneMatch tells Riak to store the object only if it does not already exist in the database

func (*StoreValueCommandBuilder) WithIfNotModified

func (builder *StoreValueCommandBuilder) WithIfNotModified(ifNotModified bool) *StoreValueCommandBuilder

WithIfNotModified tells Riak to only update the object in Riak if the vclock provided matches the one currently in Riak

func (*StoreValueCommandBuilder) WithKey

WithKey sets the key to be used by the command to read / write values

func (*StoreValueCommandBuilder) WithNVal

func (builder *StoreValueCommandBuilder) WithNVal(nval uint32) *StoreValueCommandBuilder

WithNVal sets the number of times this command operation is replicated in the Cluster. If ommitted, the ring default is used.

See http://basho.com/posts/technical/riaks-config-behaviors-part-2/

func (*StoreValueCommandBuilder) WithPw

WithPw sets the number of primary nodes (N) that must report back a successful write in order for the command operation to be considered a success by Riak. If ommitted, the bucket default is used.

See http://basho.com/posts/technical/riaks-config-behaviors-part-2/

func (*StoreValueCommandBuilder) WithReturnBody

func (builder *StoreValueCommandBuilder) WithReturnBody(returnBody bool) *StoreValueCommandBuilder

WithReturnBody sets Riak to return the value within its response after completing the write operation

func (*StoreValueCommandBuilder) WithReturnHead

func (builder *StoreValueCommandBuilder) WithReturnHead(returnHead bool) *StoreValueCommandBuilder

WithReturnHead returns only the meta data for the value, useful when objects contain large amounts of data

func (*StoreValueCommandBuilder) WithSloppyQuorum

func (builder *StoreValueCommandBuilder) WithSloppyQuorum(sloppyQuorum bool) *StoreValueCommandBuilder

WithSloppyQuorum sets the sloppy_quorum for this Command Please note, this is an advanced feature, only use with caution

See http://docs.basho.com/riak/latest/theory/concepts/Eventual-Consistency/

func (*StoreValueCommandBuilder) WithTimeout

func (builder *StoreValueCommandBuilder) WithTimeout(timeout time.Duration) *StoreValueCommandBuilder

WithTimeout sets a timeout to be used for this command operation

func (*StoreValueCommandBuilder) WithVClock

func (builder *StoreValueCommandBuilder) WithVClock(vclock []byte) *StoreValueCommandBuilder

WithVClock sets the vclock for the object to be stored, providing causal context for conflicts

func (*StoreValueCommandBuilder) WithW

WithW sets the number of nodes that must report back a successful write in order for then command operation to be considered a success by Riak

See http://basho.com/posts/technical/riaks-config-behaviors-part-2/

type StoreValueResponse

type StoreValueResponse struct {
	GeneratedKey string
	VClock       []byte
	Values       []*Object
}

StoreValueResponse contains the response data for a StoreValueCommand

type TsCell added in v1.7.0

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

TsCell represents a cell value within a time series row

func NewBooleanTsCell added in v1.7.0

func NewBooleanTsCell(v bool) TsCell

NewBooleanTsCell creates a TsCell from a boolean

func NewDoubleTsCell added in v1.7.0

func NewDoubleTsCell(v float64) TsCell

NewDoubleTsCell creates a TsCell from an floating point number

func NewSint64TsCell added in v1.7.0

func NewSint64TsCell(v int64) TsCell

NewSint64TsCell creates a TsCell from an integer

func NewStringTsCell added in v1.7.0

func NewStringTsCell(v string) TsCell

NewStringTsCell creates a TsCell from a string

func NewTimestampTsCell added in v1.7.0

func NewTimestampTsCell(t time.Time) TsCell

NewTimestampTsCell creates a TsCell from a time.Time struct

func NewTimestampTsCellFromInt64 added in v1.7.0

func NewTimestampTsCellFromInt64(v int64) TsCell

NewTimestampTsCellFromInt64 creates a TsCell from an int64 value that represents *milliseconds* since UTC epoch

func (*TsCell) GetBooleanValue added in v1.7.0

func (c *TsCell) GetBooleanValue() bool

GetBooleanValue returns the boolean value stored within the cell

func (*TsCell) GetDataType added in v1.7.0

func (c *TsCell) GetDataType() string

GetDataType returns the data type of the value stored within the cell

func (*TsCell) GetDoubleValue added in v1.7.0

func (c *TsCell) GetDoubleValue() float64

GetDoubleValue returns the double value stored within the cell

func (*TsCell) GetSint64Value added in v1.7.0

func (c *TsCell) GetSint64Value() int64

GetSint64Value returns the sint64 value stored within the cell

func (*TsCell) GetStringValue added in v1.7.0

func (c *TsCell) GetStringValue() string

GetStringValue returns the string value stored within the cell

func (*TsCell) GetTimeValue added in v1.7.0

func (c *TsCell) GetTimeValue() time.Time

GetTimeValue returns the timestamp value stored within the cell as a time.Time

func (*TsCell) GetTimestampValue added in v1.7.0

func (c *TsCell) GetTimestampValue() int64

GetTimestampValue returns the timestamp value stored within the cell

type TsColumnDescription added in v1.7.0

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

TsColumnDescription describes a Time Series column

func (*TsColumnDescription) GetName added in v1.7.0

func (c *TsColumnDescription) GetName() string

GetName returns the name for the column

func (*TsColumnDescription) GetType added in v1.7.0

func (c *TsColumnDescription) GetType() string

GetType returns the data type for the column

type TsDeleteRowCommand added in v1.7.0

type TsDeleteRowCommand struct {
	Response bool
	// contains filtered or unexported fields
}

TsDeleteRowCommand is used to delete a value from Riak TS

func (*TsDeleteRowCommand) Error added in v1.7.0

func (cmd *TsDeleteRowCommand) Error() error

func (*TsDeleteRowCommand) Name added in v1.7.0

func (cmd *TsDeleteRowCommand) Name() string

Name identifies this command

func (*TsDeleteRowCommand) Success added in v1.7.0

func (cmd *TsDeleteRowCommand) Success() bool

type TsDeleteRowCommandBuilder added in v1.7.0

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

TsDeleteRowCommandBuilder type is required for creating new instances of TsDeleteRowCommand

cmd, err := NewTsDeleteRowCommandBuilder().
	WithTable("myTable").
	WithKey(key).
	Build()

func NewTsDeleteRowCommandBuilder added in v1.7.0

func NewTsDeleteRowCommandBuilder() *TsDeleteRowCommandBuilder

NewTsDeleteRowCommandBuilder is a factory function for generating the command builder struct

func (*TsDeleteRowCommandBuilder) Build added in v1.7.0

func (builder *TsDeleteRowCommandBuilder) Build() (Command, error)

Build validates the configuration options provided then builds the command

func (*TsDeleteRowCommandBuilder) WithKey added in v1.7.0

WithKey sets the key to be used by the command to read / write values

func (*TsDeleteRowCommandBuilder) WithTable added in v1.7.0

func (builder *TsDeleteRowCommandBuilder) WithTable(table string) *TsDeleteRowCommandBuilder

WithTable sets the table to be used by the command

func (*TsDeleteRowCommandBuilder) WithTimeout added in v1.7.0

func (builder *TsDeleteRowCommandBuilder) WithTimeout(timeout time.Duration) *TsDeleteRowCommandBuilder

WithTimeout sets a timeout in milliseconds to be used for this command operation

type TsFetchRowCommand added in v1.7.0

type TsFetchRowCommand struct {
	Response *TsFetchRowResponse
	// contains filtered or unexported fields
}

TsFetchRowCommand is used to fetch / get a value from Riak KV

func (*TsFetchRowCommand) Error added in v1.7.0

func (cmd *TsFetchRowCommand) Error() error

func (*TsFetchRowCommand) Name added in v1.7.0

func (cmd *TsFetchRowCommand) Name() string

Name identifies this command

func (*TsFetchRowCommand) Success added in v1.7.0

func (cmd *TsFetchRowCommand) Success() bool

type TsFetchRowCommandBuilder added in v1.7.0

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

TsFetchRowCommandBuilder type is required for creating new instances of TsFetchRowCommand

key := make([]riak.TsCell, 3)
key[0] = NewStringTsCell("South Atlantic")
key[1] = NewStringTsCell("South Carolina")
key[2] = NewTimestampTsCell(1420113600)

cmd, err := NewTsFetchRowCommandBuilder().
	WithBucketType("myBucketType").
	WithTable("myTable").
	WithKey(key).
	Build()

func NewTsFetchRowCommandBuilder added in v1.7.0

func NewTsFetchRowCommandBuilder() *TsFetchRowCommandBuilder

NewTsFetchRowCommandBuilder is a factory function for generating the command builder struct

func (*TsFetchRowCommandBuilder) Build added in v1.7.0

func (builder *TsFetchRowCommandBuilder) Build() (Command, error)

Build validates the configuration options provided then builds the command

func (*TsFetchRowCommandBuilder) WithKey added in v1.7.0

func (builder *TsFetchRowCommandBuilder) WithKey(key []TsCell) *TsFetchRowCommandBuilder

WithKey sets the key to be used by the command to read / write values

func (*TsFetchRowCommandBuilder) WithTable added in v1.7.0

func (builder *TsFetchRowCommandBuilder) WithTable(table string) *TsFetchRowCommandBuilder

WithTable sets the table to be used by the command

func (*TsFetchRowCommandBuilder) WithTimeout added in v1.7.0

func (builder *TsFetchRowCommandBuilder) WithTimeout(timeout time.Duration) *TsFetchRowCommandBuilder

WithTimeout sets a timeout in milliseconds to be used for this command operation

type TsFetchRowResponse added in v1.7.0

type TsFetchRowResponse struct {
	IsNotFound bool
	Columns    []TsColumnDescription
	Row        []TsCell
}

TsFetchRowResponse contains the response data for a TsFetchRowCommand

type TsListKeysCommand added in v1.7.0

type TsListKeysCommand struct {
	Response *TsListKeysResponse
	// contains filtered or unexported fields
}

TsListKeysCommand is used to fetch values from a table in Riak TS

func (*TsListKeysCommand) Error added in v1.7.0

func (cmd *TsListKeysCommand) Error() error

func (*TsListKeysCommand) Name added in v1.7.0

func (cmd *TsListKeysCommand) Name() string

Name identifies this command

func (*TsListKeysCommand) Success added in v1.7.0

func (cmd *TsListKeysCommand) Success() bool

type TsListKeysCommandBuilder added in v1.7.0

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

TsListKeysCommandBuilder type is required for creating new instances of TsListKeysCommand

cmd, err := NewTsListKeysCommandBuilder().
	WithTable("myTable").
	WithStreaming(true).
	WithCallback(cb).
	Build()

func NewTsListKeysCommandBuilder added in v1.7.0

func NewTsListKeysCommandBuilder() *TsListKeysCommandBuilder

NewTsListKeysCommandBuilder is a factory function for generating the command builder struct

func (*TsListKeysCommandBuilder) Build added in v1.7.0

func (builder *TsListKeysCommandBuilder) Build() (Command, error)

Build validates the configuration options provided then builds the command

func (*TsListKeysCommandBuilder) WithCallback added in v1.7.0

func (builder *TsListKeysCommandBuilder) WithCallback(callback func([][]TsCell) error) *TsListKeysCommandBuilder

WithCallback sets the callback to be used when handling a streaming response

Requires WithStreaming(true)

func (*TsListKeysCommandBuilder) WithStreaming added in v1.7.0

func (builder *TsListKeysCommandBuilder) WithStreaming(streaming bool) *TsListKeysCommandBuilder

WithStreaming sets the command to provide a streamed response

If true, a callback must be provided via WithCallback()

func (*TsListKeysCommandBuilder) WithTable added in v1.7.0

func (builder *TsListKeysCommandBuilder) WithTable(table string) *TsListKeysCommandBuilder

WithTable sets the table to be used by the command

func (*TsListKeysCommandBuilder) WithTimeout added in v1.7.0

func (builder *TsListKeysCommandBuilder) WithTimeout(timeout time.Duration) *TsListKeysCommandBuilder

WithTimeout sets a timeout in milliseconds to be used for this command operation

type TsListKeysResponse added in v1.7.0

type TsListKeysResponse struct {
	Keys [][]TsCell
}

TsListKeysResponse contains the response data for a TsListKeysCommand

type TsQueryCommand added in v1.7.0

type TsQueryCommand struct {
	Response *TsQueryResponse
	// contains filtered or unexported fields
}

TsQueryCommand is used to fetch / get a value from Riak TS

func (*TsQueryCommand) Error added in v1.7.0

func (cmd *TsQueryCommand) Error() error

func (*TsQueryCommand) Name added in v1.7.0

func (cmd *TsQueryCommand) Name() string

Name identifies this command

func (*TsQueryCommand) Success added in v1.7.0

func (cmd *TsQueryCommand) Success() bool

type TsQueryCommandBuilder added in v1.7.0

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

TsQueryCommandBuilder type is required for creating new instances of TsQueryCommand

cmd, err := NewTsQueryCommandBuilder().
	WithQuery("select * from GeoCheckin where time > 1234560 and time < 1234569 and region = 'South Atlantic'").
	WithStreaming(true).
	WithCallback(cb).
	Build()

func NewTsQueryCommandBuilder added in v1.7.0

func NewTsQueryCommandBuilder() *TsQueryCommandBuilder

NewTsQueryCommandBuilder is a factory function for generating the command builder struct

func (*TsQueryCommandBuilder) Build added in v1.7.0

func (builder *TsQueryCommandBuilder) Build() (Command, error)

Build validates the configuration options provided then builds the command

func (*TsQueryCommandBuilder) WithCallback added in v1.7.0

func (builder *TsQueryCommandBuilder) WithCallback(callback func([][]TsCell) error) *TsQueryCommandBuilder

WithCallback sets the callback to be used when handling a streaming response

Requires WithStreaming(true)

func (*TsQueryCommandBuilder) WithQuery added in v1.7.0

func (builder *TsQueryCommandBuilder) WithQuery(query string) *TsQueryCommandBuilder

WithQuery sets the query to be used by the command

func (*TsQueryCommandBuilder) WithStreaming added in v1.7.0

func (builder *TsQueryCommandBuilder) WithStreaming(streaming bool) *TsQueryCommandBuilder

WithStreaming sets the command to provide a streamed response

If true, a callback must be provided via WithCallback()

type TsQueryResponse added in v1.7.0

type TsQueryResponse struct {
	Columns []TsColumnDescription
	Rows    [][]TsCell
}

TsQueryResponse contains the response data for a TsQueryCommand

type TsStoreRowsCommand added in v1.7.0

type TsStoreRowsCommand struct {
	Response bool
	// contains filtered or unexported fields
}

TsStoreRowsCommand is sused to store a new row/s in Riak TS

func (*TsStoreRowsCommand) Error added in v1.7.0

func (cmd *TsStoreRowsCommand) Error() error

func (*TsStoreRowsCommand) Name added in v1.7.0

func (cmd *TsStoreRowsCommand) Name() string

Name identifies this command

func (*TsStoreRowsCommand) Success added in v1.7.0

func (cmd *TsStoreRowsCommand) Success() bool

type TsStoreRowsCommandBuilder added in v1.7.0

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

TsStoreRowsCommandBuilder type is required for creating new instances of StoreIndexCommand

cmd, err := NewTsStoreRowsCommandBuilder().
	WithTable("myTableName").
	WithRows(rows).
	Build()

func NewTsStoreRowsCommandBuilder added in v1.7.0

func NewTsStoreRowsCommandBuilder() *TsStoreRowsCommandBuilder

NewTsStoreRowsCommandBuilder is a factory function for generating the command builder struct

func (*TsStoreRowsCommandBuilder) Build added in v1.7.0

func (builder *TsStoreRowsCommandBuilder) Build() (Command, error)

Build validates the configuration options provided then builds the command

func (*TsStoreRowsCommandBuilder) WithRows added in v1.7.0

func (builder *TsStoreRowsCommandBuilder) WithRows(rows [][]TsCell) *TsStoreRowsCommandBuilder

WithRows sets the rows to be stored by the command

func (*TsStoreRowsCommandBuilder) WithTable added in v1.7.0

func (builder *TsStoreRowsCommandBuilder) WithTable(table string) *TsStoreRowsCommandBuilder

WithTable sets the table to use for the command

type UpdateCounterCommand

type UpdateCounterCommand struct {
	Response *UpdateCounterResponse
	// contains filtered or unexported fields
}

UpdateCounterCommand is used to increment or decrement a counter data type in Riak KV

func (*UpdateCounterCommand) Error added in v1.2.0

func (cmd *UpdateCounterCommand) Error() error

func (*UpdateCounterCommand) Name

func (cmd *UpdateCounterCommand) Name() string

Name identifies this command

func (*UpdateCounterCommand) Success added in v1.2.0

func (cmd *UpdateCounterCommand) Success() bool

type UpdateCounterCommandBuilder

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

UpdateCounterCommandBuilder type is required for creating new instances of UpdateCounterCommand

command := NewUpdateCounterCommandBuilder().
	WithBucketType("myBucketType").
	WithBucket("myBucket").
	WithKey("myKey").
	WithIncrement(1).
	Build()

func NewUpdateCounterCommandBuilder

func NewUpdateCounterCommandBuilder() *UpdateCounterCommandBuilder

NewUpdateCounterCommandBuilder is a factory function for generating the command builder struct

func (*UpdateCounterCommandBuilder) Build

func (builder *UpdateCounterCommandBuilder) Build() (Command, error)

Build validates the configuration options provided then builds the command

func (*UpdateCounterCommandBuilder) WithBucket

func (builder *UpdateCounterCommandBuilder) WithBucket(bucket string) *UpdateCounterCommandBuilder

WithBucket sets the bucket to be used by the command

func (*UpdateCounterCommandBuilder) WithBucketType

func (builder *UpdateCounterCommandBuilder) WithBucketType(bucketType string) *UpdateCounterCommandBuilder

WithBucketType sets the bucket-type to be used by the command. If omitted, 'default' is used

func (*UpdateCounterCommandBuilder) WithDw

WithDw (durable writes) sets the number of nodes that must report back a successful write to backend storage in order for the command operation to be considered a success by Riak

See http://basho.com/posts/technical/riaks-config-behaviors-part-2/

func (*UpdateCounterCommandBuilder) WithIncrement

func (builder *UpdateCounterCommandBuilder) WithIncrement(increment int64) *UpdateCounterCommandBuilder

WithIncrement defines the increment the Counter value is to be increased / decreased by

func (*UpdateCounterCommandBuilder) WithKey

WithKey sets the key to be used by the command to read / write values

func (*UpdateCounterCommandBuilder) WithPw

WithPw sets the number of primary nodes (N) that must report back a successful write in order for the command operation to be considered a success by Riak. If ommitted, the bucket default is used.

See http://basho.com/posts/technical/riaks-config-behaviors-part-2/

func (*UpdateCounterCommandBuilder) WithReturnBody

func (builder *UpdateCounterCommandBuilder) WithReturnBody(returnBody bool) *UpdateCounterCommandBuilder

WithReturnBody sets Riak to return the value within its response after completing the write operation

func (*UpdateCounterCommandBuilder) WithTimeout

WithTimeout sets a timeout to be used for this command operation

func (*UpdateCounterCommandBuilder) WithW

WithW sets the number of nodes that must report back a successful write in order for then command operation to be considered a success by Riak. If ommitted, the bucket default is used.

See http://basho.com/posts/technical/riaks-config-behaviors-part-2/

type UpdateCounterResponse

type UpdateCounterResponse struct {
	GeneratedKey string
	CounterValue int64
}

UpdateCounterResponse is the object containing the response

type UpdateMapCommand

type UpdateMapCommand struct {
	Response *UpdateMapResponse
	// contains filtered or unexported fields
}

UpdateMapCommand updates a map CRDT in Riak

func (*UpdateMapCommand) Error added in v1.2.0

func (cmd *UpdateMapCommand) Error() error

func (*UpdateMapCommand) Name

func (cmd *UpdateMapCommand) Name() string

Name identifies this command

func (*UpdateMapCommand) Success added in v1.2.0

func (cmd *UpdateMapCommand) Success() bool

type UpdateMapCommandBuilder

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

UpdateMapCommandBuilder type is required for creating new instances of UpdateMapCommand

mapOp := &MapOperation{}
mapOp.SetRegister("register_1", []byte("register_value_1"))

command := NewUpdateMapCommandBuilder().
	WithBucketType("myBucketType").
	WithBucket("myBucket").
	WithKey("myKey").
	WithMapOperation(mapOp).
	Build()

func NewUpdateMapCommandBuilder

func NewUpdateMapCommandBuilder() *UpdateMapCommandBuilder

NewUpdateMapCommandBuilder is a factory function for generating the command builder struct

func (*UpdateMapCommandBuilder) Build

func (builder *UpdateMapCommandBuilder) Build() (Command, error)

Build validates the configuration options provided then builds the command

func (*UpdateMapCommandBuilder) WithBucket

func (builder *UpdateMapCommandBuilder) WithBucket(bucket string) *UpdateMapCommandBuilder

WithBucket sets the bucket to be used by the command

func (*UpdateMapCommandBuilder) WithBucketType

func (builder *UpdateMapCommandBuilder) WithBucketType(bucketType string) *UpdateMapCommandBuilder

WithBucketType sets the bucket-type to be used by the command. If omitted, 'default' is used

func (*UpdateMapCommandBuilder) WithContext

func (builder *UpdateMapCommandBuilder) WithContext(context []byte) *UpdateMapCommandBuilder

WithContext sets the causal context needed to identify the state of the map when removing elements

func (*UpdateMapCommandBuilder) WithDw

WithDw (durable writes) sets the number of nodes that must report back a successful write to backend storage in order for the command operation to be considered a success by Riak. If ommitted, the bucket default is used.

See http://basho.com/posts/technical/riaks-config-behaviors-part-2/

func (*UpdateMapCommandBuilder) WithKey

WithKey sets the key to be used by the command to read / write values

func (*UpdateMapCommandBuilder) WithMapOperation

func (builder *UpdateMapCommandBuilder) WithMapOperation(mapOperation *MapOperation) *UpdateMapCommandBuilder

WithMapOperation provides the details of what is supposed to be updated on the map

func (*UpdateMapCommandBuilder) WithPw

WithPw sets the number of primary nodes (N) that must report back a successful write in order for the command operation to be considered a success by Riak. If ommitted, the bucket default is used.

See http://basho.com/posts/technical/riaks-config-behaviors-part-2/

func (*UpdateMapCommandBuilder) WithReturnBody

func (builder *UpdateMapCommandBuilder) WithReturnBody(returnBody bool) *UpdateMapCommandBuilder

WithReturnBody sets Riak to return the value within its response after completing the write operation

func (*UpdateMapCommandBuilder) WithTimeout

func (builder *UpdateMapCommandBuilder) WithTimeout(timeout time.Duration) *UpdateMapCommandBuilder

WithTimeout sets a timeout in milliseconds to be used for this command operation

func (*UpdateMapCommandBuilder) WithW

WithW sets the number of nodes that must report back a successful write in order for then command operation to be considered a success by Riak. If ommitted, the bucket default is used.

See http://basho.com/posts/technical/riaks-config-behaviors-part-2/

type UpdateMapResponse

type UpdateMapResponse struct {
	GeneratedKey string
	Context      []byte
	Map          *Map
}

UpdateMapResponse contains the response data for a UpdateMapCommand

type UpdateSetCommand

type UpdateSetCommand struct {
	Response *UpdateSetResponse
	// contains filtered or unexported fields
}

UpdateSetCommand stores or updates a set CRDT in Riak

func (*UpdateSetCommand) Error added in v1.2.0

func (cmd *UpdateSetCommand) Error() error

func (*UpdateSetCommand) Name

func (cmd *UpdateSetCommand) Name() string

Name identifies this command

func (*UpdateSetCommand) Success added in v1.2.0

func (cmd *UpdateSetCommand) Success() bool

type UpdateSetCommandBuilder

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

UpdateSetCommandBuilder type is required for creating new instances of UpdateSetCommand

adds := [][]byte{
	[]byte("a1"),
	[]byte("a2"),
	[]byte("a3"),
	[]byte("a4"),
}

command := NewUpdateSetCommandBuilder().
	WithBucketType("myBucketType").
	WithBucket("myBucket").
	WithKey("myKey").
	WithContext(setContext).
	WithAdditions(adds).
	 Build()

func NewUpdateSetCommandBuilder

func NewUpdateSetCommandBuilder() *UpdateSetCommandBuilder

NewUpdateSetCommandBuilder is a factory function for generating the command builder struct

func (*UpdateSetCommandBuilder) Build

func (builder *UpdateSetCommandBuilder) Build() (Command, error)

Build validates the configuration options provided then builds the command

func (*UpdateSetCommandBuilder) WithAdditions

func (builder *UpdateSetCommandBuilder) WithAdditions(adds ...[]byte) *UpdateSetCommandBuilder

WithAdditions sets the set elements to be added to the CRDT set via this update operation

func (*UpdateSetCommandBuilder) WithBucket

func (builder *UpdateSetCommandBuilder) WithBucket(bucket string) *UpdateSetCommandBuilder

WithBucket sets the bucket to be used by the command

func (*UpdateSetCommandBuilder) WithBucketType

func (builder *UpdateSetCommandBuilder) WithBucketType(bucketType string) *UpdateSetCommandBuilder

WithBucketType sets the bucket-type to be used by the command. If omitted, 'default' is used

func (*UpdateSetCommandBuilder) WithContext

func (builder *UpdateSetCommandBuilder) WithContext(context []byte) *UpdateSetCommandBuilder

WithContext sets the causal context needed to identify the state of the set when removing elements

func (*UpdateSetCommandBuilder) WithDw

WithDw (durable writes) sets the number of nodes that must report back a successful write to backend storage in order for the command operation to be considered a success by Riak. If ommitted, the bucket default is used.

See http://basho.com/posts/technical/riaks-config-behaviors-part-2/

func (*UpdateSetCommandBuilder) WithKey

WithKey sets the key to be used by the command to read / write values

func (*UpdateSetCommandBuilder) WithPw

WithPw sets the number of primary nodes (N) that must report back a successful write in order for the command operation to be considered a success by Riak. If ommitted, the bucket default is used.

See http://basho.com/posts/technical/riaks-config-behaviors-part-2/

func (*UpdateSetCommandBuilder) WithRemovals

func (builder *UpdateSetCommandBuilder) WithRemovals(removals ...[]byte) *UpdateSetCommandBuilder

WithRemovals sets the set elements to be removed from the CRDT set via this update operation

func (*UpdateSetCommandBuilder) WithReturnBody

func (builder *UpdateSetCommandBuilder) WithReturnBody(returnBody bool) *UpdateSetCommandBuilder

WithReturnBody sets Riak to return the value within its response after completing the write operation

func (*UpdateSetCommandBuilder) WithTimeout

func (builder *UpdateSetCommandBuilder) WithTimeout(timeout time.Duration) *UpdateSetCommandBuilder

WithTimeout sets a timeout to be used for this command operation

func (*UpdateSetCommandBuilder) WithW

WithW sets the number of nodes that must report back a successful write in order for then command operation to be considered a success by Riak. If ommitted, the bucket default is used.

See http://basho.com/posts/technical/riaks-config-behaviors-part-2/

type UpdateSetResponse

type UpdateSetResponse struct {
	GeneratedKey string
	Context      []byte
	SetValue     [][]byte
}

UpdateSetResponse contains the response data for a UpdateSetCommand

Directories

Path Synopsis
examples
rpb
riak
Package riak is a generated protocol buffer package.
Package riak is a generated protocol buffer package.
riak_dt
Package riak_dt is a generated protocol buffer package.
Package riak_dt is a generated protocol buffer package.
riak_kv
Package riak_kv is a generated protocol buffer package.
Package riak_kv is a generated protocol buffer package.
riak_search
Package riak_search is a generated protocol buffer package.
Package riak_search is a generated protocol buffer package.
riak_ts
Package riak_ts is a generated protocol buffer package.
Package riak_ts is a generated protocol buffer package.
riak_yokozuna
Package riak_yokozuna is a generated protocol buffer package.
Package riak_yokozuna is a generated protocol buffer package.

Jump to

Keyboard shortcuts

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