versionhistory

package
v1.26.2-121.2 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2024 License: MIT Imports: 4 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddAndSwitchVersionHistory added in v1.26.0

func AddAndSwitchVersionHistory(h *historyspb.VersionHistories, v *historyspb.VersionHistory) (bool, int32, error)

AddAndSwitchVersionHistory adds a VersionHistory and switch the current branch if necessary based on the Version of the last VersionHistoryItem. Returns:

  • if the current branch has been switched or not
  • the index of the newly added VersionHistory
  • error if any

This function should only be invoked in the event-based replication stack. In the state-based replication stack, a version history could be the current even if it has a smaller version compared to other version histories. This is because that version history could be associated with a state transition history with higher version.

func AddOrUpdateVersionHistoryItem

func AddOrUpdateVersionHistoryItem(v *historyspb.VersionHistory, item *historyspb.VersionHistoryItem) error

AddOrUpdateVersionHistoryItem updates the VersionHistory with new VersionHistoryItem.

func AddVersionHistory

func AddVersionHistory(h *historyspb.VersionHistories, v *historyspb.VersionHistory) (int32, error)

AddVersionHistory adds a VersionHistory to VersionHistories. Returns:

  • the index of the newly added VersionHistory
  • error if any

func CompareVersionHistory added in v1.23.0

func CompareVersionHistory(v1 *historyspb.VersionHistory, v2 *historyspb.VersionHistory) (int, error)

CompareVersionHistory compares 2 version history items

func CompareVersionHistoryItem added in v1.23.0

func CompareVersionHistoryItem(item1 *historyspb.VersionHistoryItem, item2 *historyspb.VersionHistoryItem) int

CompareVersionHistoryItem compares 2 version history items

func ContainsVersionHistoryItem

func ContainsVersionHistoryItem(v *historyspb.VersionHistory, item *historyspb.VersionHistoryItem) bool

ContainsVersionHistoryItem check whether VersionHistory has given VersionHistoryItem.

func CopyVersionHistories

func CopyVersionHistories(h *historyspb.VersionHistories) *historyspb.VersionHistories

Copy VersionHistories.

func CopyVersionHistory

func CopyVersionHistory(v *historyspb.VersionHistory) *historyspb.VersionHistory

CopyVersionHistory copies VersionHistory.

func CopyVersionHistoryItem added in v1.4.0

func CopyVersionHistoryItem(item *historyspb.VersionHistoryItem) *historyspb.VersionHistoryItem

CopyVersionHistoryItem create a new instance of VersionHistoryItem.

func CopyVersionHistoryItems added in v1.26.0

func CopyVersionHistoryItems(items []*historyspb.VersionHistoryItem) []*historyspb.VersionHistoryItem

func CopyVersionHistoryUntilLCAVersionHistoryItem

func CopyVersionHistoryUntilLCAVersionHistoryItem(v *historyspb.VersionHistory, lcaItem *historyspb.VersionHistoryItem) (*historyspb.VersionHistory, error)

CopyVersionHistoryUntilLCAVersionHistoryItem returns copy of VersionHistory up until LCA item.

func FindFirstVersionHistoryIndexByVersionHistoryItem

func FindFirstVersionHistoryIndexByVersionHistoryItem(h *historyspb.VersionHistories, item *historyspb.VersionHistoryItem) (int32, error)

FindFirstVersionHistoryIndexByVersionHistoryItem find the first VersionHistory index which contains the given version history item.

func FindLCAVersionHistoryItem

func FindLCAVersionHistoryItem(v *historyspb.VersionHistory, remote *historyspb.VersionHistory) (*historyspb.VersionHistoryItem, error)

FindLCAVersionHistoryItem returns the lowest common ancestor VersionHistoryItem.

func FindLCAVersionHistoryItemAndIndex

func FindLCAVersionHistoryItemAndIndex(h *historyspb.VersionHistories, incomingHistory *historyspb.VersionHistory) (*historyspb.VersionHistoryItem, int32, error)

FindLCAVersionHistoryItemAndIndex finds the lowest common ancestor VersionHistory index and corresponding item.

func FindLCAVersionHistoryItemFromItemSlice added in v1.23.0

