• Stars
    star
    421
  • Rank 99,140 (Top 3 %)
  • Language
    Go
  • License
    Apache License 2.0
  • Created almost 10 years ago
  • Updated 22 days ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Aerospike Client Go

Aerospike Go Client v7

Aerospike Client Go Godoc

An Aerospike library for Go.

This library is compatible with Go 1.21+ 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.

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/v7"
)

// 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.21+ 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.21+ and setup your environment as Documented here.
  2. Get the client in your GOPATH : go get github.com/aerospike/aerospike-client-go/v7
  • To update the client library: go get -u github.com/aerospike/aerospike-client-go/v7

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

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.

More Repositories

1

aerospike-server

Aerospike Database Server โ€“ flash-optimized, in-memory, nosql database
C
950
star
2

aerospike-client-java

Aerospike Java Client Library
Java
229
star
3

aerospike-client-nodejs

Node.js client for the Aerospike database
JavaScript
197
star
4

act

Aerospike Certification Tool
C
188
star
5

aerospike-server.docker

Dockerfiles for Aerospike Server
Shell
140
star
6

aerospike-client-python

Aerospike Python Client
Python
126
star
7

aerospike-client-c

Aerospike C Client
C
92
star
8

aerospike-kubernetes-operator

Kubernetes operator for the Aerospike database
Go
87
star
9

aerospike-client-rust

Rust client for the Aerospike database
Rust
76
star
10

aerospike-client-csharp

Aerospike C# Client Library
C#
69
star
11

aerospike-client-ruby

Ruby client for the Aerospike database
Ruby
60
star
12

aerospike-kubernetes

Mustache
51
star
13

aerospike-common

Common Library
C
47
star
14

aerospike-loader

Aerospike Data Loader
Java
41
star
15

aerospike-admin

Aerospike Administration tool: allows operations to view vital stats from the aerospike server from the command line.
Python
38
star
16

aerospike-prometheus-exporter

Monitoring suite for the Aerospike DB
Go
36
star
17

aerospike-monitoring

Python
33
star
18

aws-cloudformation

AWS CloudFormation scripts related to Aerospike
25
star
19

aerospike-jdbc

Minimalist JDBC driver for Aerospike
Java
25
star
20

aerospike-tools-backup

Aerospike backup and restore utility
C
25
star
21

asmalloc

Aerospike Memory Allocation Tracking Tool
C
25
star
22

jemalloc

Aerospike Fork of the JEMalloc Memory Allocator
C
21
star
23

gommander

Go library to manage multiple servers over SSH
Go
18
star
24

aerospike-tools.docker

Aerospike Tools Dockerfile
Dockerfile
18
star
25

aerospike-kubernetes-enterprise

Shell
17
star
26

java-object-mapper

The Java Object Mapper is a simple, light-weight framework used to map POJOs to the Aerospike database. Using simple annotations or a configuration YAML file to describe how to map the data to Aerospike, the project takes the tedium out of mapping the data through the powerful, low level interface.
Java
17
star
27

aerospike-rest-gateway

REST client for the Aerospike database
Java
15
star
28

aerospike-server-enterprise.docker

Dockerfile for Aerospike Server Enterprise Edition
Shell
15
star
29

aerospike-benchmark

A tool to benchmark the Aerospike Database.
C
14
star
30

aerolab

Quickly spin up Aerospike clusters on docker or in AWS
JavaScript
14
star
31

aerospike-mod-lua

Lua Interface Module for Aerospike Server and C Client
C
12
star
32

aerospike-document-lib

Aerospike Java Document API
Java
10
star
33

aerospike-lua-core

Aerospike Lua Core Library
Lua
9
star
34

luajit

Aerospike Fork of the Lua JIT (Just-In-Time Compiler) http://luajit.org/
C
8
star
35

aerospike-connect-inbound-sdk

Inbound SDK for custom transforms or other plugins
Java
8
star
36

aerospike-dev-notebooks.docker

Repo for a docker image with Server, Jupyter, Python client, Tools and Notebooks
Jupyter Notebook
8
star
37

aerospike-backup-service

Aerospike Backup Service
Go
8
star
38

aerospike-client-java-reactive

Reactive programming interfaces for the Aerospike Java client
Java
7
star
39

asmt

Backup & restore shmem indexes.
C
6
star
40

aerospike-management-lib

A library to hold aerospike management and operations tasks.
Go
6
star
41

lua-bac

The Lua programming language with CMake based build
C
6
star
42

aerospike-docker-swarm

Python
6
star
43

graph-synth

Graph Synthesis Tool
Java
5
star
44

aql

The Aerospike Quick Look data browsing utility.
C
5
star
45

aerospike-client-rest-kubernetes

Aerospike REST client Helm chart for Kubernetes
Smarty
5
star
46

aerospike-elk

Starting point for using Aerospike with ElasticSearch / LogStash / Kibana for log file analysis.
5
star
47

php-client

git repo for the new PHP Aerospike client
Rust
5
star
48

document-lib-python

Python
5
star
49

aerospike-telemetry-agent

Aerospike Telemetry Agent: Anonymized Usage Data Collector.
Python
4
star
50

asconfig

A CLI tool for managing Aerospike configuration files.
Go
4
star
51

s2-geometry-library

C++
4
star
52

trino-aerospike.docker

Trino with the Aeropsike connector Docker Image
Shell
3
star
53

aerospike-connect-outbound-sdk

An outbound SDK for creating custom transforms for streaming connectors.
Java
3
star
54

proximus-examples

proximus-examples
Python
3
star
55

kubernetes-operator

Website for the Aerospike Kubernetes Operator
JavaScript
2
star
56

tools-common-go

Common library used in tools golang projects.
Go
2
star
57

schemas

Location for public aerospike schemas (json / yaml / xml / etc)
2
star
58

cloud-qualification

Scripts and instructions to run benchmarks/tests on cloud environments.
Python
2
star
59

aerospike-kubernetes-operator-ctl

Aerospike kubernetes operator command line tool
Go
1
star
60

secret-agent-client-c

C
1
star
61

aerospike-kubernetes-init

Go
1
star
62

azure-resource-manager

Shell
1
star
63

cf-service-broker-tile

Package up the Aerospike Service Broker into a Pivotal Cloud Foundry tile
Python
1
star
64

aerospike-database-recovery

Aerospike Database Recovery Documentation
Shell
1
star
65

cf-managed-service-tile

Cloud Foundry Managed Service for Aerospike
Shell
1
star
66

aerospike-net-extensions

Aerospike .NET Extensions [IDistributedCache]
C#
1
star
67

aerospike-proxy-client-sdk

Aerospike Proxy Client SDK for building clients
Kotlin
1
star
68

movement

Parallel Dataflow System
Java
1
star
69

abseil-cpp

C++
1
star