com.thinkaurelius.titan.diskstorage.idmanagement

## Class AbstractIDAuthority

- java.lang.Object
- - com.thinkaurelius.titan.diskstorage.idmanagement.AbstractIDAuthority

- All Implemented Interfaces:
    IDAuthority
  Direct Known Subclasses:
    ConsistentKeyIDAuthority

      public abstract class AbstractIDAuthority
      extends Object
      implements IDAuthority

  Base Class for `IDAuthority` implementations. Handles common aspects such as maintaining the `IDBlockSizer` and shared configuration options
  Author:
    Matthias Broecheler (me@matthiasb.com)

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected static long` | `BASE_ID`
    `protected Duration` | `idApplicationWaitMS`
    `protected String` | `metricsPrefix`
    `protected String` | `uid`
    `protected byte[]` | `uidBytes`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `AbstractIDAuthority(Configuration config)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected long` | `getBlockSize(int idNamespace)` Returns the block size of the specified partition as determined by the configured `IDBlockSizer`.
    `protected long` | `getIdUpperBound(int idNamespace)`
    `protected StaticBuffer` | `getPartitionKey(int partition)` Returns a byte buffer representation for the given partition id
    `String` | `getUniqueID()` Return the globally unique string used by this `IDAuthority` instance to recognize its ID allocations and distinguish its allocations from those belonging to other `IDAuthority` instances.
    `void` | `setIDBlockSizer(IDBlockSizer sizer)` Sets the `IDBlockSizer` to be used by this IDAuthority.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface com.thinkaurelius.titan.diskstorage.IDAuthority

      `close, getIDBlock, getLocalIDPartition`

- - ### Field Detail

    - #### BASE_ID

          protected static final long BASE_ID

      See Also:
        Constant Field Values

    - #### idApplicationWaitMS

          protected final Duration idApplicationWaitMS

    - #### uid

          protected final String uid

    - #### uidBytes

          protected final byte[] uidBytes

    - #### metricsPrefix

          protected final String metricsPrefix

  - ### Constructor Detail

    - #### AbstractIDAuthority

          public AbstractIDAuthority(Configuration config)

  - ### Method Detail

    - #### setIDBlockSizer

          public void setIDBlockSizer(IDBlockSizer sizer)

      Description copied from interface: `IDAuthority`
      Sets the `IDBlockSizer` to be used by this IDAuthority. The IDBlockSizer specifies the block size for each partition guaranteeing that the same partition will always be assigned the same block size.

      The IDBlockSizer cannot be changed for an IDAuthority that has already been used (i.e. after invoking `#getIDBlock(int)`.
      Specified by:
        `setIDBlockSizer` in interface `IDAuthority`
      Parameters:
        `sizer` - The IDBlockSizer to be used by this IDAuthority

    - #### getUniqueID

          public String getUniqueID()

      Description copied from interface: `IDAuthority`
      Return the globally unique string used by this `IDAuthority` instance to recognize its ID allocations and distinguish its allocations from those belonging to other `IDAuthority` instances. This should normally be the value of `GraphDatabaseConfiguration.UNIQUE_INSTANCE_ID`, though that's not strictly technically necessary.
      Specified by:
        `getUniqueID` in interface `IDAuthority`
      Returns:
        unique ID string

    - #### getPartitionKey

          protected StaticBuffer getPartitionKey(int partition)

      Returns a byte buffer representation for the given partition id
      Parameters:
        `partition` -
      Returns:

    - #### getBlockSize

          protected long getBlockSize(int idNamespace)

      Returns the block size of the specified partition as determined by the configured `IDBlockSizer`.
      Parameters:
        `idNamespace` -
      Returns:

    - #### getIdUpperBound

          protected long getIdUpperBound(int idNamespace)

Copyright © 2012–2014. All rights reserved.