sequences

package
v0.8.2 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2026 License: MIT Imports: 6 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DeleteResourcesSeq = cldfops.NewSequence(
	"datastore-delete-resources",
	semver.MustParse("1.0.0"),
	"Stage deletions of address refs, contract metadata, and chain metadata from the Datastore",
	func(b cldfops.Bundle, deps DeleteResourcesSeqDeps, input DeleteResourcesSeqInput) (DeleteResourcesSeqOutput, error) {
		addressRefReport, err := cldfops.ExecuteOperation(
			b,
			datastoreops.DeleteAddressRefOp,
			datastoreops.DeleteAddressRefDeps{DataStore: deps.DataStore},
			datastoreops.DeleteAddressRefInput{AddressRefKeys: input.AddressRefKeys},
		)
		if err != nil {
			return DeleteResourcesSeqOutput{}, fmt.Errorf("failed to delete address refs: %w", err)
		}

		contractMetadataReport, err := cldfops.ExecuteOperation(
			b,
			datastoreops.DeleteContractMetadataOp,
			datastoreops.DeleteContractMetadataDeps{DataStore: addressRefReport.Output.DataStore.Seal()},
			datastoreops.DeleteContractMetadataInput{ContractMetadataKeys: input.ContractMetadataKeys},
		)
		if err != nil {
			return DeleteResourcesSeqOutput{}, fmt.Errorf("failed to delete contract metadata: %w", err)
		}

		chainMetadataReport, err := cldfops.ExecuteOperation(
			b,
			datastoreops.DeleteChainMetadataOp,
			datastoreops.DeleteChainMetadataDeps{DataStore: contractMetadataReport.Output.DataStore.Seal()},
			datastoreops.DeleteChainMetadataInput{ChainMetadataKeys: input.ChainMetadataKeys},
		)
		if err != nil {
			return DeleteResourcesSeqOutput{}, fmt.Errorf("failed to delete chain metadata: %w", err)
		}

		b.Logger.Infow("Datastore resources successfully staged for deletion")

		return DeleteResourcesSeqOutput{DataStore: chainMetadataReport.Output.DataStore}, nil
	},
)

DeleteResourcesSeq stages deletions across address refs, contract metadata, and chain metadata by composing the corresponding per-resource delete operations. Empty slices skip the corresponding resource type within each operation. Staged deletions are not applied immediately; they are recorded in the Datastore and executed during the post-changeset merge phase.

Functions

This section is empty.

Types

type DeleteResourcesSeqDeps

type DeleteResourcesSeqDeps struct {
	DataStore cldfdatastore.DataStore
}

DeleteResourcesSeqDeps holds non-serializable dependencies for the DeleteResourcesSeq sequence.

type DeleteResourcesSeqInput

type DeleteResourcesSeqInput struct {
	AddressRefKeys       []keys.AddressRefKey       `json:"addressRefKeys"`
	ContractMetadataKeys []keys.ContractMetadataKey `json:"contractMetadataKeys"`
	ChainMetadataKeys    []keys.ChainMetadataKey    `json:"chainMetadataKeys"`
}

DeleteResourcesSeqInput is the serializable input of a DeleteResourcesSeq invocation.

type DeleteResourcesSeqOutput

type DeleteResourcesSeqOutput struct {
	DataStore cldfdatastore.MutableDataStore
}

DeleteResourcesSeqOutput is the serializable output of a DeleteResourcesSeq invocation.

Jump to

Keyboard shortcuts

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