open-vault/vendor/github.com/aerospike/aerospike-client-go
Eugene R 331529fc94
Aerospike storage backend (#10131)
* add an Aerospike storage backend

* go mod vendor

* add Aerospike storage configuration docs

* review fixes

* bump aerospike client to v3.1.1

* rename the defaultHostname variable

* relocate the docs page
2021-01-12 15:26:07 -08:00
..
internal Aerospike storage backend (#10131) 2021-01-12 15:26:07 -08:00
logger Aerospike storage backend (#10131) 2021-01-12 15:26:07 -08:00
pkg Aerospike storage backend (#10131) 2021-01-12 15:26:07 -08:00
types Aerospike storage backend (#10131) 2021-01-12 15:26:07 -08:00
utils/buffer Aerospike storage backend (#10131) 2021-01-12 15:26:07 -08:00
.build.yml Aerospike storage backend (#10131) 2021-01-12 15:26:07 -08:00
.gitignore Aerospike storage backend (#10131) 2021-01-12 15:26:07 -08:00
.travis.yml Aerospike storage backend (#10131) 2021-01-12 15:26:07 -08:00
admin_command.go Aerospike storage backend (#10131) 2021-01-12 15:26:07 -08:00
admin_policy.go Aerospike storage backend (#10131) 2021-01-12 15:26:07 -08:00
aerospike.go Aerospike storage backend (#10131) 2021-01-12 15:26:07 -08:00
auth_mode.go Aerospike storage backend (#10131) 2021-01-12 15:26:07 -08:00
batch_command.go Aerospike storage backend (#10131) 2021-01-12 15:26:07 -08:00
batch_command_exists.go Aerospike storage backend (#10131) 2021-01-12 15:26:07 -08:00
batch_command_get.go Aerospike storage backend (#10131) 2021-01-12 15:26:07 -08:00
batch_command_get_reflect.go Aerospike storage backend (#10131) 2021-01-12 15:26:07 -08:00
batch_command_reflect.go Aerospike storage backend (#10131) 2021-01-12 15:26:07 -08:00
batch_index_command_get.go Aerospike storage backend (#10131) 2021-01-12 15:26:07 -08:00
batch_node.go Aerospike storage backend (#10131) 2021-01-12 15:26:07 -08:00
batch_policy.go Aerospike storage backend (#10131) 2021-01-12 15:26:07 -08:00
batch_read.go Aerospike storage backend (#10131) 2021-01-12 15:26:07 -08:00
bin.go Aerospike storage backend (#10131) 2021-01-12 15:26:07 -08:00
bit_overflow_action.go Aerospike storage backend (#10131) 2021-01-12 15:26:07 -08:00
bit_policy.go Aerospike storage backend (#10131) 2021-01-12 15:26:07 -08:00
bit_resize_flags.go Aerospike storage backend (#10131) 2021-01-12 15:26:07 -08:00
bit_write_flags.go Aerospike storage backend (#10131) 2021-01-12 15:26:07 -08:00
buffered_connection.go Aerospike storage backend (#10131) 2021-01-12 15:26:07 -08:00
bytes_buffer.go Aerospike storage backend (#10131) 2021-01-12 15:26:07 -08:00
cdt.go Aerospike storage backend (#10131) 2021-01-12 15:26:07 -08:00
cdt_bitwise.go Aerospike storage backend (#10131) 2021-01-12 15:26:07 -08:00
cdt_context.go Aerospike storage backend (#10131) 2021-01-12 15:26:07 -08:00
cdt_list.go Aerospike storage backend (#10131) 2021-01-12 15:26:07 -08:00
cdt_map.go Aerospike storage backend (#10131) 2021-01-12 15:26:07 -08:00
CHANGELOG.md Aerospike storage backend (#10131) 2021-01-12 15:26:07 -08:00
client.go Aerospike storage backend (#10131) 2021-01-12 15:26:07 -08:00
client_appengine_exclusions.go Aerospike storage backend (#10131) 2021-01-12 15:26:07 -08:00
client_policy.go Aerospike storage backend (#10131) 2021-01-12 15:26:07 -08:00
client_reflect.go Aerospike storage backend (#10131) 2021-01-12 15:26:07 -08:00
cluster.go Aerospike storage backend (#10131) 2021-01-12 15:26:07 -08:00
command.go Aerospike storage backend (#10131) 2021-01-12 15:26:07 -08:00
commit_policy.go Aerospike storage backend (#10131) 2021-01-12 15:26:07 -08:00
compat_after_go1.8.go Aerospike storage backend (#10131) 2021-01-12 15:26:07 -08:00
compat_before_go1.8.go Aerospike storage backend (#10131) 2021-01-12 15:26:07 -08:00
connection.go Aerospike storage backend (#10131) 2021-01-12 15:26:07 -08:00
connection_heap.go Aerospike storage backend (#10131) 2021-01-12 15:26:07 -08:00
delete_command.go Aerospike storage backend (#10131) 2021-01-12 15:26:07 -08:00
execute_command.go Aerospike storage backend (#10131) 2021-01-12 15:26:07 -08:00
execute_task.go Aerospike storage backend (#10131) 2021-01-12 15:26:07 -08:00
exists_command.go Aerospike storage backend (#10131) 2021-01-12 15:26:07 -08:00
field_type.go Aerospike storage backend (#10131) 2021-01-12 15:26:07 -08:00
filter.go Aerospike storage backend (#10131) 2021-01-12 15:26:07 -08:00
generation_policy.go Aerospike storage backend (#10131) 2021-01-12 15:26:07 -08:00
generics.go Aerospike storage backend (#10131) 2021-01-12 15:26:07 -08:00
hll_operation.go Aerospike storage backend (#10131) 2021-01-12 15:26:07 -08:00
hll_policy.go Aerospike storage backend (#10131) 2021-01-12 15:26:07 -08:00
hll_write_flags.go Aerospike storage backend (#10131) 2021-01-12 15:26:07 -08:00
host.go Aerospike storage backend (#10131) 2021-01-12 15:26:07 -08:00
index_collection_type.go Aerospike storage backend (#10131) 2021-01-12 15:26:07 -08:00
index_type.go Aerospike storage backend (#10131) 2021-01-12 15:26:07 -08:00
info.go Aerospike storage backend (#10131) 2021-01-12 15:26:07 -08:00
info_policy.go Aerospike storage backend (#10131) 2021-01-12 15:26:07 -08:00
key.go Aerospike storage backend (#10131) 2021-01-12 15:26:07 -08:00
key_helper.go Aerospike storage backend (#10131) 2021-01-12 15:26:07 -08:00
language.go Aerospike storage backend (#10131) 2021-01-12 15:26:07 -08:00
LICENSE Aerospike storage backend (#10131) 2021-01-12 15:26:07 -08:00
login_command.go Aerospike storage backend (#10131) 2021-01-12 15:26:07 -08:00
marshal.go Aerospike storage backend (#10131) 2021-01-12 15:26:07 -08:00
multi_command.go Aerospike storage backend (#10131) 2021-01-12 15:26:07 -08:00
multi_policy.go Aerospike storage backend (#10131) 2021-01-12 15:26:07 -08:00
node.go Aerospike storage backend (#10131) 2021-01-12 15:26:07 -08:00
node_error.go Aerospike storage backend (#10131) 2021-01-12 15:26:07 -08:00
node_stats.go Aerospike storage backend (#10131) 2021-01-12 15:26:07 -08:00
node_validator.go Aerospike storage backend (#10131) 2021-01-12 15:26:07 -08:00
operate_command.go Aerospike storage backend (#10131) 2021-01-12 15:26:07 -08:00
operation.go Aerospike storage backend (#10131) 2021-01-12 15:26:07 -08:00
packer.go Aerospike storage backend (#10131) 2021-01-12 15:26:07 -08:00
packer_reflect.go Aerospike storage backend (#10131) 2021-01-12 15:26:07 -08:00
partition.go Aerospike storage backend (#10131) 2021-01-12 15:26:07 -08:00
partition_parser.go Aerospike storage backend (#10131) 2021-01-12 15:26:07 -08:00
partitions.go Aerospike storage backend (#10131) 2021-01-12 15:26:07 -08:00
peers.go Aerospike storage backend (#10131) 2021-01-12 15:26:07 -08:00
peers_parser.go Aerospike storage backend (#10131) 2021-01-12 15:26:07 -08:00
policy.go Aerospike storage backend (#10131) 2021-01-12 15:26:07 -08:00
predexp.go Aerospike storage backend (#10131) 2021-01-12 15:26:07 -08:00
priority.go Aerospike storage backend (#10131) 2021-01-12 15:26:07 -08:00
privilege.go Aerospike storage backend (#10131) 2021-01-12 15:26:07 -08:00
query_aggregate_command.go Aerospike storage backend (#10131) 2021-01-12 15:26:07 -08:00
query_command.go Aerospike storage backend (#10131) 2021-01-12 15:26:07 -08:00
query_objects_command.go Aerospike storage backend (#10131) 2021-01-12 15:26:07 -08:00
query_policy.go Aerospike storage backend (#10131) 2021-01-12 15:26:07 -08:00
query_record_command.go Aerospike storage backend (#10131) 2021-01-12 15:26:07 -08:00
query_validate.go Aerospike storage backend (#10131) 2021-01-12 15:26:07 -08:00
read_command.go Aerospike storage backend (#10131) 2021-01-12 15:26:07 -08:00
read_command_reflect.go Aerospike storage backend (#10131) 2021-01-12 15:26:07 -08:00
read_header_command.go Aerospike storage backend (#10131) 2021-01-12 15:26:07 -08:00
read_mode_ap.go Aerospike storage backend (#10131) 2021-01-12 15:26:07 -08:00
read_mode_sc.go Aerospike storage backend (#10131) 2021-01-12 15:26:07 -08:00
README.md Aerospike storage backend (#10131) 2021-01-12 15:26:07 -08:00
record.go Aerospike storage backend (#10131) 2021-01-12 15:26:07 -08:00
record_exists_action.go Aerospike storage backend (#10131) 2021-01-12 15:26:07 -08:00
recordset.go Aerospike storage backend (#10131) 2021-01-12 15:26:07 -08:00
replica_policy.go Aerospike storage backend (#10131) 2021-01-12 15:26:07 -08:00
role.go Aerospike storage backend (#10131) 2021-01-12 15:26:07 -08:00
scan_command.go Aerospike storage backend (#10131) 2021-01-12 15:26:07 -08:00
scan_objects_command.go Aerospike storage backend (#10131) 2021-01-12 15:26:07 -08:00
scan_policy.go Aerospike storage backend (#10131) 2021-01-12 15:26:07 -08:00
server_command.go Aerospike storage backend (#10131) 2021-01-12 15:26:07 -08:00
single_command.go Aerospike storage backend (#10131) 2021-01-12 15:26:07 -08:00
statement.go Aerospike storage backend (#10131) 2021-01-12 15:26:07 -08:00
task.go Aerospike storage backend (#10131) 2021-01-12 15:26:07 -08:00
task_drop_index.go Aerospike storage backend (#10131) 2021-01-12 15:26:07 -08:00
task_index.go Aerospike storage backend (#10131) 2021-01-12 15:26:07 -08:00
task_register.go Aerospike storage backend (#10131) 2021-01-12 15:26:07 -08:00
task_remove.go Aerospike storage backend (#10131) 2021-01-12 15:26:07 -08:00
touch_command.go Aerospike storage backend (#10131) 2021-01-12 15:26:07 -08:00
udf.go Aerospike storage backend (#10131) 2021-01-12 15:26:07 -08:00
unpacker.go Aerospike storage backend (#10131) 2021-01-12 15:26:07 -08:00
user_roles.go Aerospike storage backend (#10131) 2021-01-12 15:26:07 -08:00
value.go Aerospike storage backend (#10131) 2021-01-12 15:26:07 -08:00
value_helpers.go Aerospike storage backend (#10131) 2021-01-12 15:26:07 -08:00
value_reflect.go Aerospike storage backend (#10131) 2021-01-12 15:26:07 -08:00
write_command.go Aerospike storage backend (#10131) 2021-01-12 15:26:07 -08:00
write_policy.go Aerospike storage backend (#10131) 2021-01-12 15:26:07 -08:00

Aerospike Go Client

Aerospike Client Go Build Status Godoc

An Aerospike library for Go.

This library is compatible with Go 1.9+ and supports the following operating systems: Linux, Mac OS X (Windows builds are possible, but untested).

Up-to-date documentation is available in the Godoc.

You can refer to the test files for idiomatic use cases.

Please refer to CHANGELOG.md for release notes, or if you encounter breaking changes.

Notice:

We have released the Go Client v2, with some breaking API changes. Most changes are minor, and can be fixed with relative ease.

The only major issue is that the behavior of the client when a key does not exist has changed.

It used to return no error, but a nil Record.Bins. Now it returns ErrKeyNotFound error.

This is a significant changes, and you should search your code for all instances of Bins == nil and adapt the code accordingly.

Please refer to the CHANGELOG.md for details.

Usage:

The following is a very simple example of CRUD operations in an Aerospike database.

package main

import (
  "fmt"

  aero "github.com/aerospike/aerospike-client-go"
)

// This is only for this example.
// Please handle errors properly.
func panicOnError(err error) {
  if err != nil {
    panic(err)
  }
}

func main() {
  // define a client to connect to
  client, err := aero.NewClient("127.0.0.1", 3000)
  panicOnError(err)

  key, err := aero.NewKey("test", "aerospike", "key")
  panicOnError(err)

  // define some bins with data
  bins := aero.BinMap{
    "bin1": 42,
    "bin2": "An elephant is a mouse with an operating system",
    "bin3": []interface{}{"Go", 2009},
  }

  // write the bins
  err = client.Put(nil, key, bins)
  panicOnError(err)

  // read it back!
  rec, err := client.Get(nil, key)
  panicOnError(err)

  // delete the key, and check if key exists
  existed, err := client.Delete(nil, key)
  panicOnError(err)
  fmt.Printf("Record existed before delete? %v\n", existed)
}

More examples illustrating the use of the API are located in the examples directory.

Details about the API are available in the docs directory.

Prerequisites

Go version v1.12+ is required.

To install the latest stable version of Go, visit http://golang.org/dl/

Aerospike Go client implements the wire protocol, and does not depend on the C client. It is goroutine friendly, and works asynchronously.

Supported operating systems:

  • Major Linux distributions (Ubuntu, Debian, Red Hat)
  • Mac OS X
  • Windows (untested)

Installation:

  1. Install Go 1.9+ and setup your environment as Documented here.
  2. Get the client in your GOPATH : go get github.com/aerospike/aerospike-client-go
  • To update the client library: go get -u github.com/aerospike/aerospike-client-go

Using gopkg.in is also supported: go get -u gopkg.in/aerospike/aerospike-client-go.v1

Some Hints:

  • To run a go program directly: go run <filename.go>
  • to build: go build -o <output> <filename.go>
  • example: go build -o benchmark tools/benchmark/benchmark.go

Performance Tweaking

We are bending all efforts to improve the client's performance. In our reference benchmarks, Go client performs almost as good as the C client.

To read about performance variables, please refer to docs/performance.md

Tests

This library is packaged with a number of tests. Tests require Ginkgo and Gomega library.

Before running the tests, you need to update the dependencies:

$ go get .

To run all the test cases with race detection:

$ ginkgo -r -race

Examples

A variety of example applications are provided in the examples directory.

Tools

A variety of clones of original tools are provided in the tools directory. They show how to use more advanced features of the library to re-implement the same functionality in a more concise way.

Benchmarks

Benchmark utility is provided in the tools/benchmark directory. See the tools/benchmark/README.md for details.

API Documentation

A simple API documentation is available in the docs directory. The latest up-to-date docs can be found in Godoc.

Google App Engine

To build the library for App Engine, build it with the build tag app_engine. Aggregation functionality is not available in this build.

Reflection, and Object API

To make the library both flexible and fast, we had to integrate the reflection API (methods with [Get/Put/...]Object names) tightly in the library. In case you wanted to avoid mixing those API in your app inadvertently, you can use the build tag as_performance to remove those APIs from the build.

License

The Aerospike Go Client is made available under the terms of the Apache License, Version 2, as stated in the file LICENSE.

Individual files may be made available under their own specific license, all compatible with Apache License, Version 2. Please see individual files for details.