Class AutoSavingCache.CacheSerializer<K extends CacheKey,V>
- Direct Known Subclasses:
CacheService.CounterCacheSerializer,CacheService.KeyCacheSerializer,CacheService.RowCacheSerializer
- Enclosing class:
- AutoSavingCache<K extends CacheKey,
V>
It expects the following lifecycle:
Serializations:
1. serialize(CacheKey, DataOutputPlus, ColumnFamilyStore) is called for each key in the cache.
2. serializeMetadata(DataOutputPlus) is called to serialize any metadata.
3. cleanupAfterSerialize() is called to clean up any resources allocated for serialization.
Deserializations:
1. deserializeMetadata(DataInputPlus) is called to deserialize any metadata.
2. deserialize(DataInputPlus) is called for each key in the cache.
3. cleanupAfterDeserialize() is called to clean up any resources allocated for deserialization.
This abstract class provides the default implementation for the metadata serialization/deserialization.
The metadata includes a dictionary of column family stores collected during serialization whenever
writeCFS(DataOutputPlus, ColumnFamilyStore) or getOrCreateCFSOrdinal(ColumnFamilyStore)
are called. When such metadata is deserialized, the implementation of deserialize(DataInputPlus) may
use readCFS(DataInputPlus) method to read the ColumnFamilyStore stored with
writeCFS(DataOutputPlus, ColumnFamilyStore).
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidvoidprotected final intprotected ColumnFamilyStorereadCFS(DataInputPlus in) abstract voidserialize(K key, DataOutputPlus out, ColumnFamilyStore cfs) voidprotected voidwriteCFS(DataOutputPlus out, ColumnFamilyStore cfs)
-
Constructor Details
-
CacheSerializer
public CacheSerializer()
-
-
Method Details
-
getOrCreateCFSOrdinal
-
readCFS
- Throws:
IOException
-
writeCFS
- Throws:
IOException
-
serializeMetadata
- Throws:
IOException
-
deserializeMetadata
- Throws:
IOException
-
serialize
- Throws:
IOException
-
deserialize
- Throws:
IOException
-
cleanupAfterSerialize
public void cleanupAfterSerialize() -
cleanupAfterDeserialize
public void cleanupAfterDeserialize()
-