Skip to main content

Crate rouchdb

Crate rouchdb 

Source
Expand description

§RouchDB

A local-first document database with CouchDB replication protocol support.

RouchDB is the Rust equivalent of PouchDB — it provides a local document store that can sync bidirectionally with CouchDB and compatible servers.

§Quick Start

use rouchdb::Database;

// In-memory database (for testing)
let db = Database::memory("mydb");

// Persistent database (redb)
let db = Database::open("path/to/mydb.redb", "mydb")?;

// Put a document
let result = db.put("doc1", serde_json::json!({"name": "Alice"})).await?;

// Get a document
let doc = db.get("doc1").await?;

// Replicate to/from CouchDB
let remote = Database::http("http://localhost:5984/mydb");
db.replicate_to(&remote).await?;

Structs§

AllDocsOptions
AllDocsResponse
AllDocsRow
AllDocsRowValue
AttachmentMeta
AuthClient
A client that handles CouchDB authentication.
BuiltIndex
A built in-memory index: sorted entries of (composite_key, doc_id).
BulkDocsOptions
BulkGetDoc
BulkGetError
BulkGetItem
BulkGetResponse
BulkGetResult
ChangeEvent
ChangeReceiver
A receiver for change notifications.
ChangeRev
ChangeSender
A sender for change notifications. Adapters use this to notify listeners when documents are written.
ChangesHandle
Handle for a live changes stream. Dropping or cancelling stops the stream.
ChangesOptions
ChangesResponse
ChangesStreamOptions
Configuration for a changes stream.
CreateIndexResponse
Result of creating an index.
Database
A high-level database handle that wraps any adapter implementation.
DbInfo
DesignDocument
A CouchDB design document.
DocMetadata
Internal metadata stored per document in the adapter.
DocResult
Document
A CouchDB-compatible document.
ExplainIndex
Description of the index used by a query.
ExplainResponse
Response from explain() describing how a query would be executed.
FindOptions
Options for a Mango find query.
FindResponse
Result of a find query.
GetAttachmentOptions
GetOptions
HttpAdapter
HTTP adapter that talks to a remote CouchDB instance.
IndexDefinition
Definition of a Mango index.
IndexFields
The fields portion of an index definition.
IndexInfo
Information about an existing index.
LiveChangesStream
A live changes stream that yields change events as they happen.
MemoryAdapter
In-memory adapter for RouchDB. All data is held in RAM.
Partition
A partitioned view of a database.
PersistentViewIndex
A persistent view index that is incrementally updated.
PurgeResponse
PutResponse
RedbAdapter
Persistent adapter backed by redb.
ReplicationHandle
Handle for a live replication task. Dropping this cancels the replication.
ReplicationOptions
Replication configuration.
ReplicationResult
Result of a completed replication.
RevInfo
Revision info entry returned when revs_info is requested.
Revision
A CouchDB revision identifier: {pos}-{hash}.
RevsDiffResponse
RevsDiffResult
SecurityDocument
SecurityGroup
Session
A CouchDB session response.
UserContext
User context from a session response.
ViewDef
A view definition containing map and optional reduce functions.
ViewEngine
Engine for building and querying persistent views.
ViewQueryOptions
Options for querying a view.
ViewResult
Result of querying a view.

Enums§

ChangesEvent
Lifecycle events emitted by a live changes stream.
ChangesStyle
Controls which revisions appear in each change event.
OpenRevs
ReduceFn
Built-in reduce functions matching CouchDB’s built-ins.
ReplicationEvent
Events emitted during replication for progress tracking.
ReplicationFilter
Filter for selective replication.
RouchError
All errors that RouchDB can produce.
Seq
A database sequence identifier.
SortField
A single sort field with direction.
StaleOption
Controls whether the index is rebuilt before querying.

Traits§

Adapter
The trait all storage adapters must implement.
Plugin
Plugin trait for extending Database behavior.

Functions§

build_index
Build an index from all documents in an adapter.
find
Execute a Mango find query against an adapter.
is_deleted
Check if the document’s winning revision is deleted.
live_changes
Start a live changes stream that sends events through an mpsc channel.
live_changes_events
Start a live changes stream that emits lifecycle events.
matches_selector
Check if a document matches a Mango selector.
query_view
Run a temporary (ad-hoc) map/reduce query.
replicate
Run a one-shot replication from source to target.
replicate_live
Run continuous (live) replication from source to target.
replicate_with_events
Run a one-shot replication with event streaming.
winning_rev
Determine the winning revision of a document.

Type Aliases§

ChangesFilter
A filter function for changes events.
Result