riak

package module
v1.0.0-beta1 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2015 License: Apache-2.0 Imports: 20 Imported by: 0

README

Riak Go Client

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 and Authors

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:

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"
	riak "github.com/basho/riak-go-client"
)

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

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

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

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

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

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

	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())
	}

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

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

Index

Examples

Constants

This section is empty.

Variables

View Source
var (
	ErrAddressRequired      = errors.New("RemoteAddress is required in options")
	ErrAuthMissingConfig    = errors.New("[Connection] authentication is missing TLS config")
	ErrAuthTLSUpgradeFailed = errors.New("[Connection] upgrading to TLS connection failed")
	ErrBucketRequired       = errors.New("Bucket is required")
	ErrCannotRead           = errors.New("Cannot read from a non-active or closed connection")
	ErrCannotWrite          = errors.New("Cannot write to a non-active or closed connection")
	ErrExpectedResponse     = errors.New("Expected a response from Riak but did not receive one")
	ErrKeyRequired          = errors.New("Key is required")
	ErrNilOptions           = errors.New("[Command] options must be non-nil")
	ErrOptionsRequired      = errors.New("Options are required")
)

Convenience variables used to generate errors throughout the library

View Source
var EnableDebugLogging = false

If true, debug messages will be written to the log

View Source
var ErrZeroLength error = errors.New("[Command] 0 byte data response")

Functions

This section is empty.

Types

type AuthCommand

type AuthCommand struct {
	CommandImpl
	User     string
	Password string
}

func (*AuthCommand) Name

func (cmd *AuthCommand) Name() string

Name identifies this command

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 active connection to Riak and the debug flag

func New

func New(addrs string) (*Client, error)

New generates a new Client object using an address string in the form of "127.0.0.1:8098" with default connectionOptions

func (*Client) Debug

func (c *Client) Debug(debug bool)

Debug controls the debug flag for the Client object, allowing debug messages to be written to the logs

type Cluster

type Cluster struct {
	// 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) (c *Cluster, err 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) Execute

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

Execute the provided Command against the active pooled Nodes using the NodeManager

func (*Cluster) Start

func (c *Cluster) Start() (err 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
	NodeManager NodeManager
}

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
	Successful() bool
	// 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 CommandImpl

type CommandImpl struct {
	Error   error
	Success bool
}

func (*CommandImpl) Successful

func (cmd *CommandImpl) Successful() bool

type CommitHook

type CommitHook struct {
	Name   string
	ModFun *ModFun
}

type ConflictResolver

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

ConflictResolver is an interface to handle sibling conflicts for a key

type DeleteIndexCommand

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

func (*DeleteIndexCommand) Name

func (cmd *DeleteIndexCommand) Name() string

Name identifies this command

type DeleteIndexCommandBuilder

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

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 {
	CommandImpl
	Response bool
	// contains filtered or unexported fields
}

Command used to delete a value from Riak KV.

func (*DeleteValueCommand) Name

func (cmd *DeleteValueCommand) Name() string

Name identifies this command

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

Set the RW value.

This represents the quorum for both get and put operations involved in deleting an object .

func (*DeleteValueCommandBuilder) WithTimeout

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

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

func (*DeleteValueCommandBuilder) WithVClock

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

Set 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 Error

type Error struct {
	Errcode uint32
	Errmsg  string
}

func (Error) Error

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

type FetchBucketPropsCommand

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

func (*FetchBucketPropsCommand) Name

func (cmd *FetchBucketPropsCommand) Name() string

Name identifies this command

type FetchBucketPropsCommandBuilder

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

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
}

type FetchCounterCommand

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

func (*FetchCounterCommand) Name

func (cmd *FetchCounterCommand) Name() string

Name identifies this command

type FetchCounterCommandBuilder

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

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

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

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 in milliseconds to be used for this command operation

type FetchCounterResponse

type FetchCounterResponse struct {
	IsNotFound   bool
	CounterValue int64
}

type FetchIndexCommand

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

func (*FetchIndexCommand) Name

func (cmd *FetchIndexCommand) Name() string

Name identifies this command

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 {
	CommandImpl
	Response *FetchMapResponse
	// contains filtered or unexported fields
}

func (*FetchMapCommand) Name

func (cmd *FetchMapCommand) Name() string

Name identifies this command

type FetchMapCommandBuilder

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

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

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

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
}

type FetchPreflistCommand

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

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

func (*FetchPreflistCommand) Name

func (cmd *FetchPreflistCommand) Name() string

Name identifies this command

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
}

type FetchSchemaCommand

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

func (*FetchSchemaCommand) Name

func (cmd *FetchSchemaCommand) Name() string

Name identifies this command

type FetchSchemaCommandBuilder

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

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

type FetchSetCommand

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

func (*FetchSetCommand) Name

func (cmd *FetchSetCommand) Name() string

Name identifies this command

type FetchSetCommandBuilder

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

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

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

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 in milliseconds to be used for this command operation

