- Key Concepts
- Understanding edgeEngine Data Management
Understanding edgeEngine Data Management
Purpose
The purpose of this document is to describe how to use the data storage capabilities provided by the edgeEngine Runtime.
Intended Readers
The intended readers of this document are software developers, system engineers, application architects, deployment and security personnel, and other technical professionals who want to understand the details of Data Management under edgeEngine.
What You Will Learn from this Document
After reading this document, you will:
- Understand the data storage architecture provided to microservices running under the edgeEngine Runtime
- Have a working knowledge of some of the use cases that the edgeEngine Runtime's data storage architecture can satisfy
What You Need to Know Before You Start
In order to get the full benefit from reading this document, you need to have:
- An general understanding of key-value storage
- A general understanding of the edgeEngine Runtime and how it supports microservices
- A general understanding of microservice development under edgeEngine
The Essentials of edgeEngine Data Management
The edgeEngine Runtime is a serverless environment that provides key-value storage capabilities to a microservice by default. The mechanism for storing and retrieving key-value data is the edgeEngine Context Object. (You can read about the details of the edgeEngine Context Object in the Key Concepts section, Understanding the edgeEngine Context Object).
The Context Object has a property storage,
which is a JavaScript object that has the functions necessary to manage key-value data. Listing 1 below shows the functions that are associated with the storage
property.
1: context2: ├── storage3: │ ├── getItem(key)4: │ ├── setItem(key, value)5: │ ├── eachItem(callback(key, value))6: │ ├── removeItem(key)7: │ ├── saveFile(fileName, base64EncodedString)8: │ └── deleteFile(fileName)
Listing 1: The functions of the context.storage
object.
Developers use the context.storage
functions to set, retrieve and delete key-value data. Also, developers can traverse all the stored key-value pairs in the given edgeEngine node using the context.storage.forEach()
function.
In addition to storing string and numeric values, the context.storage
object allows developers to store the contents of a file according to filename using the function context.storage.saveFile(fileName, base64EncodedString)
.
The scope of storage in using the Context Object
All data stored by a microservice is local to the particular device on which the edgeEngine Runtime operates. Sharing data between microservices on various devices requires that developers expose the data stored on a particular edgeEngine enabled device by way of a microservice endpoint that is custom coded. There is no automatic way to access data. All data access is provided by way of custom-coded microservices.
Interesting Use Cases
[TO BE PROVIDED]