DatabaseAccessManager

public class DatabaseAccessManager

Manages the read and write access to the database.

Author:

tf

Methods

acquireReadAccess

public Access acquireReadAccess(TransactionInterface t)

Acquire read access. This method returns the Access object as soon as there are no active write permits.

The returned Access object can be used to read in the data base back-end.

Read access can be acquired parallel to other threads having read access or while another thread has reserved write access. As soon as any thread has requested to acquire write access, all other threads have to wait.

Parameters:
Throws:
Returns:

Access object which holds and abstract away all connection details.

acquireWriteAccess

public Access acquireWriteAccess(WriteTransactionInterface wt)

Acquire write access. This method returns the Access object as soon as all already acquired read access permits have been released. When the write access is acquired, no other access can be acquired (read or write).

The returned Access object can be used to read and write in the data base back-end.

Parameters:
Throws:
Returns:

Access object which holds and abstract away all connection details.

getAccountAccess

public static Access getAccountAccess(AccessControlTransaction t)

Special access to be used for AccessControlTransactions, mainly authentication and authorization.

Parameters:
  • t

getInfoAccess

public static Access getInfoAccess(Info i)

Special access to be used by Info.

Parameters:
  • i

getInitAccess

public static Access getInitAccess(Initialization initialization)

Special access to be used during the Initialization of the caosdb server.

Parameters:
  • initialization

getInstance

public static DatabaseAccessManager getInstance()

reserveWriteAccess

public Access reserveWriteAccess(WriteTransactionInterface wt)

Reserve write access. This method returns the Access object as soon as there is no other reserved or acquired write access.

The returned Access object can be used to read in the data base back-end.

The reservation has no effect on granting of read access permits, but only one thread may at any time reserve or acquire write access.

Parameters:
Throws:
Returns:

Access object which holds and abstract away all connection details.

whoHasReservedWriteAccess

public static Thread whoHasReservedWriteAccess()

Return the thread which has successfully reserved write access. This is the thread which will be the next to actually acquire write access.