com.thinkaurelius.titan.diskstorage

## Interface IDAuthority

- All Known Implementing Classes:
    AbstractIDAuthority, ConsistentKeyIDAuthority

      public interface IDAuthority

  Handles the unique allocation of ids. Returns blocks of ids that are uniquely allocated to the caller so that they can be used to uniquely identify elements. *
  Author:
    Matthias Broecheler (me@matthiasb.com)

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `close()` Closes the IDAuthority and any underlying storage backend.
    `IDBlock` | `getIDBlock(int partition, int idNamespace, Duration timeout)` Returns a block of new ids in the form of `IDBlock`.
    `List<KeyRange>` | `getLocalIDPartition()` Returns the lower and upper limits of the key range assigned to this local machine as an array with two entries.
    `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.

- - ### Method Detail

    - #### getIDBlock

          IDBlock getIDBlock(int partition,
                           int idNamespace,
                           Duration timeout)
                             throws BackendException

      Returns a block of new ids in the form of `IDBlock`. It is guaranteed that the block of ids for the particular partition id is uniquely assigned, that is, the block of ids has not been previously and will not subsequently be assigned again when invoking this method on the local or any remote machine that is connected to the underlying storage backend.

      In other words, this method has to ensure that ids are uniquely assigned per partition.

      It is furthermore guaranteed that any id of the returned IDBlock is smaller than the upper bound for the given partition as read from the `IDBlockSizer` set on this IDAuthority and that the number of ids returned is equal to the block size of the IDBlockSizer.
      Parameters:
        `partition` - Partition for which to request an id block
        `idNamespace` - namespace for ids within a partition
        `timeout` - When a call to this method is unable to return a id block before this timeout elapses, the implementation must give up and throw a `StorageException` ASAP
      Returns:
        a range of ids for the `partition` parameter
      Throws:
        `BackendException`

    - #### getLocalIDPartition

          List<KeyRange> getLocalIDPartition()
                                             throws BackendException

      Returns the lower and upper limits of the key range assigned to this local machine as an array with two entries.
      Returns:
      Throws:
        `BackendException`

    - #### setIDBlockSizer

          void setIDBlockSizer(IDBlockSizer sizer)

      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)`.
      Parameters:
        `sizer` - The IDBlockSizer to be used by this IDAuthority

    - #### close

          void close()
                     throws BackendException

      Closes the IDAuthority and any underlying storage backend.
      Throws:
        `BackendException`

    - #### getUniqueID

          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. This should normally be the value of `GraphDatabaseConfiguration.UNIQUE_INSTANCE_ID`, though that's not strictly technically necessary.
      Returns:
        unique ID string

Copyright © 2012–2014. All rights reserved.