Package com.couchbase.lite.internal.core
Class C4Database
- java.lang.Object
-
- com.couchbase.lite.internal.core.C4NativePeer
-
- com.couchbase.lite.internal.core.C4Database
-
- All Implemented Interfaces:
AutoCloseable
public abstract class C4Database extends C4NativePeer
-
-
Field Summary
Fields Modifier and Type Field Description static String
DB_EXTENSION
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
beginTransaction()
abstract void
close()
void
closeDb()
static void
copyDb(String sourcePath, String parentDir, String name, int flags, int algorithm, byte[] encryptionKey)
C4Document
create(String docID, FLSliceResult body, int flags)
C4DatabaseObserver
createDatabaseObserver(Object context, C4DatabaseObserverListener listener)
C4DocumentObserver
createDocumentObserver(String docID, Object context, C4DocumentObserverListener listener)
void
createIndex(String name, String queryExpression, AbstractIndex.QueryLanguage queryLanguage, AbstractIndex.IndexType indexType, String language, boolean ignoreDiacritics)
C4Query
createJsonQuery(String expression)
C4Replicator
createLocalReplicator(C4Database otherLocalDB, int push, int pull, byte[] options, C4ReplicatorListener listener, C4ReplicationFilter pushFilter, C4ReplicationFilter pullFilter, AbstractReplicator replicatorContext)
C4Query
createN1qlQuery(String expression)
C4Replicator
createRemoteReplicator(String scheme, String host, int port, String path, String remoteDatabaseName, int push, int pull, byte[] options, C4ReplicatorListener listener, C4ReplicationFilter pushFilter, C4ReplicationFilter pullFilter, AbstractReplicator replicatorContext, SocketFactory socketFactoryContext, int framing)
C4Replicator
createTargetReplicator(C4Socket openSocket, int push, int pull, byte[] options, C4ReplicatorListener listener, Object replicatorContext)
void
deleteDb()
void
deleteIndex(String name)
static void
deleteNamedDb(String directory, String name)
void
endTransaction(boolean commit)
C4Document
get(String docID)
C4Document
get(String docID, boolean mustExist)
C4BlobStore
getBlobStore()
String
getCookies(URI uri)
static C4Database
getDatabase(String parentDirPath, String name, int flags, int algorithm, byte[] encryptionKey)
static File
getDatabaseFile(File directory, String name)
String
getDbDirectory()
String
getDbFileName()
String
getDbName()
String
getDbPath()
long
getDocumentCount()
long
getExpiration(String docID)
FLValue
getIndexesInfo()
byte[]
getPublicUUID()
FLEncoder
getSharedFleeceEncoder()
static C4Database
getUnmanagedDatabase(long peer)
boolean
performMaintenance(MaintenanceType type)
void
purgeDoc(String docID)
C4Document
put(byte[] body, String docID, int revFlags, boolean existingRevision, boolean allowConflict, String[] history, boolean save, int maxRevTreeDepth, int remoteDBID)
void
rekey(int keyType, byte[] newKey)
void
setCookie(URI uri, String setCookieHeader)
void
setExpiration(String docID, long timestamp)
-
Methods inherited from class com.couchbase.lite.internal.core.C4NativePeer
toString
-
-
-
-
Field Detail
-
DB_EXTENSION
public static final String DB_EXTENSION
- See Also:
- Constant Field Values
-
-
Method Detail
-
copyDb
public static void copyDb(@NonNull String sourcePath, @NonNull String parentDir, @NonNull String name, int flags, int algorithm, @Nullable byte[] encryptionKey) throws LiteCoreException
- Throws:
LiteCoreException
-
deleteNamedDb
public static void deleteNamedDb(@NonNull String directory, @NonNull String name) throws LiteCoreException
- Throws:
LiteCoreException
-
getDatabaseFile
@NonNull public static File getDatabaseFile(@NonNull File directory, @NonNull String name)
-
getUnmanagedDatabase
@NonNull public static C4Database getUnmanagedDatabase(long peer)
-
getDatabase
@NonNull public static C4Database getDatabase(@NonNull String parentDirPath, @NonNull String name, int flags, int algorithm, @Nullable byte[] encryptionKey) throws LiteCoreException
- Throws:
LiteCoreException
-
close
public abstract void close()
-
getDbPath
@Nullable public String getDbPath()
-
getDbDirectory
@Nullable public String getDbDirectory()
-
getDbFileName
@Nullable public String getDbFileName()
-
getDbName
@Nullable public String getDbName()
-
rekey
public void rekey(int keyType, byte[] newKey) throws LiteCoreException
- Throws:
LiteCoreException
-
closeDb
public void closeDb() throws LiteCoreException
- Throws:
LiteCoreException
-
deleteDb
public void deleteDb() throws LiteCoreException
- Throws:
LiteCoreException
-
getDocumentCount
public long getDocumentCount()
-
purgeDoc
public void purgeDoc(String docID) throws LiteCoreException
- Throws:
LiteCoreException
-
getPublicUUID
@NonNull public byte[] getPublicUUID() throws LiteCoreException
- Throws:
LiteCoreException
-
beginTransaction
public void beginTransaction() throws LiteCoreException
- Throws:
LiteCoreException
-
endTransaction
public void endTransaction(boolean commit) throws LiteCoreException
- Throws:
LiteCoreException
-
getSharedFleeceEncoder
@NonNull public FLEncoder getSharedFleeceEncoder()
-
get
@NonNull public C4Document get(@NonNull String docID) throws LiteCoreException
- Throws:
LiteCoreException
-
setExpiration
public void setExpiration(@NonNull String docID, long timestamp) throws LiteCoreException
- Throws:
LiteCoreException
-
getExpiration
public long getExpiration(@NonNull String docID) throws LiteCoreException
- Throws:
LiteCoreException
-
create
@NonNull public C4Document create(@NonNull String docID, @Nullable FLSliceResult body, int flags) throws LiteCoreException
- Throws:
LiteCoreException
-
createDatabaseObserver
@NonNull public C4DatabaseObserver createDatabaseObserver(@NonNull Object context, @NonNull C4DatabaseObserverListener listener)
-
createDocumentObserver
@NonNull public C4DocumentObserver createDocumentObserver(@NonNull String docID, @NonNull Object context, @NonNull C4DocumentObserverListener listener)
-
getBlobStore
@NonNull public C4BlobStore getBlobStore() throws LiteCoreException
- Throws:
LiteCoreException
-
createJsonQuery
@NonNull public C4Query createJsonQuery(@NonNull String expression) throws LiteCoreException
- Throws:
LiteCoreException
-
createN1qlQuery
@NonNull public C4Query createN1qlQuery(@NonNull String expression) throws LiteCoreException
- Throws:
LiteCoreException
-
createIndex
public void createIndex(@NonNull String name, @NonNull String queryExpression, @NonNull AbstractIndex.QueryLanguage queryLanguage, @NonNull AbstractIndex.IndexType indexType, @Nullable String language, boolean ignoreDiacritics) throws LiteCoreException
- Throws:
LiteCoreException
-
deleteIndex
public void deleteIndex(String name) throws LiteCoreException
- Throws:
LiteCoreException
-
getIndexesInfo
@NonNull public FLValue getIndexesInfo() throws LiteCoreException
- Throws:
LiteCoreException
-
performMaintenance
public boolean performMaintenance(MaintenanceType type) throws LiteCoreException
- Throws:
LiteCoreException
-
createRemoteReplicator
@NonNull public C4Replicator createRemoteReplicator(@Nullable String scheme, @Nullable String host, int port, @Nullable String path, @Nullable String remoteDatabaseName, int push, int pull, @Nullable byte[] options, @Nullable C4ReplicatorListener listener, @Nullable C4ReplicationFilter pushFilter, @Nullable C4ReplicationFilter pullFilter, @NonNull AbstractReplicator replicatorContext, @Nullable SocketFactory socketFactoryContext, int framing) throws LiteCoreException
- Throws:
LiteCoreException
-
createLocalReplicator
@NonNull public C4Replicator createLocalReplicator(@NonNull C4Database otherLocalDB, int push, int pull, @Nullable byte[] options, @Nullable C4ReplicatorListener listener, @Nullable C4ReplicationFilter pushFilter, @Nullable C4ReplicationFilter pullFilter, @NonNull AbstractReplicator replicatorContext) throws LiteCoreException
- Throws:
LiteCoreException
-
createTargetReplicator
@NonNull public C4Replicator createTargetReplicator(@NonNull C4Socket openSocket, int push, int pull, @Nullable byte[] options, @Nullable C4ReplicatorListener listener, @NonNull Object replicatorContext) throws LiteCoreException
- Throws:
LiteCoreException
-
setCookie
public void setCookie(@NonNull URI uri, @NonNull String setCookieHeader) throws LiteCoreException
- Throws:
LiteCoreException
-
getCookies
@Nullable public String getCookies(@NonNull URI uri) throws LiteCoreException
- Throws:
LiteCoreException
-
get
@NonNull public C4Document get(@NonNull String docID, boolean mustExist) throws LiteCoreException
- Throws:
LiteCoreException
-
put
@NonNull public C4Document put(@NonNull byte[] body, @NonNull String docID, int revFlags, boolean existingRevision, boolean allowConflict, @NonNull String[] history, boolean save, int maxRevTreeDepth, int remoteDBID) throws LiteCoreException
- Throws:
LiteCoreException
-
-