parti

package
v1.0.1-0...-336119c Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2023 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cluster

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

Cluster represents the cluster node

func NewCluster

func NewCluster(ctx context.Context,
	raftPort uint16,
	discovery discovery.Provider,
	writeClient cospb.WriteSideHandlerServiceClient,
	journalStore storage.LegacyJournalStore,
	partitionsCount int,
	logger log.Logger,
	logLevel log.Level) *Cluster

NewCluster creates an instance of Cluster

func (*Cluster) SendCommand

func (n *Cluster) SendCommand(ctx context.Context, command *partiv1.SendRequest) (*local.StateWrapper, error)

SendCommand sends a command to the cluster

func (*Cluster) Start

func (n *Cluster) Start(ctx context.Context) error

Start starts the cluster node

func (*Cluster) Stop

func (n *Cluster) Stop(ctx context.Context) error

Stop stops the cluster node

type Entity

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

Entity represents each persistence entity

func NewEntity

func NewEntity(entityID string,
	partition uint32,
	writeClient cospb.WriteSideHandlerServiceClient,
	journalStore storage.LegacyJournalStore,
	logger log.Logger) *Entity

NewEntity creates an instance of Entity

func (*Entity) Process

func (e *Entity) Process(ctx context.Context, msg *local.EntityMessage) (resp *local.StateWrapper, err error)

Process a single message for this entity

func (*Entity) Shutdown

func (e *Entity) Shutdown(ctx context.Context) error

Shutdown the entity

func (*Entity) Start

func (e *Entity) Start(ctx context.Context) error

Start the entity by setting its initial state

type EntityFactory

type EntityFactory func(entityID string) *Entity

EntityFactory generates a new entity for the entity store

type EntityStore

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

EntityStore manges entities, creating, caching, and passivating them

func NewEntityStore

func NewEntityStore(factory EntityFactory, logger log.Logger) *EntityStore

NewEntityStore creates an instance of EntityStore

func (*EntityStore) GetOrCreate

func (e *EntityStore) GetOrCreate(ctx context.Context, entityID string) (*Entity, error)

GetOrCreate retrieves an entity or generates one with the provided factory

func (*EntityStore) Shutdown

func (e *EntityStore) Shutdown(ctx context.Context) error

Shutdown all entities in this store

type Handler

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

Handler handles the lifecycle of a given partition and how the given partition processes messages sent to it

func NewHandler

func NewHandler(writeClient cospb.WriteSideHandlerServiceClient, journalStore storage.LegacyJournalStore, logger log.Logger) *Handler

NewHandler creates an instance of Handler

func (*Handler) Handle

func (e *Handler) Handle(ctx context.Context, partitionID uint32, msg *anypb.Any) (*anypb.Any, error)

Handle a message for a given partition

func (*Handler) ShutdownPartition

func (e *Handler) ShutdownPartition(ctx context.Context, partitionID uint32) error

ShutdownPartition shuts down the partition on this node

func (*Handler) StartPartition

func (e *Handler) StartPartition(ctx context.Context, partitionID uint32) error

StartPartition boots a given partition on this node

type Partition

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

Partition manages messages and entities for a single partition

func NewPartition

func NewPartition(ctx context.Context, id uint32,
	logger log.Logger,
	writeClient cospb.WriteSideHandlerServiceClient,
	journalStore storage.LegacyJournalStore) *Partition

NewPartition returns a new partition

func (*Partition) Process

func (p *Partition) Process(ctx context.Context, msg *local.EntityMessage) <-chan *Response

Process enqueues a message to be processed

func (*Partition) Stop

func (p *Partition) Stop(ctx context.Context) error

Stop shuts down this partition and all actors

type PartitionMsg

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

type Response

type Response struct {
	Msg proto.Message
	Err error
}

Jump to

Keyboard shortcuts

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