org.fusesource.hawtdb.api
Class AbstractStreamPagedAccessor<T>

java.lang.Object
  extended by org.fusesource.hawtdb.api.AbstractStreamPagedAccessor<T>
All Implemented Interfaces:
PagedAccessor<T>
Direct Known Subclasses:
CodecPagedAccessor

public abstract class AbstractStreamPagedAccessor<T>
extends java.lang.Object
implements PagedAccessor<T>

Abstract base class for implementations of EncoderDecoder which use stream encoding/decoding.

Author:
Hiram Chirino

Constructor Summary
AbstractStreamPagedAccessor()
           
 
Method Summary
protected abstract  T decode(Paged paged, java.io.DataInputStream is)
           
protected abstract  void encode(Paged paged, java.io.DataOutputStream os, T data)
           
 T load(Paged paged, int page)
          Load a value from a specified page.
 java.util.List<java.lang.Integer> pagesLinked(Paged paged, int page)
          Returns a list of the pages linked to the specified page.
 java.util.List<java.lang.Integer> store(Paged paged, int page, T data)
          Store a value at the specified page.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractStreamPagedAccessor

public AbstractStreamPagedAccessor()
Method Detail

store

public java.util.List<java.lang.Integer> store(Paged paged,
                                               int page,
                                               T data)
Description copied from interface: PagedAccessor
Store a value at the specified page. Object encoding will be deferred as long as possible. This allows multiple updates the the same page to avoid paying the cost of multiple encoding passes. Only when the value is evicted from the cache or the page file is flushed, will the encoding take place. Since the deferred encoding is no longer taking place in the context of a transaction, there are several restrictions of what pages the Marshaler can update so that transaction isolation is not violated:

Specified by:
store in interface PagedAccessor<T>
Returns:
a list of any pages allocated by the method.

load

public T load(Paged paged,
              int page)
Description copied from interface: PagedAccessor
Load a value from a specified page. It should not attempt do any update operations against the Paged object.

Specified by:
load in interface PagedAccessor<T>
Returns:

pagesLinked

public java.util.List<java.lang.Integer> pagesLinked(Paged paged,
                                                     int page)
Description copied from interface: PagedAccessor
Returns a list of the pages linked to the specified page.

Specified by:
pagesLinked in interface PagedAccessor<T>

encode

protected abstract void encode(Paged paged,
                               java.io.DataOutputStream os,
                               T data)
                        throws java.io.IOException
Throws:
java.io.IOException

decode

protected abstract T decode(Paged paged,
                            java.io.DataInputStream is)
                     throws java.io.IOException
Throws:
java.io.IOException


Copyright © 2009-2011 FuseSource, Corp.. All Rights Reserved.