ozone core API

org.ozoneDB.core.storage.gammaStore
Interface Storage

All Known Implementing Classes:
AbstractStorage

public interface Storage

A meganism for storing and retrieving data to a permament back-end. While implementing classes are typically backed by file-based structures, this is in no way a _must_. Inheriting classes must must simply support read/write actions from a 'random' location.

As the IndexManager also uses instances of this type to write index nodes as a whole (no seek needed) there are also implementations that not support seek functionality.

Author:
Leo Mekenkamp (mind the anti-sp@m)

Method Summary
 void close()
           
 long length()
           
 void readFully(byte[] b)
           
 void readFully(byte[] b, int offset, int length)
          Read lenght bytes from b, starting at offset.
 int readInt()
           
 long readLong()
           
 void seek(long pos)
          Introduced because some implementing classes (based on FileOutputStream and FileInputStream for instance) might not support seek operations.
 void setLength(long length)
          Sets the maximum length.
 void write(byte[] b)
           
 void write(byte[] b, int offset, int length)
          Write lenght bytes from b, starting at offset.
 void writeInt(int value)
           
 void writeLong(long value)
           
 

Method Detail

seek

public void seek(long pos)
          throws java.io.IOException

Introduced because some implementing classes (based on FileOutputStream and FileInputStream for instance) might not support seek operations. They may throw an UnsupportedOperationException here, but still support writing and reading.

Implementations of this interface are used in 2 different ways: the IndexManager does not perform any seek actions, and thus the storage implementation it uses can include stream based ones; the ClusterManager however does perform seek actions and thus cannot have a storage implementation with streams in it.

Throws:
java.lang.UnsupportedOperationException
java.io.IOException

write

public void write(byte[] b,
                  int offset,
                  int length)
           throws java.io.IOException
Write lenght bytes from b, starting at offset.

Throws:
java.io.IOException

write

public void write(byte[] b)
           throws java.io.IOException
Throws:
java.io.IOException

writeLong

public void writeLong(long value)
               throws java.io.IOException
Throws:
java.io.IOException

writeInt

public void writeInt(int value)
              throws java.io.IOException
Throws:
java.io.IOException

readFully

public void readFully(byte[] b,
                      int offset,
                      int length)
               throws java.io.IOException
Read lenght bytes from b, starting at offset.

Throws:
java.io.IOException

readFully

public void readFully(byte[] b)
               throws java.io.IOException
Throws:
java.io.IOException

readLong

public long readLong()
              throws java.io.IOException
Throws:
java.io.IOException

readInt

public int readInt()
            throws java.io.IOException
Throws:
java.io.IOException

setLength

public void setLength(long length)
               throws java.io.IOException
Sets the maximum length.

Throws:
java.io.IOException

close

public void close()
           throws java.io.IOException
Throws:
java.io.IOException

length

public long length()
            throws java.io.IOException
Throws:
java.io.IOException

ozone core API

Copyright (C) The Ozone Database Project - www.ozone-db.org. All rights reserved.