[][src]Struct arangors::collection::Collection

pub struct Collection<'a, C: ClientExt> { /* fields omitted */ }

Implementations

impl<'a, C: ClientExt> Collection<'a, C>[src]

pub fn collection_type(&self) -> &CollectionType[src]

pub fn id(&self) -> &str[src]

pub fn name(&self) -> &str[src]

pub fn url(&self) -> &Url[src]

pub fn session(&self) -> Arc<C>[src]

pub fn truncate(&self)[src]

Truncate current collection.

Note

this function would make a request to arango server.

pub async fn properties<'_>(&'_ self) -> Result<CollectionDetails, ClientError>[src]

Fetch the properties of collection

pub async fn document_count<'_>(
    &'_ self
) -> Result<CollectionDetails, ClientError>
[src]

Counts the documents in this collection

pub async fn statistics<'_>(
    &'_ self
) -> Result<CollectionStatistics, ClientError>
[src]

Fetch the statistics of a collection

the result also contains the number of documents and additional statistical information about the collection. Note: This will always load the collection into memory.

Note: collection data that are stored in the write-ahead log only are not reported in the results. When the write-ahead log is collected, documents might be added to journals and datafiles of the collection, which may modify the figures of the collection.

Additionally, the filesizes of collection and index parameter JSON files are not reported. These files should normally have a size of a few bytes each. Please also note that the fileSize values are reported in bytes and reflect the logical file sizes. Some filesystems may use optimisations (e.g. sparse files) so that the actual physical file size is somewhat different. Directories and sub-directories may also require space in the file system, but this space is not reported in the fileSize results.

That means that the figures reported do not reflect the actual disk usage of the collection with 100% accuracy. The actual disk usage of a collection is normally slightly higher than the sum of the reported fileSize values. Still the sum of the fileSize values can still be used as a lower bound approximation of the disk usage.

pub async fn revision_id<'_>(
    &'_ self
) -> Result<CollectionRevision, ClientError>
[src]

Retrieve the collections revision id

The revision id is a server-generated string that clients can use to check whether data in a collection has changed since the last revision check.

pub async fn checksum<'_>(&'_ self) -> Result<CollectionChecksum, ClientError>[src]

Fetch a checksum for the specified collection

Will calculate a checksum of the meta-data (keys and optionally revision ids) and optionally the document data in the collection. The checksum can be used to compare if two collections on different ArangoDB instances contain the same contents. The current revision of the collection is returned too so one can make sure the checksums are calculated for the same state of data.

By default, the checksum will only be calculated on the _key system attribute of the documents contained in the collection. For edge collections, the system attributes _from and _to will also be included in the calculation.

By setting the optional query parameter withRevisions to true, then revision ids (_rev system attributes) are included in the checksumming.

By providing the optional query parameter withData with a value of true, the user-defined document attributes will be included in the calculation too. Note: Including user-defined attributes will make the checksumming slower. this function would make a request to arango server.

pub async fn checksum_with_options<'_>(
    &'_ self,
    with_revisions: bool,
    with_data: bool
) -> Result<CollectionChecksum, ClientError>
[src]

By setting the optional query parameter withRevisions to true, then revision ids (_rev system attributes) are included in the checksumming.

By providing the optional query parameter withData with a value of true, the user-defined document attributes will be included in the calculation too. Note: Including user-defined attributes will make the checksumming slower.

pub async fn load<'_>(
    &'_ self,
    count: bool
) -> Result<CollectionLoad, ClientError>
[src]

Loads a collection into memory. Returns the collection on success.

The request body object might optionally contain the following attribute:

  • count: If set, this controls whether the return value should include the number of documents in the collection. Setting count to false may speed up loading a collection. The default value for count is true.

pub async fn unload<'_>(&'_ self) -> Result<CollectionLoad, ClientError>[src]

Removes a collection from memory. This call does not delete any documents. You can use the collection afterwards; in which case it will be loaded into memory, again.

pub async fn load_indexes<'_>(&'_ self) -> Result<CollectionResult, ClientError>[src]

Load Indexes into Memory

This route tries to cache all index entries of this collection into the main memory. Therefore it iterates over all indexes of the collection and stores the indexed values, not the entire document data, in memory. All lookups that could be found in the cache are much faster than lookups not stored in the cache so you get a nice performance boost. It is also guaranteed that the cache is consistent with the stored data.

For the time being this function is only useful on RocksDB storage engine, as in MMFiles engine all indexes are in memory anyways.

On RocksDB this function honors all memory limits, if the indexes you want to load are smaller than your memory limit this function guarantees that most index values are cached. If the index is larger than your memory limit this function will fill up values up to this limit and for the time being there is no way to control which indexes of the collection should have priority over others.

On success this function returns an object with attribute result set to true

pub async fn change_properties<'_>(
    &'_ self,
    properties: CollectionPropertiesOptions
) -> Result<CollectionDetails, ClientError>
[src]

Changes the properties of a collection.

pub async fn rename<'_, '_>(
    &'_ self,
    name: &'_ str
) -> Result<CollectionRename, ClientError>
[src]

Renames the collection

pub async fn recalculate_count<'_>(
    &'_ self
) -> Result<CollectionResult, ClientError>
[src]

recalculates the document count of a collection Note: this method is specific for the RocksDB storage engine

pub async fn create_document<'_, T>(&'_ self, _doc: Document<T>)[src]

Creates a new document from the document given in the body, unless there is already a document with the _key given. If no _key is given, a new unique _key is generated automatically.

Note

this function would make a request to arango server.

pub async fn update_document<'_, T>(&'_ self, _doc: Document<T>)[src]

Partially updates the document

Note

this function would make a request to arango server.

pub async fn replace_document<'_, T>(&'_ self, _doc: Document<T>)[src]

Replaces the document

Note

this function would make a request to arango server.

pub async fn remove_document<'_, T>(&'_ self, _doc: Document<T>)[src]

Removes a document

Note

this function would make a request to arango server.

Trait Implementations

impl<'a, C: Clone + ClientExt> Clone for Collection<'a, C>[src]

impl<'a, C: Debug + ClientExt> Debug for Collection<'a, C>[src]

Auto Trait Implementations

impl<'a, C> RefUnwindSafe for Collection<'a, C> where
    C: RefUnwindSafe

impl<'a, C> Send for Collection<'a, C> where
    C: Send

impl<'a, C> Sync for Collection<'a, C> where
    C: Send

impl<'a, C> Unpin for Collection<'a, C>

impl<'a, C> UnwindSafe for Collection<'a, C> where
    C: RefUnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.