type FetchSetResponse

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

type FetchValueCommand

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

FetchValueCommand is used to fetch / get a value from Riak

func (*FetchValueCommand) Name

func (cmd *FetchValueCommand) Name() string

Name identifies this command

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

Example

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

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

func (*FetchValueCommandBuilder) WithIfNotModified

func (builder *FetchValueCommandBuilder) WithIfNotModified(ifNotModified []byte) *FetchValueCommandBuilder

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

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

func (*FetchValueCommandBuilder) WithSloppyQuorum

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

func (*FetchValueCommandBuilder) WithTimeout

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

WithTimeout sets a timeout in milliseconds 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 Link struct {
	Bucket string
	Key    string
	Tag    string
}

type ListBucketsCommand

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

Command used to list buckets in a bucket type.

func (*ListBucketsCommand) Done

func (cmd *ListBucketsCommand) Done() bool

func (*ListBucketsCommand) Name

func (cmd *ListBucketsCommand) Name() string

Name identifies this command

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 buckets
    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

Callback to use when streaming responses.

func (*ListBucketsCommandBuilder) WithStreaming

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

Set to stream responses.

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
}

type ListKeysCommand

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

Command used to fetch a list of keys from Riak KV.

func (*ListKeysCommand) Done

func (cmd *ListKeysCommand) Done() bool

func (*ListKeysCommand) Name

func (cmd *ListKeysCommand) Name() string

Name identifies this command

type ListKeysCommandBuilder

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

ListKeysCommandBuilder type is required for creating new instances of ListKeysCommand

   cb := func(keys []string) error {
       // Do something with keys
       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

func (*ListKeysCommandBuilder) WithStreaming

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

func (*ListKeysCommandBuilder) WithTimeout

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

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

type ListKeysResponse

type ListKeysResponse struct {
	Keys []string
}

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
}

type MapOperation

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

func (*MapOperation) AddToSet

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

func (*MapOperation) IncrementCounter

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

func (*MapOperation) Map

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

func (*MapOperation) RemoveCounter

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

func (*MapOperation) RemoveFlag

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

func (*MapOperation) RemoveFromSet

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

func (*MapOperation) RemoveMap

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

func (*MapOperation) RemoveRegister

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

func (*MapOperation) RemoveSet

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

func (*MapOperation) SetFlag

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

func (*MapOperation) SetRegister

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

type MapReduceCommand

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

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

func (*MapReduceCommand) Done

func (cmd *MapReduceCommand) Done() bool

func (*MapReduceCommand) Name

func (cmd *MapReduceCommand) Name() string

Name identifies this command

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

func (*MapReduceCommandBuilder) WithQuery

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

func (*MapReduceCommandBuilder) WithStreaming

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

type ModFun

type ModFun struct {
	Module   string
	Function string
}

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) Execute

func (n *Node) Execute(cmd Command) (executed bool, err error)

Execute retrieves an available connection from the pool and executes the Command operation against Riak

func (*Node) Start

func (n *Node) Start() (err error)

Start opens a connection with Riak at the configured remoteAddress and adds the connections to the active pool

func (*Node) Stop

func (n *Node) Stop() (err error)

Stop closes the connections with Riak at the configured remoteAddress and removes the connections from the active pool

func (*Node) String

func (n *Node) String() string

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

type NodeManager

type NodeManager interface {
	ExecuteOnNode(nodes []*Node, command Command, previous *Node) (executed bool, err 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
	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 // TODO int indexes vs string
	Links           []*Link
	VClock          []byte
}

func (*Object) AddToIndex

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

func (*Object) AddToIntIndex

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

func (*Object) HasIndexes

func (o *Object) HasIndexes() bool
func (o *Object) HasLinks() bool

func (*Object) HasUserMeta

func (o *Object) HasUserMeta() bool

type Pair

type Pair struct {
	Key   string
	Value string
}

type PingCommand

type PingCommand struct {
	CommandImpl
}

func (*PingCommand) Name

func (cmd *PingCommand) Name() string

Name identifies this command

type PingCommandBuilder

type PingCommandBuilder struct {
}

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
}

type ReplMode

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

type Schema

type Schema struct {
	Name    string
	Content string
}

type SearchCommand

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

func (*SearchCommand) Name

func (cmd *SearchCommand) Name() string

Name identifies this command

type SearchCommandBuilder

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

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

func (*SearchCommandBuilder) WithDefaultOperation

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

func (*SearchCommandBuilder) WithFilterQuery

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

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

func (*SearchCommandBuilder) WithPresort

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

func (*SearchCommandBuilder) WithQuery

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

func (*SearchCommandBuilder) WithReturnFields

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

func (*SearchCommandBuilder) WithSortField

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

func (*SearchCommandBuilder) WithStart

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

type SearchDoc

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

type SearchIndex

type SearchIndex struct {
	Name   string
	Schema string
	NVal   uint32
}

type SearchResponse

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

