Package convex.core
Class Receipt
- All Implemented Interfaces:
IAssociative<Keyword,,ACell> IValidated,IWriteable,Map<Keyword,ACell>
Transaction Receipt record.
This forms part of the official CVM state transition, so must be correctly computed and encoded
-
Nested Class Summary
-
Field Summary
Fields inherited from class convex.core.data.ARecord
DEFAULT_VALUEFields inherited from class convex.core.data.ADataStructure
countFields inherited from class convex.core.data.ACell
cachedRef, memorySize -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Receiptstatic Receiptstatic ReceiptcreateError(ACell errorCode) intencode(byte[] bs, int pos) Writes this Cell's encoding to a byte array, including a tag byte which will be written first.intencodeRaw(byte[] bs, int pos) Writes this Cell's encoding to a byte array, excluding the tag byte.booleanChecks for equality with another Cell.booleanGets the record field content for a given key, or null if not found.Gets the error code of this Receipt, or null if not an errorGets the RecordFormat instance that describes this Record's layoutgetRef(int i) Gets a numbered child Ref from within this Cell.intGets the number of Refs contained within this Cell.Gets the result value of this Receipt, or null if an errorbytegetTag()Gets the tag byte for this record type.final booleanReturns true if this cell is a first class CVM Value allowable in the CVM state Sub-structural cells that are not themselves first class values should return false Records and types that are not permissible on the CVM should return false.booleanisError()static ReceiptupdateRefs(IRefFunction func) Updates all Refs in this object using the given function.voidValidates the local structure and invariants of this cell.Methods inherited from class convex.core.data.ARecord
accumulateEntrySet, accumulateKeySet, accumulateValues, assoc, assocEntry, containsKey, containsValue, dissoc, dissoc, empty, entryAt, entrySet, estimatedEncodingSize, forEach, get, getEntry, getEntryByHash, getKeyRefEntry, getKeys, getType, getValuesArray, isCanonical, keySet, reduceEntries, reduceValues, toCanonical, toHashMap, valuesMethods inherited from class convex.core.data.AMap
clear, conj, containsKey, containsKeyRef, containsValue, entryVector, filterValues, get, get, get, getElementRef, merge, print, put, putAll, remove, slice, sliceMethods inherited from class convex.core.data.ADataStructure
checkIndex, conjAll, count, isDataValue, isEmpty, size, toCVMStringMethods inherited from class convex.core.data.ACell
attachMemorySize, attachRef, cachedEncoding, cachedHash, calcMemorySize, createEncoding, createRef, equals, genericEquals, getCanonical, getChildRefs, getEncoding, getEncodingLength, getHash, getMemorySize, getMemorySize, getRef, hashCode, isEmbedded, toString, validateMethods inherited from class convex.core.data.AObject
attachEncoding, print, printMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, equals, getOrDefault, hashCode, isEmpty, merge, putIfAbsent, remove, replace, replace, replaceAll, size
-
Constructor Details
-
Receipt
-
-
Method Details
-
create
-
create
-
createError
-
get
-
getErrorCode
Gets the error code of this Receipt, or null if not an error- Returns:
- Error code (probably a Keyword or nil)
-
getResult
Gets the result value of this Receipt, or null if an error- Returns:
- Result from this Receipt
-
getTag
-
isCVMValue
public final boolean isCVMValue()Description copied from class:ACellReturns true if this cell is a first class CVM Value allowable in the CVM state Sub-structural cells that are not themselves first class values should return false Records and types that are not permissible on the CVM should return false. Pretty much everything else should return true. Note: CVM values might not be in a canonical format, e.g. temporary data structures- Overrides:
isCVMValuein classARecord- Returns:
- true if the object is a CVM Value, false otherwise
-
getFormat
Description copied from class:ARecordGets the RecordFormat instance that describes this Record's layout -
validateCell
Description copied from class:ACellValidates the local structure and invariants of this cell. Called by validate() super implementation. Should validate directly contained data, but should not validate all other structure of this cell. In particular, should not traverse potentially missing child Refs.- Specified by:
validateCellin classACell- Throws:
InvalidDataException- If the Cell is invalid
-
equals
Description copied from class:ACellChecks for equality with another Cell. In general, Cells are considered equal if they have the same canonical representation, i.e. an identical encoding with the same hash value. Subclasses SHOULD override this if they have a more efficient equals implementation. MUST NOT require reads from Store. -
equals
-
encode
public int encode(byte[] bs, int pos) Description copied from class:ACellWrites this Cell's encoding to a byte array, including a tag byte which will be written first. Cell must be canonical, or else an error may occur.- Specified by:
encodein interfaceIWriteable- Specified by:
encodein classACell- Parameters:
bs- A byte array to which to write the encodingpos- The offset into the byte array- Returns:
- New position after writing
-
encodeRaw
public int encodeRaw(byte[] bs, int pos) Description copied from class:ACellWrites this Cell's encoding to a byte array, excluding the tag byte. -
read
- Throws:
BadFormatException
-
updateRefs
Description copied from class:ACellUpdates all Refs in this object using the given function. The function *must not* change the hash value of Refs, in order to ensure structural integrity of modified data structures. The implementation *should* re-attach any original encoding in order to prevent re-encoding or surplus hashing This is a building block for a very sneaky trick that enables use to do a lot of efficient operations on large trees of smart references. Must return the same object if no Refs are altered.- Overrides:
updateRefsin classACell- Parameters:
func- Ref update function- Returns:
- Cell with updated Refs
-
getRefCount
public int getRefCount()Description copied from class:ACellGets the number of Refs contained within this Cell. This number is final / immutable for any given instance and is defined by the Cell encoding rules. Contained Refs may be either external or embedded.- Overrides:
getRefCountin classACell- Returns:
- The number of Refs in this Cell
-
getRef
Description copied from class:ACellGets a numbered child Ref from within this Cell. WARNING: May need to convert to a canonical instance -
isError
public boolean isError()
-