Enum SqlJetPagerState
- java.lang.Object
-
- java.lang.Enum<SqlJetPagerState>
-
- org.tmatesoft.sqljet.core.internal.pager.SqlJetPagerState
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Comparable<SqlJetPagerState>
public enum SqlJetPagerState extends java.lang.Enum<SqlJetPagerState>
The page cache as a whole is always in one of the following states: PAGER_UNLOCK The page cache is not currently reading or writing the database file. There is no data held in memory. This is the initial state. PAGER_SHARED The page cache is reading the database. Writing is not permitted. There can be multiple readers accessing the same database file at the same time. PAGER_RESERVED This process has reserved the database for writing but has not yet made any changes. Only one process at a time can reserve the database. The original database file has not been modified so other processes may still be reading the on-disk database file. PAGER_EXCLUSIVE The page cache is writing the database. Access is exclusive. No other processes or threads can be reading or writing while one process is writing. PAGER_SYNCED The pager moves to this state from PAGER_EXCLUSIVE after all dirty pages have been written to the database file and the file has been synced to disk. All that remains to do is to remove or truncate the journal file and the transaction will be committed. The page cache comes up in PAGER_UNLOCK. The first time a sqlite3PagerGet() occurs, the state transitions to PAGER_SHARED. After all pages have been released using sqlite_page_unref(), the state transitions back to PAGER_UNLOCK. The first time that sqlite3PagerWrite() is called, the state transitions to PAGER_RESERVED. (Note that sqlite3PagerWrite() can only be called on an outstanding page which means that the pager must be in PAGER_SHARED before it transitions to PAGER_RESERVED.) PAGER_RESERVED means that there is an open rollback journal. The transition to PAGER_EXCLUSIVE occurs before any changes are made to the database file, though writes to the rollback journal occurs with just PAGER_RESERVED. After an sqlite3PagerRollback() or sqlite3PagerCommitPhaseTwo(), the state can go back to PAGER_SHARED, or it can stay at PAGER_EXCLUSIVE if we are in exclusive access mode.- Author:
- TMate Software Ltd., Sergey Scherbina (sergey.scherbina@gmail.com)
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description SqlJetLockType
getLockType()
static SqlJetPagerState
getPagerState(SqlJetLockType lockType)
static SqlJetPagerState
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.static SqlJetPagerState[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
UNLOCK
public static final SqlJetPagerState UNLOCK
-
SHARED
public static final SqlJetPagerState SHARED
-
RESERVED
public static final SqlJetPagerState RESERVED
-
EXCLUSIVE
public static final SqlJetPagerState EXCLUSIVE
-
SYNCED
public static final SqlJetPagerState SYNCED
-
-
Method Detail
-
values
public static SqlJetPagerState[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (SqlJetPagerState c : SqlJetPagerState.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static SqlJetPagerState valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is null
-
getLockType
public SqlJetLockType getLockType()
- Returns:
- the lock
-
getPagerState
public static SqlJetPagerState getPagerState(SqlJetLockType lockType)
- Parameters:
lockType
-- Returns:
-
-