hazelcasts

package module
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: May 27, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

README

HAZELCAST

Hazelcast cluster.

Install

go get github.com/aacfactory/fns-contrib/cluster/hazelcasts

Use

import (
    _ "github.com/aacfactory/fns-contrib/cluster/hazelcasts"
)

Config

Example:

cluster:
  name: "hazelcast"
  option:
    addr:
      - ""
    username: ""
    password: ""
    ssl: 
      enable: false
    keepAlive:
      ttl: "10s"
      interval: "5s"

Use extra shared

When do not want use hazelcast based shared, then use extra, such as redis.

hazelcasts.UseExtraShared(extra)

Just use extra store

hazelcasts.UseExtraSharedStore(extra)

Just use extra lockers

hazelcasts.UseExtraSharedLockers(extra)

Then setup config.

cluster:
  option:
    shared: 

Use extra barrier

When do not want use hazelcast based barrier, then use extra, such as redis.

hazelcasts.UseExtraBarrier(extra)

cluster:
  option:
    barrier: 

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewBarrier

func NewBarrier(ctx context.Context, client *hazelcast.Client, size int) (v barriers.Barrier, err error)

func NewLockers

func NewLockers(ctx context.Context, client *hazelcast.Client, size int) (v shareds.Lockers, err error)

func NewShared

func NewShared(client *hazelcast.Client) shareds.Shared

func NewStore

func NewStore(ctx context.Context, client *hazelcast.Client, size int) (v shareds.Store, err error)

func UseExtraBarrier

func UseExtraBarrier(builder barriers.BarrierBuilder)

func UseExtraShared

func UseExtraShared(shared shareds.Shared)

func UseExtraSharedLockers

func UseExtraSharedLockers(builder shareds.LockersBuilder)

func UseExtraSharedStore

func UseExtraSharedStore(builder shareds.StoreBuilder)

Types

type Barrier

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

func (*Barrier) Do

func (barrier *Barrier) Do(ctx context.Context, key []byte, fn func() (result interface{}, err error)) (result barriers.Result, err error)

type BarrierValue

type BarrierValue []byte

func NewBarrierValue

func NewBarrierValue() BarrierValue

func (BarrierValue) Bytes

func (bv BarrierValue) Bytes() []byte

func (BarrierValue) Executing

func (bv BarrierValue) Executing() BarrierValue

func (BarrierValue) Exist

func (bv BarrierValue) Exist() bool

func (BarrierValue) Failed

func (bv BarrierValue) Failed(v error) (n BarrierValue)

func (BarrierValue) Finished

func (bv BarrierValue) Finished() bool

func (BarrierValue) IsExecuting

func (bv BarrierValue) IsExecuting() bool

func (BarrierValue) IsInit

func (bv BarrierValue) IsInit() bool

func (BarrierValue) Succeed

func (bv BarrierValue) Succeed(v interface{}) (n BarrierValue, err error)

func (BarrierValue) Value

func (bv BarrierValue) Value() (data []byte, err error)

type Cluster

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

func (*Cluster) AddService

func (cluster *Cluster) AddService(service clusters.Service)

func (*Cluster) Barrier

func (cluster *Cluster) Barrier() (barrier barriers.Barrier)

func (*Cluster) Construct

func (cluster *Cluster) Construct(options clusters.ClusterOptions) (err error)

func (*Cluster) Join

func (cluster *Cluster) Join(ctx context.Context) (err error)

func (*Cluster) Leave

func (cluster *Cluster) Leave(ctx context.Context) (err error)

func (*Cluster) NodeEvents

func (cluster *Cluster) NodeEvents() (events <-chan clusters.NodeEvent)

func (*Cluster) Shared

func (cluster *Cluster) Shared() (shared shareds.Shared)

type Locker

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

func (*Locker) Lock

func (locker *Locker) Lock(ctx context.Context) (err error)

func (*Locker) Unlock

func (locker *Locker) Unlock(ctx context.Context) (err error)

type Lockers

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

func (*Lockers) Acquire

func (lockers *Lockers) Acquire(_ context.Context, key []byte, ttl time.Duration) (locker shareds.Locker, err error)

func (*Lockers) Close

func (lockers *Lockers) Close()

type Maps

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

func NewMaps

func NewMaps(ctx context.Context, name string, client *hazelcast.Client, size int) (v *Maps, err error)

func (*Maps) Get

func (mm *Maps) Get(ctx context.Context, key []byte) (value []byte, has bool, err error)

func (*Maps) Lock

func (mm *Maps) Lock(ctx context.Context, key []byte) (err error)

func (*Maps) LockWithLease

func (mm *Maps) LockWithLease(ctx context.Context, key []byte, ttl time.Duration) (err error)

func (*Maps) NewLockContext

func (mm *Maps) NewLockContext(ctx context.Context, key []byte) context.Context

func (*Maps) Remove

func (mm *Maps) Remove(ctx context.Context, key []byte) (err error)

func (*Maps) Set

func (mm *Maps) Set(ctx context.Context, key []byte, value []byte) (err error)

func (*Maps) SetTTL

func (mm *Maps) SetTTL(ctx context.Context, key []byte, ttl time.Duration) (err error)

func (*Maps) SetWithTTL

func (mm *Maps) SetWithTTL(ctx context.Context, key []byte, value []byte, ttl time.Duration) (err error)

func (*Maps) Unlock

func (mm *Maps) Unlock(ctx context.Context, key []byte) (err error)

type Shared

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

func (*Shared) Close

func (shared *Shared) Close()

func (*Shared) Construct

func (shared *Shared) Construct(options shareds.Options) (err error)

func (*Shared) Lockers

func (shared *Shared) Lockers() (lockers shareds.Lockers)

func (*Shared) Store

func (shared *Shared) Store() (store shareds.Store)

type Store

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

func (*Store) Close

func (store *Store) Close()

func (*Store) Expire added in v1.2.84

func (store *Store) Expire(ctx context.Context, key []byte, ttl time.Duration) (err error)

func (*Store) Get

func (store *Store) Get(ctx context.Context, key []byte) (value []byte, has bool, err error)

func (*Store) Incr

func (store *Store) Incr(ctx context.Context, key []byte, delta int64) (v int64, err error)

func (*Store) Remove

func (store *Store) Remove(ctx context.Context, key []byte) (err error)

func (*Store) Set

func (store *Store) Set(ctx context.Context, key []byte, value []byte) (err error)

func (*Store) SetWithTTL

func (store *Store) SetWithTTL(ctx context.Context, key []byte, value []byte, ttl time.Duration) (err error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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