-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
some data structure changes #119
base: release/1.7
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,8 +10,29 @@ Several data structures are supported by the SDK, including map, list, queue, an | |
|
||
include::{version-common}@sdk:shared:partial$data-model.adoc[tag=intro] | ||
|
||
include::{version-common}@sdk:shared:partial$data-model.adoc[tag=structures] | ||
|
||
== Data Structures | ||
|
||
Data structures in Couchbase are similar in concept to data structures in Scala: | ||
|
||
* *Map* is an iterable over a set of keys and values, like a https://docs.scala-lang.org/overviews/collections-2.13/maps.html[Scala Map]. | ||
* *List* is is a finite immutable sequence. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "is is" |
||
Values can be placed in the beginning or end of a list, and can be accessed using numeric indexes. | ||
// or can it ? https://docs.scala-lang.org/overviews/collections-2.13/concrete-immutable-collection-classes.html#lists | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes random access is allowed |
||
* *Queue* is a First In First Out (FIFO) sequence, | ||
like a https://docs.scala-lang.org/overviews/collections-2.13/concrete-immutable-collection-classes.html#immutable-queues[Scala Immutable Queue]. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Best to link to the mutable version here too |
||
* *Set* is an iterable with no duplicate values. | ||
// https://docs.scala-lang.org/overviews/collections-2.13/sets.html#inner-main | ||
|
||
These data structures are stored as JSON documents in Couchbase, and can therefore be accessed both using the Query Service and normal key-value operations. | ||
Data structures can also be manipulated using the traditional sub-document and full-document KV APIs. | ||
|
||
Using the data structures API may help your application in two ways: | ||
|
||
* *Simplicity*: Data structures provide high level operations by which you can deal with documents as if they were container data structures. | ||
Adding an item to a dictionary is expressed as `MapAdd`, rather than retrieving the entire document, modifying it locally, and then saving it back to the server. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. MapAdd -> map.apply() maybe |
||
* *Efficiency*: Data structure operations don't transfer the entire document across the network. | ||
Only the relevant data is exchanged between client and server, allowing for less network overhead and shorter latency. | ||
|
||
|
||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's Buffer in Scala, and is mutable. It extends Scala's mutable.AbstractBuffer