operations

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CreateAddressRefOp = cldfops.NewOperation(
	"datastore-create-address-ref",
	semver.MustParse("1.0.0"),
	"Add address ref entries to the Datastore",
	func(b cldfops.Bundle, deps CreateAddressRefDeps, input CreateAddressRefInput) (CreateAddressRefOutput, error) {
		dataStore := cldfdatastore.NewMemoryDataStore()
		err := dataStore.Merge(deps.DataStore)
		if err != nil {
			return CreateAddressRefOutput{}, fmt.Errorf("failed to create memory data store: %w", err)
		}

		for i, item := range input.AddressRefs {
			err = dataStore.Addresses().Add(item)
			if err != nil {
				return CreateAddressRefOutput{}, fmt.Errorf("failed to create address ref entry %d in datastore: %w", i, err)
			}
		}

		b.Logger.Infow("Datastore AddressRef created successfully")

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

CreateAddressRefOp creates address ref entries in the Datastore.

View Source
var CreateChainMetadataOp = cldfops.NewOperation(
	"datastore-create-chain-metadata",
	semver.MustParse("1.0.0"),
	"Add chain metadata entries to the Datastore",
	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 datastore: %w", i, err)
			}
		}

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

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

CreateChainMetadataOp creates chain metadata entries in the Datastore.

View Source
var CreateContractMetadataOp = cldfops.NewOperation(
	"datastore-create-contract-metadata",
	semver.MustParse("1.0.0"),
	"Add contract metadata entries to the Datastore",
	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 datastore: %w", i, err)
			}
		}

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

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

CreateContractMetadataOp creates contract metadata entries in the Datastore.

