Documentation ¶
Index ¶
- type AtomicLong
- func (a *AtomicLong) AddAndGet(ctx context.Context, delta int64) (int64, error)
- func (a *AtomicLong) Alter(ctx context.Context, function interface{}) error
- func (a *AtomicLong) AlterAndGet(ctx context.Context, function interface{}) (int64, error)
- func (a *AtomicLong) Apply(ctx context.Context, function interface{}) (interface{}, error)
- func (a *AtomicLong) CompareAndSet(ctx context.Context, expect int64, update int64) (bool, error)
- func (a *AtomicLong) DecrementAndGet(ctx context.Context) (int64, error)
- func (p AtomicLong) Destroy(ctx context.Context) error
- func (a *AtomicLong) Get(ctx context.Context) (int64, error)
- func (a *AtomicLong) GetAndAdd(ctx context.Context, delta int64) (int64, error)
- func (a *AtomicLong) GetAndAlter(ctx context.Context, function interface{}) (int64, error)
- func (a *AtomicLong) GetAndDecrement(ctx context.Context) (int64, error)
- func (a *AtomicLong) GetAndIncrement(ctx context.Context) (int64, error)
- func (a *AtomicLong) GetAndSet(ctx context.Context, value int64) (int64, error)
- func (a *AtomicLong) IncrementAndGet(ctx context.Context) (int64, error)
- func (p AtomicLong) Name() string
- func (p AtomicLong) ServiceName() string
- func (a *AtomicLong) Set(ctx context.Context, value int64) error
- type Subsystem
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AtomicLong ¶
type AtomicLong struct {
// contains filtered or unexported fields
}
AtomicLong is a redundant and highly available distributed counter for 64-bit integers (“long“ type in Java). It works on top of the Raft consensus algorithm. It offers linearizability during crash failures and network partitions. It is CP with respect to the CAP principle. If a network partition occurs, it remains available on at most one side of the partition. AtomicLong implementation does not offer exactly-once / effectively-once execution semantics. It goes with at-least-once execution semantics by default and can cause an API call to be committed multiple times in case of CP member failures. It can be tuned to offer at-most-once execution semantics. See fail-on-indeterminate-operation-state server-side setting: https://docs.hazelcast.com/hazelcast/latest/cp-subsystem/configuration#global-configuration-options
func (*AtomicLong) Alter ¶
func (a *AtomicLong) Alter(ctx context.Context, function interface{}) error
Alter alters the currently stored value by applying a function on it. function must be an instance of Hazelcast serializable type. It must have a counterpart registered in the server-side that implements the "com.hazelcast.core.IFunction" interface with the actual logic of the function to be applied.
func (*AtomicLong) AlterAndGet ¶
func (a *AtomicLong) AlterAndGet(ctx context.Context, function interface{}) (int64, error)
AlterAndGet alters the currently stored value by applying a function on it and gets the result. function must be an instance of Hazelcast serializable type. It must have a counterpart registered in the server-side that implements the "com.hazelcast.core.IFunction" interface with the actual logic of the function to be applied.
func (*AtomicLong) Apply ¶
func (a *AtomicLong) Apply(ctx context.Context, function interface{}) (interface{}, error)
Apply applies a function on the value, the actual stored value will not change. function must be an instance of Hazelcast serializable type. It must have a counterpart registered in the server-side that implements the "com.hazelcast.core.IFunction" interface with the actual logic of the function to be applied.
func (*AtomicLong) CompareAndSet ¶
CompareAndSet Atomically sets the value to the given updated value only if the current value equals the expected value.
func (*AtomicLong) DecrementAndGet ¶
func (a *AtomicLong) DecrementAndGet(ctx context.Context) (int64, error)
DecrementAndGet atomically decrements the current value by one.
func (*AtomicLong) Get ¶
func (a *AtomicLong) Get(ctx context.Context) (int64, error)
Get gets the current value.
func (*AtomicLong) GetAndAlter ¶
func (a *AtomicLong) GetAndAlter(ctx context.Context, function interface{}) (int64, error)
GetAndAlter alters the currently stored value by applying a function on it and gets the old value. function must be an instance of Hazelcast serializable type. It must have a counterpart registered in the server-side that implements the "com.hazelcast.core.IFunction" interface with the actual logic of the function to be applied.
func (*AtomicLong) GetAndDecrement ¶
func (a *AtomicLong) GetAndDecrement(ctx context.Context) (int64, error)
GetAndDecrement atomically decrements the current value by one.
func (*AtomicLong) GetAndIncrement ¶
func (a *AtomicLong) GetAndIncrement(ctx context.Context) (int64, error)
GetAndIncrement atomically increments the current value by one.
func (*AtomicLong) IncrementAndGet ¶
func (a *AtomicLong) IncrementAndGet(ctx context.Context) (int64, error)
IncrementAndGet atomically increments the current value by one.
func (AtomicLong) ServiceName ¶
func (p AtomicLong) ServiceName() string
type Subsystem ¶
type Subsystem struct {
// contains filtered or unexported fields
}
Subsystem represent the CP service. CP Subsystem is a component of Hazelcast that builds a strongly consistent layer for a set of distributed data structures. Its APIs can be used for implementing distributed coordination use cases, such as leader election, distributed locking, synchronization, and metadata management. Its data structures are CP with respect to the CAP principle, i.e., they always maintain linearizability and prefer consistency over availability during network partitions. Besides network partitions, CP Subsystem withstands server and client failures. Data structures in CP Subsystem run in CP groups. Each CP group elects its own Raft leader and runs the Raft consensus algorithm independently. The CP data structures differ from the other Hazelcast data structures in two aspects. First, an internal commit is performed on the METADATA CP group every time you fetch a proxy from this interface. Hence, callers should cache returned proxy objects. Second, if you call "destroy()" on a CP data structure proxy, that data structure is terminated on the underlying CP group and cannot be reinitialized until the CP group is force-destroyed. For this reason, please make sure that you are completely done with a CP data structure before destroying its proxy.
func NewSubsystem ¶
func NewSubsystem(ss *iserialization.Service, cif *cluster.ConnectionInvocationFactory, is *invocation.Service, l *logger.LogAdaptor) Subsystem
func (Subsystem) GetAtomicLong ¶
GetAtomicLong returns the distributed AtomicLong instance with given name.