Package com.apple.foundationdb.record.provider.common
Serialization
The underlying database is a key-value store, mapping a byte-array key to a byte-array value.
Serializing a record is the process of converting it to and from the byte-array value.
The heavy lifting of record serialization is done by Protocol Buffers, using MessageLite.toByteArray()
and
Message.Builder.mergeFrom(byte[])
.
This is done by the RecordSerializer
.
To make records self-identifying, the record is wrapped in the RecordTypeUnion
message, which has one field for
each record type.
A serializer can also do other transformations between the raw message and the on-disk format. For example, TransformedRecordSerializer
does
compression and encryption.
Instrumentation
A StoreTimer
is optionally associated with each open FDBRecordContext
.
This makes it available to an open FDBRecordStore
.
It accumulates timing information for all the operations performed by the context on the store, classified by StoreTimer.Event
type.
-
Interface Summary Interface Description MappedPool.MappedPoolProvider<K,V,E extends Exception> Function with Exceptions to provide the pool.RecordSerializer<M extends Message> A converter between a Protobuf record and a byte string stored in one or more values in the FDB key-value store.StoreTimer.Aggregate An aggregate event is an event whose value is computed over the value of another set of events.StoreTimer.Count StoreTimer.Event
s that only count occurrences or total size.StoreTimer.DetailEvent StoreTimer.Event
s that are a significant part of a larger process.StoreTimer.Event An identifier for occurrences that need to be timed.StoreTimer.Wait StoreTimer.Event
s that can be waited on. -
Class Summary Class Description DynamicMessageRecordSerializer Serialize records using default Protobuf serialization usingDynamicMessage
.MappedPool<K,V,E extends Exception> MappedPool Class Attempts to reuse objects organized by keys.MessageBuilderRecordSerializer Serialize records using default Protobuf serialization using the supplied message builder for the union message type.MessageBuilderRecordSerializerBase<M extends Message,U extends Message,B extends Message.Builder> Base class for record serializers that use a supplied union message builder method reference to reconstruct records.StoreTimer A context-wide accumulator of timing information.StoreTimer.Counter Contains the number of occurrences and cummulative time spent on an associatedStoreTimer.Event
.StoreTimerSnapshot An immutable snapshot of aStoreTimer
.StoreTimerSnapshot.CounterSnapshot An immutable snapshot of aStoreTimer.Counter
.TransformedRecordSerializer<M extends Message> ARecordSerializer
implementation that transforms the bytes produced by another serializer before returning (and likewise performs the reverse transformation before deserializing).TransformedRecordSerializer.Builder<M extends Message> Builder class for theTransformedRecordSerializer
class.TransformedRecordSerializer.TransformState TransformedRecordSerializerJCE<M extends Message> An extension ofTransformedRecordSerializer
to use JCE to encrypt and decrypt records.TransformedRecordSerializerJCE.Builder<M extends Message> Builder class for theTransformedRecordSerializerJCE
class.TypedRecordSerializer<M extends Message,U extends Message,B extends Message.Builder> Serialize records using default Protobuf serialization using supplied message builder for the union message type and two accessors for the message field corresponding to the known record type. -
Enum Summary Enum Description RecordSerializer.Counts Instrumentation counts related to record serialization.RecordSerializer.Events Instrumentation events related to record serialization. -
Exception Summary Exception Description RecordSerializationException Exception thrown when there is a problem serializing or deserializing a record.