Class CouchbaseLite

java.lang.Object
com.couchbase.lite.CouchbaseLite

public final class CouchbaseLite extends Object
CouchbaseLite Utility
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    Call to enable the vector search extension library before using theCouchbase Lite database.
    static void
    Initialize CouchbaseLite library.
    static void
    init(boolean debug)
    Initialize CouchbaseLite library.
    static void
    init(boolean debug, File rootDir, File scratchDir)
    Initialize CouchbaseLite library.
    static void
    Shuts down Couchbase Lite's shared executors.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • init

      public static void init()
      Initialize CouchbaseLite library. This method MUST be called before using CouchbaseLite.

      This method expects the current directory to be writeable and will throw an CouchbaseLiteError if it is not. Use init(boolean, File, File) to specify alternative root and scratch directories.

      Throws:
      CouchbaseLiteError - on initialization failure
    • init

      @Internal("This class is not part of the public API") public static void init(boolean debug)
      Initialize CouchbaseLite library. This method MUST be called before using CouchbaseLite.

      This method expects the current directory to be writeable and will throw an CouchbaseLiteError if it is not. Use init(boolean, File, File) to specify alternative root and scratch directories. Debugging mode is not supported for client code. Please use it only when advised to do so by Couchbase Support Engineering

      Parameters:
      debug - true if debugging
      Throws:
      CouchbaseLiteError - on initialization failure
    • init

      @Internal("This class is not part of the public API") public static void init(boolean debug, @NonNull File rootDir, @NonNull File scratchDir)
      Initialize CouchbaseLite library. This method MUST be called before using CouchbaseLite.

      This method allows specifying a default root directory for database files, and the scratch directory used for temporary files (the native library, etc). Both directories must be writable by this process. Debugging mode is not supported for client code. Please use it only when advised to do so by Couchbase Support Engineering

      Parameters:
      debug - true if debugging
      rootDir - default directory for databases
      scratchDir - scratch directory for SQLite
      Throws:
      CouchbaseLiteError - on initialization failure
    • enableVectorSearch

      public static void enableVectorSearch() throws CouchbaseLiteException
      Call to enable the vector search extension library before using theCouchbase Lite database. A CouchbaseLiteException will be thrown if the vector search extension library cannot be found or has an incompatible version with the Couchbase Lite library.

      Note: Must call init() before calling this.

      Throws:
      CouchbaseLiteException
    • shutdown

      public static void shutdown()
      Shuts down Couchbase Lite's shared executors. Call when shutting down your application/container to allow clean JVM exit.

      This method releases shared executors used by Couchbase Lite. It should be called when the host application or container is shutting down to allow the process to terminate cleanly without being blocked by active executors.

      After this call, internal shared executors are stopped and no longer perform work. Couchbase Lite should not be used again until the process restarts.