com.thinkaurelius.titan.graphdb.database.idassigner.placement

## Interface IDPlacementStrategy

- All Known Implementing Classes:
    DefaultPlacementStrategy, SimpleBulkPlacementStrategy

      public interface IDPlacementStrategy

  Determines how vertices are placed in individual graph partitions. A particular implementation determines the partition id of a (newly created) vertex. The vertex is then assigned to said partition by Titan. The id placement strategy is configurable.
  Author:
    Matthias Broecheler (me@matthiasb.com)

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `exhaustedPartition(int partitionID)` Called when there are no more idAuthorities left in the given partition.
    `int` | `getPartition(InternalElement element)` Individually assigns an id to the given vertex or relation.
    `void` | `getPartitions(Map<InternalVertex,PartitionAssignment> vertices)` Bulk assignment of idAuthorities to vertices.
    `void` | `setLocalPartitionBounds(List<PartitionIDRange> localPartitionIdRanges)` If Titan is embedded, this method is used to indicate to the placement strategy which part of the partition id space is hosted locally so that vertex and edge placements can be made accordingly (i.e.
    `boolean` | `supportsBulkPlacement()` Whether this placement strategy supports bulk placement.

- - ### Method Detail

    - #### getPartition

          int getPartition(InternalElement element)

      Individually assigns an id to the given vertex or relation.
      Parameters:
        `element` - Vertex or relation to assign id to.
      Returns:

    - #### getPartitions

          void getPartitions(Map<InternalVertex,PartitionAssignment> vertices)

      Bulk assignment of idAuthorities to vertices.

      It is expected that the passed in map contains the partition assignment after this method returns. Any initial values in the map are meaningless and to be ignored.

      This is an optional operation. Check with `supportsBulkPlacement()` first.
      Parameters:
        `vertices` - Map containing all vertices and their partition placement.

    - #### supportsBulkPlacement

          boolean supportsBulkPlacement()

      Whether this placement strategy supports bulk placement. If not, then `getPartitions(java.util.Map)` will throw `UnsupportedOperationException`
      Returns:

    - #### setLocalPartitionBounds

          void setLocalPartitionBounds(List<PartitionIDRange> localPartitionIdRanges)

      If Titan is embedded, this method is used to indicate to the placement strategy which part of the partition id space is hosted locally so that vertex and edge placements can be made accordingly (i.e. preferring to assign partitions in the local ranges so that the data is hosted locally which is often faster).

      This method can be called at any time while Titan is running. It is typically called right after construction and when the id space is redistributed.

      Depending on the storage backend one or multiple ranges of partition ids may be given. However, this list is never emtpy.
      Parameters:
        `localPartitionIdRanges` - List of `PartitionIDRange`s correspondinging to the locally hosted partitions

    - #### exhaustedPartition

          void exhaustedPartition(int partitionID)

      Called when there are no more idAuthorities left in the given partition. It is expected that the placement strategy will no longer use said partition in its placement suggestions.
      Parameters:
        `partitionID` - Id of the partition that has been exhausted.

Copyright © 2012–2014. All rights reserved.