type SecondaryIndexQueryCommand

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

Command used to query for keys from Riak KV using secondary indexes

func (*SecondaryIndexQueryCommand) Done

func (cmd *SecondaryIndexQueryCommand) Done() bool

func (*SecondaryIndexQueryCommand) Name

func (cmd *SecondaryIndexQueryCommand) Name() string

Name identifies this command

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").
    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

func (*SecondaryIndexQueryCommandBuilder) WithContinuation

func (*SecondaryIndexQueryCommandBuilder) WithIndexKey

func (*SecondaryIndexQueryCommandBuilder) WithIndexName

WithIndexName sets the index to use for the command

func (*SecondaryIndexQueryCommandBuilder) WithIntRange

func (*SecondaryIndexQueryCommandBuilder) WithMaxResults

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

func (*SecondaryIndexQueryCommandBuilder) WithPaginationSort

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

func (*SecondaryIndexQueryCommandBuilder) WithRange

func (*SecondaryIndexQueryCommandBuilder) WithReturnKeyAndIndex

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

func (*SecondaryIndexQueryCommandBuilder) WithStreaming

func (*SecondaryIndexQueryCommandBuilder) WithTermRegex

func (*SecondaryIndexQueryCommandBuilder) WithTimeout

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

type SecondaryIndexQueryResponse

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

type SecondaryIndexQueryResult

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

type StartTlsCommand

type StartTlsCommand struct {
	CommandImpl
}

func (*StartTlsCommand) Name

func (cmd *StartTlsCommand) Name() string

Name identifies this command

type StoreBucketPropsCommand

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

func (*StoreBucketPropsCommand) Name

func (cmd *StoreBucketPropsCommand) Name() string

Name identifies this command

type StoreBucketPropsCommandBuilder

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

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

func (*StoreBucketPropsCommandBuilder) AddPreCommit

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

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

func (*StoreBucketPropsCommandBuilder) WithBackend

func (*StoreBucketPropsCommandBuilder) WithBasicQuorum

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

func (*StoreBucketPropsCommandBuilder) WithBigVClock

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

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

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 ommitted, 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

func (*StoreBucketPropsCommandBuilder) WithNVal

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 (*StoreBucketPropsCommandBuilder) WithNotFoundOk

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

func (*StoreBucketPropsCommandBuilder) WithOldVClock

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

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. If ommitted, the bucket default is used.

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. If ommitted, the bucket default is used.

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. If ommitted, the bucket default is used.

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

func (*StoreBucketPropsCommandBuilder) WithRw

func (*StoreBucketPropsCommandBuilder) WithSearch

func (*StoreBucketPropsCommandBuilder) WithSearchIndex

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

func (*StoreBucketPropsCommandBuilder) WithSmallVClock

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

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. If ommitted, the bucket default is used.

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

func (*StoreBucketPropsCommandBuilder) WithYoungVClock

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

type StoreIndexCommand

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

func (*StoreIndexCommand) Name

func (cmd *StoreIndexCommand) Name() string

Name identifies this command

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

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 {
	CommandImpl
	Response bool
	// contains filtered or unexported fields
}

func (*StoreSchemaCommand) Name

func (cmd *StoreSchemaCommand) Name() string

Name identifies this command

type StoreSchemaCommandBuilder

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

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

func (*StoreSchemaCommandBuilder) WithSchemaName

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

type StoreValueCommand

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

Command used to store a value from Riak KV.

func (*StoreValueCommand) Name

func (cmd *StoreValueCommand) Name() string

Name identifies this command

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

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

func (*StoreValueCommandBuilder) WithContent

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

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

func (*StoreValueCommandBuilder) WithIfNotModified

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

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

func (*StoreValueCommandBuilder) WithSloppyQuorum

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

func (*StoreValueCommandBuilder) WithTimeout

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

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

func (*StoreValueCommandBuilder) WithVClock

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

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
}

type StreamingCommand

type StreamingCommand interface {
	Done() bool
}

StreamingCommand interface requires the Done() method for signaling the completion of a streamed response

type UpdateCounterCommand

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

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

func (*UpdateCounterCommand) Name

func (cmd *UpdateCounterCommand) Name() string

Name identifies this command

type UpdateCounterCommandBuilder

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

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 in milliseconds 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 {
	CommandImpl
	Response *UpdateMapResponse
	// contains filtered or unexported fields
}

func (*UpdateMapCommand) Name

func (cmd *UpdateMapCommand) Name() string

Name identifies this command

type UpdateMapCommandBuilder

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

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

func (*UpdateMapCommandBuilder) WithDw

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

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
}

type UpdateSetCommand

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

func (*UpdateSetCommand) Name

func (cmd *UpdateSetCommand) Name() string

Name identifies this command

type UpdateSetCommandBuilder

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

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

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

func (*UpdateSetCommandBuilder) WithDw

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

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 in milliseconds 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
}

Directories

Path Synopsis
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_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