internal

package
v0.33.36-atree-util Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2024 License: AGPL-3.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type WrappedEntity

type WrappedEntity struct {
	flow.Entity
	// contains filtered or unexported fields
}

WrappedEntity is a wrapper around a flow.Entity that allows overriding the ID. The has 2 main use cases:

  • when the ID is expensive to compute, we can pre-compute it and use it for the cache
  • when caching an entity using a different ID than what's returned by ID(). For example, if there is a 1:1 mapping between a block and an entity, we can use the block ID as the cache key.

func NewWrappedEntity

func NewWrappedEntity(id flow.Identifier, entity flow.Entity) *WrappedEntity

NewWrappedEntity creates a new WrappedEntity

func (WrappedEntity) Checksum

func (w WrappedEntity) Checksum() flow.Identifier

Checksum returns th cached ID of the wrapped entity

func (WrappedEntity) ID

func (w WrappedEntity) ID() flow.Identifier

ID returns the cached ID of the wrapped entity

Jump to

Keyboard shortcuts

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