Reading Assignment: Multi-Index Database API

  1. for data needed between invocations of the contract
  2. find, emplace, modify
  3. provides a structured way to access the data
1 Like
  1. Why do we need to have persistent storage?

We need to have persistent storage as it contains the EOS blockchain state and therefore must be available at all times. This includes the tables that hold order books, account balances, contract statuses, and voting data. Persistent storage is designed to survive independently of any running instance, it can be used for any data that needs to be reused. Reuse can be either by different instances or beyond the life of a specific instance.

  1. What are the functions to manage a database?

The primary key must be unique and an unsigned 64-bit integer type.

  1. What are the benefits of having iterators instead of a traditional key-value storage option?

The main benefit is that they allow the code to be less type-dependent. The iterator will still work even if you change the underlying container type that is being iterated. Iterators are class objects which encapsulate safe node pointers that are only exposed via the iterator’s methods. Iterators can be used to provide differing table views where the table has multiple secondary indices.

1 Like
  1. Why do we need to have persistent storage?
    Through persistence storage, a Multi-Index DB, data can be stored and accessed in the Block Chain: The Boost Multi-index Containers Library provides a class template named multi_index_container which enables the construction of containers maintaining one or more indices with different sorting and access semantics(https://www.boost.org/doc/libs/1_59_0/libs/multi_index/doc/index.html).

  2. What are the functions to manage a database?

  • Querying an entry with .find
  • Creating new entries with .emplace
  • Modifying existing entries with .modify
  1. What are the benefits of having iterators instead of a traditional key-value storage option?
    Iterators permit multiple scopes views in a multi-index-table database. Making data manipulation easier.
1 Like
  1. Why do we need to have persistent storage?
    We need persistent storage to store data permanently on an EOS blockchain since all values called by a contract exist only temporarily and was eliminated after a contract function calling for the value ends.

  2. What are the functions to manage a database?
    There are functions to create a new database entry, to query an entry, and to modify an entry.

  3. What are the benefits of having iterators instead of a traditional key-value storage option?
    As the content of a search is cached in an iterator, repeated calling of the intended search object can be quickly done by calling the iterator. Iterators can also facilitate quick lookups by moving forward or backward within the records by built-in methods in the iterator.

1 Like
  1. Why do we need to have persistant storage?

The EOS database is a special feature that enables you to store indexed data into the blockchain, formatted inside defined data structures.

  1. What are the functions to manage a database?

Action and table

  1. What are the benefits of having iterators instead of a traditional key-value storage option?

The iterator on itself can return the current object by object dereference or as object instance. The iterator on itself can then be iterated through to retrieve the next or previous object inside the database. This can be useful during iteration through objects in that table.

1 Like
  1. Why do we need to have persistant storage?
    To store data to access at a later time.

  2. What are the functions to manage a database?
    Query .find
    Create .emplace
    Modify .modify

  3. What are the benefits of having iterators instead of a traditional key-value storage option?
    More efficient.

1 Like
  1. Why do we need to have persistant storage?
    We need to have persistant storage so we can store data before then.
2. What are the functions to manage a database?
  *In order to manage a database we need 3 functions find: "Querying an entry with",  Emplace: "Creating new entries with",  modify: "Modifying existing entries with".*
  1. What are the benefits of having iterators instead of a traditional key-value storage option?
    Since we have iterators we can have lots of table views, the table can have lots of other indexes
1 Like
  1. Why do we need to have persistant storage?
    to save all transactions, view data at a later time.

  2. What are the functions to manage a database?
    we use 3 functions, .find, .emplace, .modify.

  3. What are the benefits of having iterators instead of a traditional key-value storage option? multiple table views

1 Like

1.) To save data even when the contract isn’t active
2.) querying with: .find
creating new entry with: .emplace
Modifying entries with .modify
3.) Iterators have some features.
can return an object by object dereference or as object instance
can iterate through objects = next, previous

1 Like
  1. Why do we need to have persistant storage?

Saving data over time, even when it is not being used at the moment.

  1. What are the functions to manage a database?
    .find, .emplace and .modify

  2. What are the benefits of having iterators instead of a traditional key-value storage option?

iterate can search through the whole table, more effective

1 Like

:one: Why do we need to have persistent storage?

Persistent storage is crucial to maintaining a useful ecosystem. Persistent storage in economies, large and wide, retain balances and snapshots of truth.
Without persistent storage, the only way to gather this truth would be by storing the data on centralized servers which could be compromised.

:two: What are the functions to manage a database?

You may use:

  • .find to query the database
  • .emplace to create a new entry in the database, and
  • .modify to modify existing entries in the database.

:three: What are the benefits of having iterators instead of a traditional key-value storage option?

A key-value pair is unable to iterate through entries in a table. It will only return one value for a given key.
Iterators, on the other hand - can jump through entries within the database, and either query individual entries, or perform some calculation on each entry.

1 Like

1 - Why do we need to have persistent storage?

We need to have persistent storage so we can save critical data and to reduce the chance of data loss between sessions.

  • Tables are used to store persistent data in EOS.

2 - What are the functions to manage a database?

The functions to manage a database are:

  1. .find() - used to query an entry

  2. .emplace() - used to create new entries

  • arguments:
       emplace(
           uint64_t payer,
           Lambda&& constructor
       )
  1. .modify() - used to modify existing entries
  • arguments:
        modify(
            const T& obj,
            uint64_t payer,
            Lambda&& updater
        )

3 - What are the benefits of having iterators instead of a traditional key-value storage option?

Iterators allow you to walk through the table and get different views of the table data, whereas key-value can only return one value for the given key.

1 Like
  1. Why do we need to have persistant storage?

So you dont lose your Data each time your device is shut down.
Persistent storage is any data storage device that retains data after power to that device is shut off . It is also sometimes referred to as non-volatile storage. Magnetic media, such as hard disk drives and tape are common types of persistent storage, as are the various forms of Optical media such as DVD.

  1. What are the functions to manage a database?
    • Data Storage Management. …

• Security Management. …

• Backup and Recovery Management. …

• Database Access Language and Application Programming Interface. …

• Data Dictionary Management. …

• Data Transformation and Presentation. …

• Multi User Access Control. …

• Data Integrity Management.

  1. What are the benefits of having iterators instead of a traditional key-value storage option?

Use of an iterator simplifies the code and makes it general. Benefits of using this iterator API include: treats variables of all types, sizes, and shapes uniformly, whether they fit in memory or not, even if a single row won’t fit in memory . makes recursion unnecessary in handling arrays of arbitrary dimensionality.