• Stars
    star
    432
  • Rank 100,635 (Top 2 %)
  • Language
    Go
  • License
    Apache License 2.0
  • Created over 10 years ago
  • Updated about 1 month 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
1,036
star
2

aerospike-client-java

Aerospike Java Client Library
Java
236
star
3

aerospike-client-nodejs

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

act

Aerospike Certification Tool
C
188
star
5

aerospike-server.docker

Dockerfiles for Aerospike Server
Shell
141
star
6

aerospike-client-python

Aerospike Python Client
Python
131
star
7

aerospike-client-c

Aerospike C Client
C
95
star
8

aerospike-kubernetes-operator

Kubernetes operator for the Aerospike database
Go
91
star
9

aerospike-client-rust

Rust client for the Aerospike database
Rust
82
star
10

aerospike-client-csharp

Aerospike C# Client Library
C#
70
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
39
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

aerospike-vector-search-examples

aerospike-vector-search-examples
Python
29
star
19

aerospike-jdbc

Minimalist JDBC driver for Aerospike
Java
27
star
20

asmalloc

Aerospike Memory Allocation Tracking Tool
C
26
star
21

aws-cloudformation

AWS CloudFormation scripts related to Aerospike
25
star
22

aerospike-tools-backup

Aerospike backup and restore utility
C
25
star
23

jemalloc

Aerospike Fork of the JEMalloc Memory Allocator
C
21
star
24

gommander

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

aerospike-tools.docker

Aerospike Tools Dockerfile
Dockerfile
18
star
26

aerolab

Quickly spin up Aerospike clusters on docker or in AWS
Go
17
star
27

aerospike-kubernetes-enterprise

Shell
17
star
28

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
29

aerospike-benchmark

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

aerospike-rest-gateway

REST client for the Aerospike database
Java
15
star
31

aerospike-server-enterprise.docker

Dockerfile for Aerospike Server Enterprise Edition
Shell
15
star
32

aerospike-mod-lua

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

aerospike-backup-service

Aerospike Backup Service
Go
12
star
34

aerospike-document-lib

Aerospike Java Document API
Java
11
star
35

aerospike-client-java-reactive

Reactive programming interfaces for the Aerospike Java client
Java
9
star
36

aerospike-lua-core

Aerospike Lua Core Library
Lua
9
star
37

php-client

Aerospike Client for PHP 8
Rust
9
star
38

backup-go

A go library for backup and restore
Go
9
star
39

luajit

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

aerospike-connect-inbound-sdk

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

aerospike-dev-notebooks.docker

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

asmt

Backup & restore shmem indexes.
C
7
star
43

aerospike-tools-validation

C
7
star
44

aerospike-management-lib

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

lua-bac

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

aerospike-docker-swarm

Python
6
star
47

graph-synth

Graph Synthesis Tool
Java
5
star
48

aql

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

trino-aerospike.docker

Trino with the Aeropsike connector Docker Image
Shell
5
star
50

aerospike-client-rest-kubernetes

Aerospike REST client Helm chart for Kubernetes
Smarty
5
star
51

aerospike-elk

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

document-lib-python

Python
5
star
53

aerospike-telemetry-agent

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

asconfig

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

s2-geometry-library

C++
4
star
56

aerospike-connect-outbound-sdk

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

tools-common-go

Common library used in tools golang projects.
Go
3
star
58

avs-client-go

๐Ÿš€โžก๏ธ๐Ÿ”๐Ÿน
Go
3
star
59

asvec

Aerospike Vector CLI
Go
3
star
60

aerospike-kubernetes-init

Go
2
star
61

kubernetes-operator

Website for the Aerospike Kubernetes Operator
JavaScript
2
star
62

helm-charts

Public helm charts for Aerospike
Shell
2
star
63

avs-client-python

๐Ÿš€โžก๏ธ๐Ÿ”๐Ÿ Aerospike Vector Search Client for Python
Python
2
star
64

schemas

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

cloud-qualification

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

aerospike-kubernetes-operator-ctl

Aerospike kubernetes operator command line tool
Go
1
star
67

secret-agent-client-c

C
1
star
68

azure-resource-manager

Shell
1
star
69

cf-service-broker-tile

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

aerospike-database-recovery

Aerospike Database Recovery Documentation
Shell
1
star
71

cf-managed-service-tile

Cloud Foundry Managed Service for Aerospike
Shell
1
star
72

aerospike-net-extensions

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

aerospike-proxy-client-sdk

Aerospike Proxy Client SDK for building clients
Kotlin
1
star
74

movement

Parallel Dataflow System
Java
1
star
75

abseil-cpp

C++
1
star