Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ContractKeyValueID = "keyValue"
ContractKeyValueID denotes a contract that can store and update key/value pairs.
Functions ¶
func ContractKeyValue ¶
func ContractKeyValue(cdb byzcoin.CollectionView, inst byzcoin.Instruction, cIn []byzcoin.Coin) (scs []byzcoin.StateChange, cOut []byzcoin.Coin, err error)
ContractKeyValue is a simple key/value storage where you can put any data inside as wished. It can spawn new keyValue instances and will store all the arguments in the data field. Existing keyValue instances can be "update"d and deleted.
Types ¶
type KeyValue ¶
KeyValue is created as a structure here, as go's map returns the elements in a random order and as such is not suitable for use in a system that needs to return always the same state.
type KeyValueData ¶
type KeyValueData struct {
Storage []KeyValue
}
KeyValueData is the structure that will hold all key/value pairs.
func NewContractStruct ¶
func NewContractStruct(args byzcoin.Arguments) KeyValueData
NewContractStruct returns an initialised ContractStruct with all key/value pairs from the arguments.
func (*KeyValueData) Update ¶
func (cs *KeyValueData) Update(args byzcoin.Arguments)
Update goes through all the arguments and:
- updates the value if the key already exists
- deletes the keyvalue if the value is empty
- adds a new keyValue if the key does not exist yet
type Service ¶
type Service struct { // We need to embed the ServiceProcessor, so that incoming messages // are correctly handled. *onet.ServiceProcessor }
Service is only used to being able to store our contracts