syncstate

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Archive

func Archive(client dynamodb.PutItemAPI, syncState SyncStateRow) error

Archive will take the current item and duplicate it with a new sort key. This creates a unique item every time it is called, so can be used to save older copies of this row as it is mutated over time in order to preserve history.

func GetDataType

func GetDataType() types.DataType

func GetSyncStateExpiresAfter

func GetSyncStateExpiresAfter(timeProvider clock.TimeProvider) int64

func UpdatePostflightDate

func UpdatePostflightDate(timeProvider clock.TimeProvider, client dynamodb.UpdateItemAPI, machineID string) (err error)

func UpdateRuledownloadFinishedAt

func UpdateRuledownloadFinishedAt(timeProvider clock.TimeProvider, client dynamodb.UpdateItemAPI, machineID string) (err error)

func UpdateRuledownloadStartedAt

func UpdateRuledownloadStartedAt(timeProvider clock.TimeProvider, client dynamodb.UpdateItemAPI, machineID string) (err error)

Types

type SyncState

type SyncState struct {
	MachineID              string         `dynamodbav:"MachineID"`
	BatchSize              int            `dynamodbav:"BatchSize"`
	CleanSync              bool           `dynamodbav:"CleanSync"`
	LastCleanSync          string         `dynamodbav:"LastCleanSync"`
	FeedSyncCursor         string         `dynamodbav:"FeedSyncCursor"`
	PreflightAt            string         `dynamodbav:"PreflightAt"`
	RuledownloadStartedAt  string         `dynamodbav:"RuledownloadStartedAt"`
	RuledownloadFinishedAt string         `dynamodbav:"RuledownloadFinishedAt"`
	PostflightAt           string         `dynamodbav:"PostflightAt"`
	ExpiresAfter           int64          `dynamodbav:"ExpiresAfter,omitempty"`
	DataType               types.DataType `dynamodbav:"DataType"`
}

SyncState encapulsates data within the sync state row that's not the Primary key

type SyncStateRow

type SyncStateRow struct {
	dynamodb.PrimaryKey
	SyncState
}

SyncStateRow persists the sync state to the database

func CreateNewSyncState

func CreateNewSyncState(
	timeProvider clock.TimeProvider,
	machineID string,
	requestCleanSync bool,
	lastCleanSync string,
	batchSize int,
	feedSyncCursor string,
) SyncStateRow

func GetByMachineID

func GetByMachineID(client dynamodb.GetItemAPI, machineID string) (syncState *SyncStateRow, err error)

Returns the machine's current sync state

type UpdatePostflightItem

type UpdatePostflightItem struct {
	PostflightAt   string `dynamodbav:"PostflightAt"`
	FeedSyncCursor string `dynamodbav:"FeedSyncCursor"`
	ExpiresAfter   int64  `dynamodbav:"ExpiresAfter,omitempty"`
}

Update fragments

Jump to

Keyboard shortcuts

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