operations

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: May 7, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CreateChainMetadataOp = cldfops.NewOperation(
	"catalog-create-chain-metadata",
	semver.MustParse("1.0.0"),
	"Add chain metadata entries to the Catalog service",
	func(b cldfops.Bundle, deps CreateChainMetadataDeps, input CreateChainMetadataInput) (CreateChainMetadataOutput, error) {
		dataStore := cldfdatastore.NewMemoryDataStore()
		err := dataStore.Merge(deps.DataStore)
		if err != nil {
			return CreateChainMetadataOutput{}, fmt.Errorf("failed to create memory data store: %w", err)
		}

		for i, item := range input.ChainMetadata {
			err = dataStore.ChainMetadata().Add(item)
			if err != nil {
				return CreateChainMetadataOutput{}, fmt.Errorf("failed to create chain metadata entry %d in catalog store: %w", i, err)
			}
		}

		b.Logger.Infow("Catalog ChainMetadata created successfully")

		return CreateChainMetadataOutput{DataStore: dataStore}, nil
	},
)

CreateChainMetadataOp creates chain metadata entries in the Catalog service.

View Source
var CreateContractMetadataOp = cldfops.NewOperation(
	"catalog-create-contract-metadata",
	semver.MustParse("1.0.0"),
	"Add contract metadata entries to the Catalog service",
	func(b cldfops.Bundle, deps CreateContractMetadataDeps, input CreateContractMetadataInput) (CreateContractMetadataOutput, error) {
		dataStore := cldfdatastore.NewMemoryDataStore()
		err := dataStore.Merge(deps.DataStore)
		if err != nil {
			return CreateContractMetadataOutput{}, fmt.Errorf("failed to create memory data store: %w", err)
		}

		for i, item := range input.ContractMetadata {
			err = dataStore.ContractMetadata().Add(item)
			if err != nil {
				return CreateContractMetadataOutput{}, fmt.Errorf("failed to create contract metadata entry %d in catalog store: %w", i, err)
			}
		}

		b.Logger.Infow("Catalog ContractMetadata created successfully")

		return CreateContractMetadataOutput{DataStore: dataStore}, nil
	},
)

CreateContractMetadataOp creates contract metadata entries in the Catalog service.

View Source
var UpdateChainMetadataOp = cldfops.NewOperation(
	"catalog-update-chain-metadata",
	semver.MustParse("1.0.0"),
	"Update chain metadata entries in the Catalog service",
	func(b cldfops.Bundle, deps UpdateChainMetadataDeps, input UpdateChainMetadataInput) (UpdateChainMetadataOutput, error) {
		dataStore := cldfdatastore.NewMemoryDataStore()
		err := dataStore.Merge(deps.DataStore)
		if err != nil {
			return UpdateChainMetadataOutput{}, fmt.Errorf("failed to create memory data store: %w", err)
		}

		for i, item := range input.ChainMetadata {
			err = dataStore.ChainMetadata().Update(item)
			if err != nil {
				return UpdateChainMetadataOutput{}, fmt.Errorf("failed to update chain metadata entry %d in catalog store: %w", i, err)
			}
		}

		b.Logger.Infow("Catalog ChainMetadata updated successfully")

		return UpdateChainMetadataOutput{DataStore: dataStore}, nil
	},
)

UpdateChainMetadataOp updates existing chain metadata entries in the Catalog service.

View Source
var UpdateContractMetadataOp = cldfops.NewOperation(
	"catalog-update-contract-metadata",
	semver.MustParse("1.0.0"),
	"Update contract metadata entries in the Catalog service",
	func(b cldfops.Bundle, deps UpdateContractMetadataDeps, input UpdateContractMetadataInput) (UpdateContractMetadataOutput, error) {
		dataStore := cldfdatastore.NewMemoryDataStore()
		err := dataStore.Merge(deps.DataStore)
		if err != nil {
			return UpdateContractMetadataOutput{}, fmt.Errorf("failed to create memory data store: %w", err)
		}

		for i, item := range input.ContractMetadata {
			err = dataStore.ContractMetadata().Update(item)
			if err != nil {
				return UpdateContractMetadataOutput{}, fmt.Errorf("failed to update contract metadata entry %d in catalog store: %w", i, err)
			}
		}

		b.Logger.Infow("Catalog ContractMetadata updated successfully")

		return UpdateContractMetadataOutput{DataStore: dataStore}, nil
	},
)

UpdateContractMetadataOp updates existing contract metadata entries in the Catalog service.

Functions

This section is empty.

Types

type CreateChainMetadataDeps

type CreateChainMetadataDeps struct {
	DataStore cldfdatastore.DataStore
}

CreateChainMetadataDeps holds non-serializable dependencies for the CreateChainMetadataOp operation.

type CreateChainMetadataInput

type CreateChainMetadataInput struct {
	ChainMetadata []cldfdatastore.ChainMetadata
}

CreateChainMetadataInput is the serializable input of a CreateChainMetadataOp invocation.

type CreateChainMetadataOutput

type CreateChainMetadataOutput struct {
	DataStore cldfdatastore.MutableDataStore
}

CreateChainMetadataOutput is the serializable output of a CreateChainMetadataOp invocation.

type CreateContractMetadataDeps

type CreateContractMetadataDeps struct {
	DataStore cldfdatastore.DataStore
}

CreateContractMetadataDeps holds non-serializable dependencies for the CreateContractMetadataOp operation.

type CreateContractMetadataInput

type CreateContractMetadataInput struct {
	ContractMetadata []cldfdatastore.ContractMetadata
}

CreateContractMetadataInput is the serializable input of a CreateContractMetadataOp invocation.

type CreateContractMetadataOutput

type CreateContractMetadataOutput struct {
	DataStore cldfdatastore.MutableDataStore
}

CreateContractMetadataOutput is the serializable output of a CreateContractMetadataOp invocation.

type UpdateChainMetadataDeps added in v0.2.0

type UpdateChainMetadataDeps struct {
	DataStore cldfdatastore.DataStore
}

UpdateChainMetadataDeps holds non-serializable dependencies for the UpdateChainMetadataOp operation.

type UpdateChainMetadataInput added in v0.2.0

type UpdateChainMetadataInput struct {
	ChainMetadata []cldfdatastore.ChainMetadata
}

UpdateChainMetadataInput is the serializable input of an UpdateChainMetadataOp invocation.

type UpdateChainMetadataOutput added in v0.2.0

type UpdateChainMetadataOutput struct {
	DataStore cldfdatastore.MutableDataStore
}

UpdateChainMetadataOutput is the serializable output of an UpdateChainMetadataOp invocation.

type UpdateContractMetadataDeps added in v0.2.0

type UpdateContractMetadataDeps struct {
	DataStore cldfdatastore.DataStore
}

UpdateContractMetadataDeps holds non-serializable dependencies for the UpdateContractMetadataOp operation.

type UpdateContractMetadataInput added in v0.2.0

type UpdateContractMetadataInput struct {
	ContractMetadata []cldfdatastore.ContractMetadata
}

UpdateContractMetadataInput is the serializable input of an UpdateContractMetadataOp invocation.

type UpdateContractMetadataOutput added in v0.2.0

type UpdateContractMetadataOutput struct {
	DataStore cldfdatastore.MutableDataStore
}

UpdateContractMetadataOutput is the serializable output of an UpdateContractMetadataOp invocation.

Jump to

Keyboard shortcuts

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