shadow

package
v0.0.0-...-c6a7f1f Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2022 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BalanceStrategyCoPartitioned

type BalanceStrategyCoPartitioned struct{}

func (*BalanceStrategyCoPartitioned) Name

func (strat *BalanceStrategyCoPartitioned) Name() string

func (*BalanceStrategyCoPartitioned) Plan

type DeviceState

type DeviceState struct {
	ID    string
	State DeviceStateMessage
}

TODO maybe use / embed DeviceStateMessage here - including Timestamp

type DeviceStateMessage

type DeviceStateMessage struct {
	Version   uint64
	State     json.RawMessage
	Timestamp time.Time
}

type Repo

type Repo interface {
	SetReported(DeviceState) (err error)
	GetReported(id string) (DeviceState, error)
	SetDesired(DeviceState) (err error)
	GetDesired(id string) (DeviceState, error)
}

func NewRedisRepo

func NewRedisRepo(addr string) (Repo, error)

type Server

type Server struct {
	shadowpb.UnimplementedShadowsServer

	Repo         Repo
	Producer     sarama.SyncProducer // Sync producer, we want to guarantee execution
	ProduceTopic string
	Log          *zap.Logger

	PubSub *pubsub.PubSub
}

Server is a data strcuture for shadow server

func (*Server) Get

func (s *Server) Get(context context.Context, request *shadowpb.GetRequest) (response *shadowpb.GetResponse, err error)

Get is a method to get a device state

func (*Server) PatchDesiredState

func (s *Server) PatchDesiredState(context context.Context, request *shadowpb.PatchDesiredStateRequest) (response *shadowpb.PatchDesiredStateResponse, err error)

PatchDesiredState is a method to patch a message to a device state

func (*Server) StreamReportedStateChanges

StreamReportedStateChanges is a method to start streaming of data from a device

type StateMerger

type StateMerger struct {
	SourceTopic    string // Incoming ticks
	MergedTopic    string // Full state with version
	RealDeltaTopic string // Deltas for each full state transition, with version

	ChangelogConsumerClient sarama.Client
	ChangelogProducerClient sarama.Client
	// contains filtered or unexported fields
}

func (*StateMerger) Cleanup

func (*StateMerger) ConsumeClaim

func (*StateMerger) Setup

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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