Package fr.gouv.vitam.common.database.offset

# Class OffsetRepository

java.lang.Object
fr.gouv.vitam.common.database.offset.OffsetRepository

public class OffsetRepository extends Object
Offset collection repository (use for logbook and metadata database)

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final String`
  `COLLECTION_NAME`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `OffsetRepository(MongoDbAccess mongoDbAccess)`
  Constructor
  `OffsetRepository(MongoDbAccess mongoDbAccess, String collectionName)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `createOrUpdateOffset(int tenant, String strategy, String collection, long offset)`
  Create or update offset
  `long`
  `findOffsetBy(int tenant, String strategy, String collection)`
  Get current offset

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

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

- ## Field Details

  - ### COLLECTION_NAME

    public static final String COLLECTION_NAME
    See Also:
      - Constant Field Values

- ## Constructor Details

  - ### OffsetRepository

    public OffsetRepository(MongoDbAccess mongoDbAccess, String collectionName)

  - ### OffsetRepository

    public OffsetRepository(MongoDbAccess mongoDbAccess)
    Constructor
    Parameters:
      `mongoDbAccess` - mongoDbAccess

- ## Method Details

  - ### createOrUpdateOffset

    public void createOrUpdateOffset(int tenant, String strategy, String collection, long offset)
    Create or update offset
    Parameters:
      `tenant` - the tenant
      `strategy` - the strategy id
      `collection` - the collection name

  - ### findOffsetBy

    public long findOffsetBy(int tenant, String strategy, String collection)
    Get current offset
    Parameters:
      `tenant` - the tenant
      `strategy` - the strategy id
      `collection` - the collection name we want to reconstruct, bat can be any other unique name (graph)
    Returns:
      the offset value for collection/tenant, 0L if not found