func FindLCAVersionHistoryItemFromItemSlice(versionHistoryItemsA []*historyspb.VersionHistoryItem, versionHistoryItemsB []*historyspb.VersionHistoryItem) (*historyspb.VersionHistoryItem, error)

func GetCurrentVersionHistory

func GetCurrentVersionHistory(h *historyspb.VersionHistories) (*historyspb.VersionHistory, error)

GetCurrentVersionHistory gets the current VersionHistory.

func GetFirstVersionHistoryItem

func GetFirstVersionHistoryItem(v *historyspb.VersionHistory) (*historyspb.VersionHistoryItem, error)

GetFirstVersionHistoryItem return the first VersionHistoryItem.

func GetLastVersionHistoryItem

func GetLastVersionHistoryItem(v *historyspb.VersionHistory) (*historyspb.VersionHistoryItem, error)

GetLastVersionHistoryItem return the last VersionHistoryItem.

func GetVersionHistory

func GetVersionHistory(h *historyspb.VersionHistories, index int32) (*historyspb.VersionHistory, error)

GetVersionHistory gets the VersionHistory according to index provided.

func GetVersionHistoryEventVersion

func GetVersionHistoryEventVersion(v *historyspb.VersionHistory, eventID int64) (int64, error)

GetVersionHistoryEventVersion return the corresponding event version of an event ID.

func IsEmptyVersionHistory

func IsEmptyVersionHistory(v *historyspb.VersionHistory) bool

IsEmptyVersionHistory indicate whether version history is empty

func IsEqualVersionHistoryItem added in v1.4.0

func IsEqualVersionHistoryItem(item1 *historyspb.VersionHistoryItem, item2 *historyspb.VersionHistoryItem) bool

IsEqualVersionHistoryItem checks whether version history items are equal

func IsEqualVersionHistoryItems added in v1.23.0

func IsEqualVersionHistoryItems(items1 []*historyspb.VersionHistoryItem, items2 []*historyspb.VersionHistoryItem) bool

IsEqualVersionHistoryItems checks whether version history items are equal

func IsLCAVersionHistoryItemAppendable

func IsLCAVersionHistoryItemAppendable(v *historyspb.VersionHistory, lcaItem *historyspb.VersionHistoryItem) bool

IsLCAVersionHistoryItemAppendable checks if a LCA VersionHistoryItem is appendable.

func IsVersionHistoryItemsInSameBranch added in v1.23.0

func IsVersionHistoryItemsInSameBranch(versionHistoryItemsA []*historyspb.VersionHistoryItem, versionHistoryItemsB []*historyspb.VersionHistoryItem) bool

IsVersionHistoryItemsInSameBranch checks if two version history items are in the same branch

func NewVersionHistories

func NewVersionHistories(versionHistory *historyspb.VersionHistory) *historyspb.VersionHistories

NewVersionHistories create a new instance of VersionHistories.

func NewVersionHistory

func NewVersionHistory(branchToken []byte, items []*historyspb.VersionHistoryItem) *historyspb.VersionHistory

NewVersionHistory create a new instance of VersionHistory.

func NewVersionHistoryItem

func NewVersionHistoryItem(eventID int64, version int64) *historyspb.VersionHistoryItem

NewVersionHistoryItem create a new instance of VersionHistoryItem.

func SetCurrentVersionHistoryIndex

func SetCurrentVersionHistoryIndex(h *historyspb.VersionHistories, currentVersionHistoryIndex int32) error

SetCurrentVersionHistoryIndex set the current VersionHistory index.

func SetVersionHistoryBranchToken

func SetVersionHistoryBranchToken(v *historyspb.VersionHistory, branchToken []byte)

SetVersionHistoryBranchToken sets the branch token.

func SplitVersionHistoryByLastLocalGeneratedItem added in v1.24.0

func SplitVersionHistoryByLastLocalGeneratedItem(
	versionHistoryItems []*historyspb.VersionHistoryItem,
	initialFailoverVersion int64,
	failoverVersionIncrement int64,
) (localItems []*historyspb.VersionHistoryItem, remoteItems []*historyspb.VersionHistoryItem)

Types

This section is empty.

Jump to

Keyboard shortcuts

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