Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Rice Pastry API
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## rice.persistence
Interface Catalog

All Known Subinterfaces:
  Cache, Storage, StorageManager

All Known Implementing Classes:
  EmptyCache, LRUCache, MemoryStorage, PersistentStorage, StorageManagerImpl

public interface Catalog

This interface is the abstraction of something which holds objects which are available for lookup. This interface does not, however, specify how the objects are inserted, and makes NO guarantees as to whether objects available at a given point in time will be available at a later time. Implementations of the Catalog interface are designed to be interfaces which specify how objects are inserted and stored, and are designed to include a cache and persistent storage interface.

Version:
  $Id: pretty.settings,v 1.3 2005/03/11 20:22:33 jeffh Exp $
Author:
  jeffh

Method Summary
`boolean` | `exists(Id id)` Returns whether or not an object is present in the location `id` .
`java.io.Serializable` | `getMetadata(Id id)` Returns the metadata associated with the provided object, or null if no metadata exists.
`void` | `getObject(Id id, Continuation c)` Returns the object identified by the given id, or `null` if there is no cooresponding object (through receiveResult on c).
`int` | `getSize()` Returns the number of Ids currently stored in the catalog
`long` | `getTotalSize()` Returns the total size of the stored data in bytes.
`void` | `rename(Id oldId, Id newId, Continuation c)` Renames the given object to the new id.
`IdSet` | `scan()` Return all objects currently stored by this catalog NOTE: This method blocks so if the behavior of this method changes and no longer stored in memory, this method may be deprecated.
`IdSet` | `scan(IdRange range)` Return the objects identified by the given range of ids.
`java.util.SortedMap` | `scanMetadata()` Returns a map which contains keys mapping ids to the associated metadata.
`java.util.SortedMap` | `scanMetadata(IdRange range)` Returns a map which contains keys mapping ids to the associated metadata.
`java.util.SortedMap` | `scanMetadataValuesHead(java.lang.Object value)` Returns the submapping of ids which have metadata less than the provided value.
`java.util.SortedMap` | `scanMetadataValuesNull()` Returns the submapping of ids which have metadata null
`void` | `setMetadata(Id id, java.io.Serializable metadata, Continuation command)` Updates the metadata stored under the given key to be the provided value.

Method Detail

### exists

    public boolean exists(Id id)

  Returns whether or not an object is present in the location `id` .

  Parameters:
    `id` - The id of the object in question.
  Returns:
    Whether or not an object is present at id.

### getObject

    public void getObject(Id id,
                          Continuation c)

  Returns the object identified by the given id, or `null` if there is no cooresponding object (through receiveResult on c).

  Parameters:
    `id` - The id of the object in question.
    `c` - The command to run once the operation is complete

### getMetadata

    public java.io.Serializable getMetadata(Id id)

  Returns the metadata associated with the provided object, or null if no metadata exists. The metadata must be stored in memory, so this operation is guaranteed to be fast and non-blocking. The metadata returned from this method must *NOT* be mutated in any way, as the actual reference to the internal object is returned. Mutating this metadata may make the internal indices incorrect, resulting in undefined behavior. Changing the metadata should be done by creating a new metadata object and calling setMetadata().

  Parameters:
    `id` - The id for which the metadata is needed
  Returns:
    The metadata, or null if none exists

### setMetadata

    public void setMetadata(Id id,
                            java.io.Serializable metadata,
                            Continuation command)

  Updates the metadata stored under the given key to be the provided value. As this may require a disk access, the requestor must also provide a continuation to return the result to.

  Parameters:
    `id` - The id for the metadata
    `metadata` - The metadata to store
    `command` - The new Metadata value

### rename

    public void rename(Id oldId,
                       Id newId,
                       Continuation c)

  Renames the given object to the new id. This method is potentially faster than store/cache and unstore/uncache.

  Parameters:
    `oldId` - The id of the object in question.
    `newId` - The new id of the object in question.
    `c` - The command to run once the operation is complete

### scan

    public IdSet scan(IdRange range)

  Return the objects identified by the given range of ids. The IdSet returned contains the Ids of the stored objects. The range is partially inclusive, the lower range is inclusive, and the upper exclusive. NOTE: This method blocks so if the behavior of this method changes and no longer stored in memory, this method may be deprecated.

  Parameters:
    `range` - The range to query
  Returns:
    The idset containg the keys

### scan

    public IdSet scan()

  Return all objects currently stored by this catalog NOTE: This method blocks so if the behavior of this method changes and no longer stored in memory, this method may be deprecated.

  Returns:
    The idset containg the keys

### scanMetadata

    public java.util.SortedMap scanMetadata(IdRange range)

  Returns a map which contains keys mapping ids to the associated metadata.

  Parameters:
    `range` - The range to query
  Returns:
    The map containg the keys

### scanMetadata

    public java.util.SortedMap scanMetadata()

  Returns a map which contains keys mapping ids to the associated metadata.

  Returns:
    The treemap mapping ids to metadata

### scanMetadataValuesHead

    public java.util.SortedMap scanMetadataValuesHead(java.lang.Object value)

  Returns the submapping of ids which have metadata less than the provided value.

  Parameters:
    `value` - The maximal metadata value
  Returns:
    The submapping

### scanMetadataValuesNull

    public java.util.SortedMap scanMetadataValuesNull()

  Returns the submapping of ids which have metadata null

  Returns:
    The submapping

### getSize

    public int getSize()

  Returns the number of Ids currently stored in the catalog

  Returns:
    The number of ids in the catalog

### getTotalSize

    public long getTotalSize()

  Returns the total size of the stored data in bytes.

  Returns:
    The total storage size

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Rice Pastry API
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2001-2005 - Rice Pastry.