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

## Class DefaultPlacementStrategy

- java.lang.Object
- - com.thinkaurelius.titan.graphdb.database.idassigner.placement.DefaultPlacementStrategy

- All Implemented Interfaces:
    IDPlacementStrategy

      public class DefaultPlacementStrategy
      extends Object
      implements IDPlacementStrategy

  Default `IDPlacementStrategy` that assigns all vertices to a fixed partition configured upon construction. This strategy is used when partitioning is disabled. This strategy is not configurable.
  Author:
    Matthias Broecheler (me@matthiasb.com)

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `DefaultPlacementStrategy()`
    `DefaultPlacementStrategy(int partitionID)`

  - ### 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.

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

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

- - ### Constructor Detail

    - #### DefaultPlacementStrategy

          public DefaultPlacementStrategy(int partitionID)

    - #### DefaultPlacementStrategy

          public DefaultPlacementStrategy()

  - ### Method Detail

    - #### getPartition

          public int getPartition(InternalElement element)

      Description copied from interface: `IDPlacementStrategy`
      Individually assigns an id to the given vertex or relation.
      Specified by:
        `getPartition` in interface `IDPlacementStrategy`
      Parameters:
        `element` - Vertex or relation to assign id to.
      Returns:

    - #### getPartitions

          public void getPartitions(Map<InternalVertex,PartitionAssignment> vertices)

      Description copied from interface: `IDPlacementStrategy`
      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 `IDPlacementStrategy.supportsBulkPlacement()` first.
      Specified by:
        `getPartitions` in interface `IDPlacementStrategy`
      Parameters:
        `vertices` - Map containing all vertices and their partition placement.

    - #### supportsBulkPlacement

          public boolean supportsBulkPlacement()

      Description copied from interface: `IDPlacementStrategy`
      Whether this placement strategy supports bulk placement. If not, then `IDPlacementStrategy.getPartitions(java.util.Map)` will throw `UnsupportedOperationException`
      Specified by:
        `supportsBulkPlacement` in interface `IDPlacementStrategy`
      Returns:

    - #### setLocalPartitionBounds

          public void setLocalPartitionBounds(List<PartitionIDRange> localPartitionIdRanges)

      Description copied from interface: `IDPlacementStrategy`
      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.
      Specified by:
        `setLocalPartitionBounds` in interface `IDPlacementStrategy`
      Parameters:
        `localPartitionIdRanges` - List of `PartitionIDRange`s correspondinging to the locally hosted partitions

    - #### exhaustedPartition

          public void exhaustedPartition(int partitionID)

      Description copied from interface: `IDPlacementStrategy`
      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.
      Specified by:
        `exhaustedPartition` in interface `IDPlacementStrategy`
      Parameters:
        `partitionID` - Id of the partition that has been exhausted.

Copyright © 2012–2014. All rights reserved.