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 StringDB_EXTENSION
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidbeginTransaction()abstract voidclose()voidcloseDb()static voidcopyDb(String sourcePath, String parentDir, String name, int flags, int algorithm, byte[] encryptionKey)C4Documentcreate(String docID, FLSliceResult body, int flags)C4DatabaseObservercreateDatabaseObserver(Object context, C4DatabaseObserverListener listener)C4DocumentObservercreateDocumentObserver(String docID, Object context, C4DocumentObserverListener listener)voidcreateIndex(String name, String queryExpression, AbstractIndex.QueryLanguage queryLanguage, AbstractIndex.IndexType indexType, String language, boolean ignoreDiacritics)C4QuerycreateJsonQuery(String expression)C4ReplicatorcreateLocalReplicator(C4Database otherLocalDB, int push, int pull, byte[] options, C4ReplicatorListener listener, C4ReplicationFilter pushFilter, C4ReplicationFilter pullFilter, AbstractReplicator replicatorContext)C4QuerycreateN1qlQuery(String expression)C4ReplicatorcreateRemoteReplicator(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)C4ReplicatorcreateTargetReplicator(C4Socket openSocket, int push, int pull, byte[] options, C4ReplicatorListener listener, Object replicatorContext)voiddeleteDb()voiddeleteIndex(String name)static voiddeleteNamedDb(String directory, String name)voidendTransaction(boolean commit)C4Documentget(String docID)C4Documentget(String docID, boolean mustExist)C4BlobStoregetBlobStore()StringgetCookies(URI uri)static C4DatabasegetDatabase(String parentDirPath, String name, int flags, int algorithm, byte[] encryptionKey)static FilegetDatabaseFile(File directory, String name)StringgetDbDirectory()StringgetDbFileName()StringgetDbName()StringgetDbPath()longgetDocumentCount()longgetExpiration(String docID)FLValuegetIndexesInfo()byte[]getPublicUUID()FLEncodergetSharedFleeceEncoder()static C4DatabasegetUnmanagedDatabase(long peer)booleanperformMaintenance(MaintenanceType type)voidpurgeDoc(String docID)C4Documentput(byte[] body, String docID, int revFlags, boolean existingRevision, boolean allowConflict, String[] history, boolean save, int maxRevTreeDepth, int remoteDBID)voidrekey(int keyType, byte[] newKey)voidsetCookie(URI uri, String setCookieHeader)voidsetExpiration(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
-
-