[This is preliminary documentation and is subject to change.]
The Parcel TPayload type exposes the following members.Constructors
Name | Description | |
---|---|---|
![]() | Parcel TPayload |
Used for serialization
|
![]() | Parcel TPayload (TPayload) |
This ctor is never public, used with __ctor__injectID
|
![]() | Parcel TPayload (GDID, TPayload) | Initializes a new instance of the Parcel TPayload class |
![]() | Parcel TPayload (GDID, TPayload, IReplicationVersionInfo) | Initializes a new instance of the Parcel TPayload class |
Methods
Name | Description | |
---|---|---|
![]() | __ctor__injectID |
Internal framework method, developers: never call
(Inherited from Parcel.) |
![]() | DeepClone |
Duplicates this parcel by doing a complete deep-clone of its state via serialization.
This method is useful for making copies of the same parcel for different threads as it is thread-safe while no other thread mutates the instance,
however Parcel instances are NOT THREAD-SAFE for parallel changes.
The existing parcel MUST be SEALED (otherwise it can not be serialized).
This method is also used before a call to Open() if parcel needs to be "un-opened" the cloned instance may be reverted to
(Inherited from Parcel.) |
![]() | Destructor |
Override this method to do actual destructor work
(Inherited from DisposableObject.) |
![]() | Dispose |
Deterministically disposes object. DO NOT OVERRIDE this method, override Destructor() instead
(Inherited from DisposableObject.) |
![]() | DoMerge |
Override to merge other parcels into this one. Return true if merge changed the payload. See Merge().
This implementation throws an exception
(Inherited from Parcel.) |
![]() | DoOpen |
Override to perform actions when parcel is unsealed (opened) for modification
(Inherited from Parcel.) |
![]() | DoSeal |
Override to seal the parcel instance, i.e. generate some calculated fields.
The version information is already generated by the time this method is called
(Inherited from Parcel.) |
![]() | DoValidate |
Override to perform parcel/payload validation after modification. Add validation exceptions into m_ValidationExceptions field.
Use bank for cross-checks (i.e. may run queries to check consistency)
(Inherited from Parcel.) |
![]() | EnsureObjectNotDisposed |
Checks to see whether object dispose started or has already been disposed and throws an exception if Dispose() was called
(Inherited from DisposableObject.) |
![]() | Equals |
Tests for parcel equality based on the same type and GDID value
(Inherited from Parcel.) |
![]() | Finalize | (Inherited from DisposableObject.) |
![]() | GetDistributedStableHash | (Inherited from Parcel.) |
![]() | GetHashCode |
Generates hash code based on parcel type and GDID value
(Inherited from Parcel.) |
![]() | ![]() | Gets the (Inherited from ![]() ![]() |
![]() | ![]() | Creates a shallow copy of the current (Inherited from ![]() ![]() |
![]() | Merge |
Merges other parcel instances into this one.
A parcel type may support merging (when DataParcel attribute SupportsMerge is set to true) of data from other parcels/versions into this instance.
This parcel must not be sealed as merge may change the payload in which case TRUE is returned. The parcel needs to be sealed again after the change.
If a call to this method returns false, then nothing was changed as this instance already contains the latest data/could not be merged.
Merging is used for version conflict resolution: servers check if the type of the updated parcel instance SupportsMerge, then if it does, Opens parcel
and calls this method passing other versions in question to this method. The framework does not impose a limit on the supplied parcel types, however
most of the parcel types support merge only with the same-typed parcel instances.
IMPORTANT: The ordering of parcel versions is not guaranteed.
(Inherited from Parcel.) |
![]() | Open |
Opens parcel for modification. Parcel must be in the Sealed state for this call and must not be ReadOnly.
Once open for modification, a parcel can not be "UnOpened", only Seal()-ed. This is because there is no way to track
whether some part of payload object has changed by the calling code. Use DeepClone() before calling Open to retain a copy of Sealed parcel
to revert to the cloned instance instead
(Inherited from Parcel.) |
![]() | Seal |
Seal parcel after modification
May call this method on parcels in either Creating or Modifying states.
Bank is used to create the ReplicationVersionInfo which is depends on store/bank implementation.
Parcels can replicate only within stores/technologies that have sealed them
(Inherited from Parcel.) |
![]() | ToString | (Inherited from Parcel.) |
![]() | Validate |
Performs validation of the data. Does not throw but populates validation exceptions if data is not valid.
Bank context may be used to run sub-queries during consistency/crosschecks
May call this method on parcels in either Creating or Modifying states
(Inherited from Parcel.) |
Extension Methods
Fields
Name | Description | |
---|---|---|
![]() | m_ValidationExceptions | (Inherited from Parcel.) |
Properties
Name | Description | |
---|---|---|
![]() | CacheAbsoluteExpirationUTC |
Implements IParcelCachePolicy contract.
The default implementation returns null.
Override to supply a different absolute cache expiration UTC timestamp for this parcel
that may depend on particular parcel payload state (i.e. field values).
(Inherited from Parcel.) |
![]() | CachePriority |
Implements IParcelCachePolicy contract.
The default implementation returns null.
Override to supply a relative cache priority of this parcel
that may depend on particular parcel payload state (i.e. field values).
(Inherited from Parcel.) |
![]() | CacheReadMaxAgeSec |
Implements IParcelCachePolicy contract.
The default implementation returns null.
Override to supply a value for maximum validity span of cached parcel
that may depend on particular parcel payload state (i.e. field values).
This property may be used to obtain a value before parcel is re-read from the store
(Inherited from Parcel.) |
![]() | CacheWriteMaxAgeSec |
Implements IParcelCachePolicy contract.
The default implementation returns null.
Override to supply a value for maximum length of this isntance stay in cache
that may depend on particular parcel payload state (i.e. field values)
(Inherited from Parcel.) |
![]() | Disposed |
Indicates whether this object was already disposed - the Dispose() has finished
(Inherited from DisposableObject.) |
![]() | DisposeStarted |
Indicates whether this object Dispose() has been called and dispose started but not finished yet
(Inherited from DisposableObject.) |
![]() | EffectiveCachePolicy |
Returns effective cache policy the one that is calculated from attribute and overidden by the instance
(Inherited from Parcel.) |
![]() | GDID |
Returns GDID for data that this parcel represents
(Inherited from Parcel.) |
![]() | MetadataAttribute |
Returns DataParcelAttribute that describes this parcel. Every parcel MUST be decorated by the DataParcel attribute
(Inherited from Parcel.) |
![]() | NewlySealed |
Returns true when parcel was just sealed after a call to Open or .ctor/create.
Datastore may check this flag and disallow saving of parcel instances that have not changed
(Inherited from Parcel.) |
![]() | Payload |
Returns payload of this parcel. May be null for deleted parcels (VersionDeleted)
|
![]() | ReadOnly |
Indicates whether the data may be altered.
ReadOnly parcels can not be Opened after that have been Sealed by their creator
(Inherited from Parcel.) |
![]() | ReplicationPriority |
Returns replication priority, override to make replication priority dependent on instance, i.e. a user profile data for
a celebrity user may need to have higher replication rate. The lower value indicates the higher priority
(Inherited from Parcel.) |
![]() | ReplicationVersionInfo |
Implements IReplicatable interface
(Inherited from Parcel.) |
![]() | ShardingID |
Returns the ShardingID used for sharding, default implementation returns this parcel type and GDID.
Override to return another sharding key, i.e. a social comment msg may use parent item (that the msg relates to) ID
as the shard key so msgs are co-located with related items. Use CompositeShardingID to return multiple values.
IMPORTANT!!! ShardingID must return an immutable value, the one that CAN NOT be changed during parcel payload life
(Inherited from Parcel.) |
![]() | ShardingPointer |
Returns the ShardingPointer(type:ID) used for sharding, default implementation returns this parcel type and GDID.
Override ShardingID property to return another sharding key, i.e. a social comment msg may use parent item (that the msg relates to) ID
as the shard key so msgs are co-located with related items. Use CompositeShardingID to return multiple values.
IMPORTANT!!! ShardingPointer must return an immutable value, the one that CAN NOT be changed during parcel payload life
(Inherited from Parcel.) |
![]() | State |
Returns the state of the parcel: Creating|Modifying|Sealed
(Inherited from Parcel.) |
![]() | ValidationExceptions |
Returns validation exceptions - populated by a call to Validate
(Inherited from Parcel.) |
Explicit Interface Implementations
Name | Description | |
---|---|---|
![]() ![]() | ICachePolicy CacheTableName |
Implements IParcelCachePolicy contract.
The implementation returns null for parcel.
(Inherited from Parcel.) |
See Also