Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package com.fasterxml.clustermate.service.store;
 
 
Converter used by store for handling conversions between low-level com.fasterxml.storemate.store.Storable (things stored in StoreMate store), and ClusterMate-level StoredEntry instances.

Custom sub-classing is needed to support additional metadata for systems implementations.

public abstract class StoredEntryConverter<K extends EntryKey,
    E extends StoredEntry<K>,
    L extends ListItem
    // // // Key conversion
    public abstract EntryKeyConverter<K> keyConverter();
    
    // // // Entry conversion
    
    public abstract E entryFromStorable(Storable raw);
    public abstract E entryFromStorable(K keyfinal Storable raw);
    public abstract E entryFromStorable(K keyStorable raw,
            byte[] bufferint offsetint length);

    
Method for constructing implementation minimal com.fasterxml.clustermate.api.msg.ListItem instances (subtypes) from raw com.fasterxml.storemate.store.Storable
        return defaultMinimalListItemFromStorable(raw);
    }

    
Method for constructing implementation implementation-specific full com.fasterxml.clustermate.api.msg.ListItem instances (subtypes) from raw com.fasterxml.storemate.store.Storable
    public abstract L fullListItemFromStorable(Storable raw);
    
    // // // Metadata handling
    
    
Method called to construct "custom metadata" section to be used for constructing a new Storable instance.
    public abstract ByteContainer createMetadata(long creationTime,
            byte lastAccessUpdateMethod,
            int minTTLSecsint maxTTLSecs);
    
    // // // Last accessed
    
    public abstract EntryLastAccessed createLastAccessed(E entrylong accessTime);
    public abstract EntryLastAccessed createLastAccessed(byte[] raw);
    public abstract EntryLastAccessed createLastAccessed(byte[] rawint offsetint length);
    
    /*
    /**********************************************************************
    /* Default implementations (mostly for unit tests)
    /**********************************************************************
     */

    
Helper method that can be used as the baseline implementation for listItemFromStorable(com.fasterxml.storemate.store.Storable) by tests.
        return new ListItem(raw.getKey(), raw.getContentHash(), raw.getActualUncompressedLength());
    }
New to GrepCode? Check out our FAQ X