Class

unicorn.unibase

Table

Related Doc: package unibase

Permalink

class Table extends UpdateOps

Tables are the data containers of documents. A document is simply a JSON object with a unique id (the _id field), which is similar to the primary key in relational database. The key can be arbitrary JSON value including Object and Array. However, they are some limitations in practice:

Linear Supertypes
UpdateOps, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Table
  2. UpdateOps
  3. AnyRef
  4. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new Table(table: BigTable, meta: JsObject)

    Permalink

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. val appendOnly: Boolean

    Permalink

    True if the table is append only.

  5. def apply(id: JsValue, fields: String*): Option[JsObject]

    Permalink

    Gets a document.

    Gets a document.

    id

    document id.

    fields

    top level fields to retrieve.

    returns

    an option of document. None if it doesn't exist.

  6. def apply(id: BsonObjectId, fields: String*): Option[JsObject]

    Permalink

    Gets a document.

  7. def apply(id: UUID, fields: String*): Option[JsObject]

    Permalink

    Gets a document.

  8. def apply(id: Date, fields: String*): Option[JsObject]

    Permalink

    Gets a document.

  9. def apply(id: String, fields: String*): Option[JsObject]

    Permalink

    Gets a document.

  10. def apply(id: Long, fields: String*): Option[JsObject]

    Permalink

    Gets a document.

  11. def apply(id: Int, fields: String*): Option[JsObject]

    Permalink

    Gets a document.

  12. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  13. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  14. def contains(id: JsValue): Boolean

    Permalink

    Retruns true if the document exists.

  15. def delete(id: JsValue): Unit

    Permalink

    Removes a document.

    Removes a document.

    id

    the document id.

  16. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  17. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  18. val families: Seq[(String, Seq[ByteArray])]

    Permalink

    Column families storing document fields.

    Column families storing document fields. There may be other column families in the table for meta data or index.

  19. def familyOf(field: String): String

    Permalink

    Returns the column family of a field.

    Returns the column family of a field.

    Definition Classes
    TableUpdateOps
  20. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  21. def get(projection: JsObject): Option[JsObject]

    Permalink

    A query may include a projection that specifies the fields of the document to return.

    A query may include a projection that specifies the fields of the document to return. The projection limits the disk access and the network data transmission. Note that the semantics is different from MongoDB due to the design of BigTable. For example, if a specified field is a nested object, there is no easy way to read only the specified object in BigTable. Intra-row scan may help but not all BigTable implementations support it. And if there are multiple nested objects in request, we have to send multiple Get requests, which is not efficient. Instead, we return the whole object of a column family if some of its fields are in request. This is usually good enough for hot-cold data scenario. For instance of a table of events, each event has a header in a column family and event body in another column family. In many reads, we only need to access the header (the hot data). When only user is interested in the event details, we go to read the event body (the cold data). Such a design is simple and efficient. Another difference from MongoDB is that we don't support the excluded fields.

    projection

    an object that specifies the fields to return. The _id field should be included to indicate which document to retrieve.

    returns

    the projected document. The _id field will be always included.

  22. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  23. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  24. val idColumnQualifier: Array[Byte]

    Permalink

    The column qualifier of $id field.

  25. def insert(docs: JsArray): Unit

    Permalink

    Inserts an array of documents.

    Inserts an array of documents. The elements of JsArray must be JsObject. Note that this is not ACID. If an exception thrown during insertion of one document, the elements front of it were already inserted and won't be rollback.

    docs

    an array of documents.

  26. def insert(doc: JsObject): Unit

    Permalink

    Inserts a document.

    Inserts a document. Different from upsert, this operation checks if the document already exists first.

    doc

    the document.

    returns

    true if the document is inserted, false if the document already existed.

  27. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  28. def key(id: JsValue): Array[Byte]

    Permalink

    Returns the row key of a document.

    Returns the row key of a document.

    Definition Classes
    TableUpdateOps
  29. val name: String

    Permalink

    The table name.

  30. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  31. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  32. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  33. val serializer: DocumentSerializer

    Permalink

    Document serializer.

  34. def set(id: JsValue, doc: JsObject): Unit

    Permalink

    The $set operator replaces the values of fields.

    The $set operator replaces the values of fields.

    The document key _id and _tenant should not be set.

    If the field does not exist, $set will add a new field with the specified value, provided that the new field does not violate a type constraint.

    In MongoDB, $set will create the embedded documents as needed to fulfill the dotted path to the field. For example, for a $set {"a.b.c" : "abc"}, MongoDB will create the embedded object "a.b" if it doesn't exist. However, we don't support this behavior because of the performance considerations. We suggest the the alternative syntax {"a.b" : {"c" : "abc"}}, which has the equivalent effect.

    To set an element of an array by the zero-based index position, concatenate the array name with the dot (.) and zero-based index position.

    id

    the id of document.

    doc

    the fields to update.

    Definition Classes
    UpdateOps
  35. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  36. val table: BigTable

    Permalink

    Underlying BigTable.

    Underlying BigTable.

    Definition Classes
    TableUpdateOps
  37. var tenant: JsValue

    Permalink

    Optional tenant id in case of multi-tenancy.

  38. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  39. def unset(id: JsValue, doc: JsObject): Unit

    Permalink

    The $unset operator deletes particular fields.

    The $unset operator deletes particular fields.

    The document key _id & _tenant should not be unset.

    If the field does not exist, then $unset does nothing (i.e. no operation).

    When deleting an array element, $unset replaces the matching element with undefined rather than removing the matching element from the array. This behavior keeps consistent the array size and element positions.

    Note that we don't really delete the field but set it as JsUndefined so that we keep the history and be able to time travel back. Otherwise, we will lose the history after a major compaction.

    id

    the id of document.

    doc

    the fields to delete.

    Definition Classes
    UpdateOps
  40. def update(doc: JsObject): Unit

    Permalink

    Updates a document.

    Updates a document. The supported update operators include

    • $set: Sets the value of a field in a document.
    • $unset: Removes the specified field from a document.
    doc

    the document update operators.

  41. def upsert(docs: JsArray): Seq[JsValue]

    Permalink

    Upserts an array of documents.

    Upserts an array of documents. The elements of JsArray must be JsObject.

    docs

    an array of documents.

    returns

    the list of document ids.

  42. def upsert(doc: JsObject): JsValue

    Permalink

    Upserts a document.

    Upserts a document. If a document with same key exists, it will overwritten. The _id field of document will be used as the primary key in the table. If the document doesn't have _id field, a random UUID will be generated as _id.

    doc

    the document.

    returns

    the document id.

  43. val valueSerializer: ColumnarJsonSerializer

    Permalink

    For UpdateOps.

    For UpdateOps.

    Definition Classes
    TableUpdateOps
  44. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  45. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  46. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from UpdateOps

Inherited from AnyRef

Inherited from Any

Ungrouped