IReplicaKeyMap::Serialize

Serializes the replica key map data to a byte array.

Syntax

HRESULT Serialize( 
  BYTE *pbReplicaKeyMap,
  DWORD *pcbReplicaKeyMap);

Parameters

  • pbReplicaKeyMap
    [in, out, unique, size_is(*pcbReplicaKeyMap)] The byte array that receives the serialized data.

  • pcbReplicaKeyMap
    [in, out] Specifies the number of bytes in pbReplicaKeyMap. Returns the number of bytes required to serialize the replica key map data when pbReplicaKeyMap is too small, or returns the number of bytes written.

Return Value

  • S_OK.

  • E_INVALIDARG when a replica ID or replica key stored in the map is not valid.

  • E_POINTER.

  • E_OUTOFMEMORY.

  • HRESULT_FROM_WIN32(ERROR_MORE_DATA) when pbReplicaKeyMap is too small. In this case, the required number of bytes is returned in pcbReplicaKeyMap.

Serialization Format

The serialized replica key map that is contained in pbReplicaKeyMap is stored in compact form, in big-endian byte order.

The serialized replica key map contains the following elements, in the following order:

Data type

Length in bytes

Description

ULONG

4

The replica key map signature. This value is always 5.

BOOL

1

Indicates whether replica IDs that are contained in the replica key map are fixed length or variable length. This value is 0 if the IDs are fixed length; or 1 if the IDs are variable length.

USHORT

2

The length, in bytes, of replica IDs for fixed-length IDs, or the maximum length of the ID for variable-length IDs.

ULONG

4

The number of entries in the replica key map.

The replica key map section contains a list of replica key map entries, with the number of entries equal to the value contained in the previous ULONG.

When replica IDs are fixed length:

Data type

Length in bytes

Description

Sequence of bytes

The length specified in the replica ID format.

The fixed-length replica ID.

Or, when replica IDs are variable length:

Data type

Length in bytes

Description

USHORT

2

The length, in bytes, of the variable-length ID. This length includes the two bytes for the USHORT that contains the length, plus the bytes that contain the actual ID.

Sequence of bytes

The length specified in the previous USHORT.

The variable-length replica ID.

See Also

Reference

IReplicaKeyMap Interface