counter

package
v0.10.9 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2022 License: Apache-2.0 Imports: 21 Imported by: 1

Documentation

Overview

Code generated by atomix-go-framework. DO NOT EDIT.

Code generated by atomix-go-framework. DO NOT EDIT.

Code generated by atomix-go-framework. DO NOT EDIT.

Index

Constants

View Source
const ServiceType gossip.ServiceType = "Counter"

Variables

View Source
var (
	ErrInvalidLengthState        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowState          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupState = fmt.Errorf("proto: unexpected end of group")
)

Functions

func RegisterServer

func RegisterServer(node *gossip.Node)

RegisterServer registers the primitive on the given node

func RegisterService

func RegisterService(node *gossip.Node)

RegisterService registers the service on the given node

Types

type CounterState

type CounterState struct {
	meta.ObjectMeta `protobuf:"bytes,1,opt,name=meta,proto3,embedded=meta" json:"meta"`
	Increments      map[string]int64 `` /* 162-byte string literal not displayed */
	Decrements      map[string]int64 `` /* 162-byte string literal not displayed */
}

func (*CounterState) Descriptor

func (*CounterState) Descriptor() ([]byte, []int)

func (*CounterState) GetDecrements

func (m *CounterState) GetDecrements() map[string]int64

func (*CounterState) GetIncrements

func (m *CounterState) GetIncrements() map[string]int64

func (*CounterState) Marshal

func (m *CounterState) Marshal() (dAtA []byte, err error)

func (*CounterState) MarshalTo

func (m *CounterState) MarshalTo(dAtA []byte) (int, error)

func (*CounterState) MarshalToSizedBuffer

func (m *CounterState) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*CounterState) ProtoMessage

func (*CounterState) ProtoMessage()

func (*CounterState) Reset

func (m *CounterState) Reset()

func (*CounterState) Size

func (m *CounterState) Size() (n int)

func (*CounterState) String

func (m *CounterState) String() string

func (*CounterState) Unmarshal

func (m *CounterState) Unmarshal(dAtA []byte) error

func (*CounterState) XXX_DiscardUnknown

func (m *CounterState) XXX_DiscardUnknown()

func (*CounterState) XXX_Marshal

func (m *CounterState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*CounterState) XXX_Merge

func (m *CounterState) XXX_Merge(src proto.Message)

func (*CounterState) XXX_Size

func (m *CounterState) XXX_Size() int

func (*CounterState) XXX_Unmarshal

func (m *CounterState) XXX_Unmarshal(b []byte) error

type GossipClient

type GossipClient interface {
	Bootstrap(ctx context.Context) (*CounterState, error)
	Repair(ctx context.Context, state *CounterState) (*CounterState, error)
	Advertise(ctx context.Context, state *CounterState) error
	Update(ctx context.Context, state *CounterState) error
}

type GossipEngine

type GossipEngine interface {
	// contains filtered or unexported methods
}

type GossipGroup

type GossipGroup interface {
	GossipClient
	MemberID() GossipMemberID
	Members() []GossipMember
	Member(GossipMemberID) GossipMember
}

type GossipHandler

type GossipHandler interface {
	Read(ctx context.Context) (*CounterState, error)
	Update(ctx context.Context, state *CounterState) error
}

type GossipMember

type GossipMember interface {
	GossipClient
	ID() GossipMemberID
	Client() *gossip.Peer
}

type GossipMemberID

type GossipMemberID gossip.PeerID

func (GossipMemberID) String

func (i GossipMemberID) String() string

type GossipProtocol

type GossipProtocol interface {
	Clock() atime.Clock
	Group() GossipGroup
	Server() GossipServer
}

type GossipServer

type GossipServer interface {
	Register(GossipHandler) error
	// contains filtered or unexported methods
}

type Server

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

func (*Server) Decrement

func (s *Server) Decrement(ctx context.Context, request *counter.DecrementRequest) (*counter.DecrementResponse, error)

func (*Server) Get

func (s *Server) Get(ctx context.Context, request *counter.GetRequest) (*counter.GetResponse, error)

func (*Server) Increment

func (s *Server) Increment(ctx context.Context, request *counter.IncrementRequest) (*counter.IncrementResponse, error)

func (*Server) Set

func (s *Server) Set(ctx context.Context, request *counter.SetRequest) (*counter.SetResponse, error)

type Service

type Service interface {
	gossip.Service
	Protocol() GossipProtocol
	// Set sets the counter value
	Set(context.Context, *counter.SetRequest) (*counter.SetResponse, error)
	// Get gets the current counter value
	Get(context.Context, *counter.GetRequest) (*counter.GetResponse, error)
	// Increment increments the counter value
	Increment(context.Context, *counter.IncrementRequest) (*counter.IncrementResponse, error)
	// Decrement decrements the counter value
	Decrement(context.Context, *counter.DecrementRequest) (*counter.DecrementResponse, error)
}

Jump to

Keyboard shortcuts

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