client

package
v0.19.0 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2025 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultPutSingleflightTimeout is based off default value for BasePolicy.SocketTimeout
	// Since retries are not recommended for Put operations, we will use this simple value
	DefaultPutSingleflightTimeout = time.Second * 30

	// This might be too short for a pure default configuration.
	// It looks like it should be something like SocketTimeout + SleepBetweenRetries * cumulative product from 1 to MaxRetries of SleepMultiplier...
	// But in our common use case, 30 seconds is very long, and the Aerospike Client should timeout first.
	DefaultGetSingleflightTimeout = time.Second * 30
)

Variables

View Source
var DefaultAerospikePool = &Pool{}

Functions

This section is empty.

Types

type Aero added in v0.18.0

type Aero interface {
	// Mocks aerospike.Client.Get
	Get(policy *aero.BasePolicy, key *aero.Key, binNames ...string) (record *aero.Record, err error)

	// Mocks aerospike.Client.Put
	Put(writePolicy *aero.WritePolicy, key *aero.Key, value aero.BinMap) (err error)
}

Aero is a mock of aerospike.Client.

type Option added in v0.16.0

type Option func(srv *Service)

func WithBasePolicy added in v0.16.0

func WithBasePolicy(basePolicy *aero.BasePolicy) Option

WithBasePolicy will provide an initial BasePolicy. Even when overridden, the timeout will be applied UNLESS using WithBypassConfiguredTimeout.

func WithBypassConfiguredTimeout added in v0.16.0

func WithBypassConfiguredTimeout() Option

WithBypassConfiguredTimeout will bypass the configured timeout if using WithClientPolicy or WithBasePolicy.

func WithClientPolicy added in v0.16.0

func WithClientPolicy(clientPolicy *aero.ClientPolicy) Option

WithClientPolicy will provide an initial ClientPolicy. Even when overridden, the timeout will be applied UNLESS using WithBypassConfiguredTimeout.

type Pool added in v0.16.0

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

type Service

type Service struct {
	Client Aero

	*circut.Breaker
	// contains filtered or unexported fields
}

Service represents aerospike client Service

func New

func New(config *datastore.Connection) (*Service, error)

New creates a new Aerospike service

func NewWithOptions added in v0.16.0

func NewWithOptions(config *datastore.Connection, options ...Option) (*Service, error)

func (*Service) Get

func (s *Service) Get(ctx context.Context, key *aero.Key, binNames ...string) (record *aero.Record, err error)

Get returns record for supplied key and optional bin names.

func (*Service) Probe added in v0.10.0

func (s *Service) Probe()

func (*Service) Put

func (s *Service) Put(writePolicy *aero.WritePolicy, key *aero.Key, value aero.BinMap) (err error)

Put puts a record to Aerospike. Context is not supported since the Aerospike library does not support it.

Jump to

Keyboard shortcuts

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