View Source
var DeleteAddressRefOp = cldfops.NewOperation(
	"datastore-delete-address-ref",
	semver.MustParse("1.0.0"),
	"Delete address ref entries from the Datastore",
	func(b cldfops.Bundle, deps DeleteAddressRefDeps, input DeleteAddressRefInput) (DeleteAddressRefOutput, error) {
		dataStore := cldfdatastore.NewMemoryDataStore()
		err := dataStore.Merge(deps.DataStore)
		if err != nil {
			return DeleteAddressRefOutput{}, fmt.Errorf("failed to create memory data store: %w", err)
		}

		for i, key := range input.AddressRefKeys {
			err = dataStore.Addresses().RemoteDelete(key)
			if err != nil {
				return DeleteAddressRefOutput{}, fmt.Errorf("failed to delete address ref entry %d in datastore: %w", i, err)
			}
		}

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

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

DeleteAddressRefOp deletes address ref entries from the Datastore.

View Source
var DeleteChainMetadataOp = cldfops.NewOperation(
	"datastore-delete-chain-metadata",
	semver.MustParse("1.0.0"),
	"Delete chain metadata entries from the Datastore",
	func(b cldfops.Bundle, deps DeleteChainMetadataDeps, input DeleteChainMetadataInput) (DeleteChainMetadataOutput, error) {
		dataStore := cldfdatastore.NewMemoryDataStore()
		err := dataStore.Merge(deps.DataStore)
		if err != nil {
			return DeleteChainMetadataOutput{}, fmt.Errorf("failed to create memory data store: %w", err)
		}

		for i, key := range input.ChainMetadataKeys {
			err = dataStore.ChainMetadata().RemoteDelete(key)
			if err != nil {
				return DeleteChainMetadataOutput{}, fmt.Errorf("failed to delete chain metadata entry %d in datastore: %w", i, err)
			}
		}

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

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

DeleteChainMetadataOp deletes chain metadata entries from the Datastore.

View Source
var DeleteContractMetadataOp = cldfops.NewOperation(
	"datastore-delete-contract-metadata",
	semver.MustParse("1.0.0"),
	"Delete contract metadata entries from the Datastore",
	func(b cldfops.Bundle, deps DeleteContractMetadataDeps, input DeleteContractMetadataInput) (DeleteContractMetadataOutput, error) {
		dataStore := cldfdatastore.NewMemoryDataStore()
		err := dataStore.Merge(deps.DataStore)
		if err != nil {
			return DeleteContractMetadataOutput{}, fmt.Errorf("failed to create memory data store: %w", err)
		}

		for i, key := range input.ContractMetadataKeys {
			err = dataStore.ContractMetadata().RemoteDelete(key)
			if err != nil {
				return DeleteContractMetadataOutput{}, fmt.Errorf("failed to delete contract metadata entry %d in datastore: %w", i, err)
			}
		}

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

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

DeleteContractMetadataOp deletes contract metadata entries from the Datastore.

View Source
var UpdateAddressRefOp = cldfops.NewOperation(
	"datastore-update-address-ref",
	semver.MustParse("1.0.0"),
	"Update address ref entries in the Datastore",
	func(b cldfops.Bundle, deps UpdateAddressRefDeps, input UpdateAddressRefInput) (UpdateAddressRefOutput, error) {
		dataStore := cldfdatastore.NewMemoryDataStore()
		err := dataStore.Merge(deps.DataStore)
		if err != nil {
			return UpdateAddressRefOutput{}, fmt.Errorf("failed to create memory data store: %w", err)
		}

		for i, item := range input.AddressRefs {
			err = dataStore.Addresses().Update(item)
			if err != nil {
				return UpdateAddressRefOutput{}, fmt.Errorf("failed to update address ref entry %d in datastore: %w", i, err)
			}
		}

		b.Logger.Infow("Datastore AddressRef updated successfully")

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

UpdateAddressRefOp updates existing address ref entries in the Datastore.

View Source
var UpdateChainMetadataOp = cldfops.NewOperation(
	"datastore-update-chain-metadata",
	semver.MustParse("1.0.0"),
	"Update chain metadata entries in the Datastore",
	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 datastore: %w", i, err)
			}
		}

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

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

UpdateChainMetadataOp updates existing chain metadata entries in the Datastore.

View Source
var UpdateContractMetadataOp = cldfops.NewOperation(
	"datastore-update-contract-metadata",
	semver.MustParse("1.0.0"),
	"Update contract metadata entries in the Datastore",
	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 datastore: %w", i, err)
			}
		}

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

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

UpdateContractMetadataOp updates existing contract metadata entries in the Datastore.

View Source
var UpdateEnvMetadataOp = cldfops.NewOperation(
	"datastore-update-env-metadata",
	semver.MustParse("1.0.0"),
	"Update env metadata entries in the Datastore",
	func(b cldfops.Bundle, deps UpdateEnvMetadataDeps, input UpdateEnvMetadataInput) (UpdateEnvMetadataOutput, error) {
		dataStore := cldfdatastore.NewMemoryDataStore()
		err := dataStore.Merge(deps.DataStore)
		if err != nil {
			return UpdateEnvMetadataOutput{}, fmt.Errorf("failed to create memory data store: %w", err)
		}

		err = dataStore.EnvMetadata().Set(input.EnvMetadata)
		if err != nil {
			return UpdateEnvMetadataOutput{}, fmt.Errorf("failed to update env metadata in datastore: %w", err)
		}

		b.Logger.Infow("Datastore EnvMetadata updated successfully")

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

UpdateEnvMetadataOp updates existing env metadata entries in the Datastore.

Functions

This section is empty.

Types

type CreateAddressRefDeps

type CreateAddressRefDeps struct {
	DataStore cldfdatastore.DataStore
}

CreateAddressRefDeps holds non-serializable dependencies for the CreateAddressRefOp operation.

type CreateAddressRefInput

type CreateAddressRefInput struct {
	AddressRefs []cldfdatastore.AddressRef
}

CreateAddressRefInput is the serializable input of a CreateAddressRefOp invocation.

type CreateAddressRefOutput

type CreateAddressRefOutput struct {
	DataStore cldfdatastore.MutableDataStore
}

CreateAddressRefOutput is the serializable output of a CreateAddressRefOp invocation.

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 DeleteAddressRefDeps

type DeleteAddressRefDeps struct {
	DataStore cldfdatastore.DataStore
}

DeleteAddressRefDeps holds non-serializable dependencies for the DeleteAddressRefOp operation.

type DeleteAddressRefInput

type DeleteAddressRefInput struct {
	AddressRefKeys []cldfdatastore.AddressRefKey
}

DeleteAddressRefInput is the serializable input of a DeleteAddressRefOp invocation.

type DeleteAddressRefOutput

type DeleteAddressRefOutput struct {
	DataStore cldfdatastore.MutableDataStore
}

DeleteAddressRefOutput is the serializable output of a DeleteAddressRefOp invocation.

type DeleteChainMetadataDeps

type DeleteChainMetadataDeps struct {
	DataStore cldfdatastore.DataStore
}

DeleteChainMetadataDeps holds non-serializable dependencies for the DeleteChainMetadataOp operation.

type DeleteChainMetadataInput

type DeleteChainMetadataInput struct {
	ChainMetadataKeys []cldfdatastore.ChainMetadataKey
}

DeleteChainMetadataInput is the serializable input of a DeleteChainMetadataOp invocation.

type DeleteChainMetadataOutput

type DeleteChainMetadataOutput struct {
	DataStore cldfdatastore.MutableDataStore
}

DeleteChainMetadataOutput is the serializable output of a DeleteChainMetadataOp invocation.

type DeleteContractMetadataDeps

type DeleteContractMetadataDeps struct {
	DataStore cldfdatastore.DataStore
}

DeleteContractMetadataDeps holds non-serializable dependencies for the DeleteContractMetadataOp operation.

type DeleteContractMetadataInput

type DeleteContractMetadataInput struct {
	ContractMetadataKeys []cldfdatastore.ContractMetadataKey
}

DeleteContractMetadataInput is the serializable input of a DeleteContractMetadataOp invocation.

type DeleteContractMetadataOutput

type DeleteContractMetadataOutput struct {
	DataStore cldfdatastore.MutableDataStore
}

DeleteContractMetadataOutput is the serializable output of a DeleteContractMetadataOp invocation.

type UpdateAddressRefDeps

type UpdateAddressRefDeps struct {
	DataStore cldfdatastore.DataStore
}

UpdateAddressRefDeps holds non-serializable dependencies for the UpdateAddressRefOp operation.

type UpdateAddressRefInput

type UpdateAddressRefInput struct {
	AddressRefs []cldfdatastore.AddressRef
}

UpdateAddressRefInput is the serializable input of an UpdateAddressRefOp invocation.

type UpdateAddressRefOutput

type UpdateAddressRefOutput struct {
	DataStore cldfdatastore.MutableDataStore
}

UpdateAddressRefOutput is the serializable output of an UpdateAddressRefOp invocation.

type UpdateChainMetadataDeps

type UpdateChainMetadataDeps struct {
	DataStore cldfdatastore.DataStore
}

UpdateChainMetadataDeps holds non-serializable dependencies for the UpdateChainMetadataOp operation.

type UpdateChainMetadataInput

type UpdateChainMetadataInput struct {
	ChainMetadata []cldfdatastore.ChainMetadata
}

UpdateChainMetadataInput is the serializable input of an UpdateChainMetadataOp invocation.

type UpdateChainMetadataOutput

type UpdateChainMetadataOutput struct {
	DataStore cldfdatastore.MutableDataStore
}

UpdateChainMetadataOutput is the serializable output of an UpdateChainMetadataOp invocation.

type UpdateContractMetadataDeps

type UpdateContractMetadataDeps struct {
	DataStore cldfdatastore.DataStore
}

UpdateContractMetadataDeps holds non-serializable dependencies for the UpdateContractMetadataOp operation.

type UpdateContractMetadataInput

type UpdateContractMetadataInput struct {
	ContractMetadata []cldfdatastore.ContractMetadata
}

UpdateContractMetadataInput is the serializable input of an UpdateContractMetadataOp invocation.

type UpdateContractMetadataOutput

type UpdateContractMetadataOutput struct {
	DataStore cldfdatastore.MutableDataStore
}

UpdateContractMetadataOutput is the serializable output of an UpdateContractMetadataOp invocation.

type UpdateEnvMetadataDeps

type UpdateEnvMetadataDeps struct {
	DataStore cldfdatastore.DataStore
}

UpdateEnvMetadataDeps holds non-serializable dependencies for the UpdateEnvMetadataOp operation.

type UpdateEnvMetadataInput

type UpdateEnvMetadataInput struct {
	EnvMetadata cldfdatastore.EnvMetadata
}

UpdateEnvMetadataInput is the serializable input of an UpdateEnvMetadataOp invocation.

type UpdateEnvMetadataOutput

type UpdateEnvMetadataOutput struct {
	DataStore cldfdatastore.MutableDataStore
}

UpdateEnvMetadataOutput is the serializable output of an UpdateEnvMetadataOp invocation.

Jump to

Keyboard shortcuts

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