history

package
v0.0.0-...-004ac53 Latest Latest
Warning

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

Go to latest
Published: May 15, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Provides structure for API dump history.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Actions

func Actions(update *Update) []diff.Action

Returns the changes of an update as a list of actions.

func SortChanges

func SortChanges(changes []*Change)

Sorts a list of change IDs by the corresponding date.

func VisitTags

func VisitTags(hist *Root, visit func(tag string) (next string, ok bool))

Visits tags within a history.Root. If ok is true, then the tag will be updated to next.

Types

type Change

type Change struct {
	// The index of the update in Root.Update that caused this change.
	Update *Update
	// The change that occurred.
	Action diff.Action
	// The previous values before the change was made.
	Prev rbxdump.Fields
}

Represents one unit of change.

type Cursor

type Cursor struct {
	Target *Update
	Dump   *rbxdump.Root
}

Uses an update chain to generate an in-place API dump.

func (*Cursor) Roll

func (c *Cursor) Roll(target *Update) bool

Rolls the cursor's current target forward or backward until it hits target. Returns false if target is nil, or target is not in the chain of c.Target. If c.Target is nil, the cursor rolls from the start of target's chain, until it reaches target. If true is returned, then c.Dump has been patched to represent the state of the target update.

type Object

type Object struct {
	// Maps class ID to changes.
	Class map[id.Class][]*Change
	// Maps member ID to changes.
	Member map[id.MemberID][]*Change
	// Maps enum ID to changes.
	Enum map[id.Enum][]*Change
	// Maps enum item ID to changes.
	EnumItem map[id.EnumItemID][]*Change
	// Maps type ID to type references.
	Type map[id.Type][]*TypeRef
}

Maps an object to a list of changes that apply to the object.

type Root

type Root struct {
	// Objects per type.
	Object Object
	// List of all changes.
	Change []*Change
	// List of all updates.
	Update []*Update
}

Entrypoint to history structure.

func NewRoot

func NewRoot() *Root

Returns a new Root with initialized fields.

func (*Root) AppendUpdate

func (r *Root) AppendUpdate(build archive.Build, actions []diff.Action, prevRoot *rbxdump.Root)

Appends an update derived from the given build and actions. The latest update is assumed to be the previous.

All maps in the Root are expected to be non-nil.

func (Root) EarliestUpdate

func (r Root) EarliestUpdate() (update *Update)

Returns the earliest update, or zero if there are no updates.

func (Root) LatestUpdate

func (r Root) LatestUpdate() (update *Update)

Returns the latest update, or zero if there are no updates.

func (*Root) MarshalJSON

func (r *Root) MarshalJSON() (b []byte, err error)

func (*Root) UnmarshalJSON

func (r *Root) UnmarshalJSON(b []byte) error

func (Root) UpdateRange

func (r Root) UpdateRange(start, end time.Time) (updates []*Update)

Returns an ordered list of updates occurring after or at start and ending before end. If an endpoint is zero, then it is not compared. If both are zero, then all updates are returned.

type TypeRef

type TypeRef struct {
	Change *Change      // The associated change.
	Prev   bool         // true: Change.Prev; false: Change.Action.Fields.
	Field  string       // Index of Fields.
	Type   string       // Type: rbxdump.Type; Parameter: rbxdump.Parameter.
	Index  int          // Index within slice value. -1: Not a slice.
	Value  rbxdump.Type // The type itself.
}

Refers to a Type that appears within a Change.

type Update

type Update struct {
	// The previous update, from which this update's changes were based on. May
	// be nil.
	Prev *Update
	// The next update. May be nil.
	Next *Update
	// Time when the update occurred.
	Date time.Time
	// Version ID string (version-0123456789abcdef).
	GUID string
	// Version number.
	Version rbxver.Version
	// List of changes that occurred during the update.
	Changes []*Change
}

Represents an update that caused a number of changes.

Jump to

Keyboard shortcuts

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