mimik Developer Documentation

Understanding the edgeEngine Context Object

Purpose

The purpose of this document describe the form and function of the Context Object that injected automatically into microservices running under the edgeEngine Runtime

Intended Readers

The intended readers of this document are software developers, system engineers, application architects, deployment personnel and other technical professionals who are concerned with the conceptual and practical aspects of an edgeEngine Context.

What You Will Learn from this Document

After reading this document you will:

  • Understand what an edgeEngine Context is
  • Understand the attributes and functions of an edgeEngine Context
  • Understand how to use the edgeEngine Context when programming a microservice

What You Need to Know Before You Start

In order to get full benefit from reading this document, you need to have:

  • A general understanding of microservices and the deployment of microservices in a distributed environment
  • An understanding the the edgeEngine Runtime and how it supports microservices
  • An understanding of microservices as implemented under the edgeEngine runtime

Understanding edgeEngine Context Object

The edgeEngine Context Object is a JavaScript object that the edgeEngine Runtime makes available to a microservice running on an edgeEngine node.

Microservices run under the edgeEngine Runtime in a serverless manner. This means that the edgeEngine Runtime provides a web server to receive requests as well as send responses to those using the given microservice. Also, the edgeEngine Context Object provides storage and network connection capabilities by default.

The edgeEngine Context Object is the mechanism by which a developers can interact with the default serverless components. All a developer needs to do is program the logic for the particular microservice.

The Structure of the edgeEngine Context Object

The edgeEngine Context Object is composed of a number of root level properties. The properties are env, storage, http and edge. These root level properties have subordinate properties are either scalar, object or function types. Listing 1 below shows the structure of the edgeEngine Context Object with root level and subordinate properties.

context
├── env
├── storage
│ ├── getItem(key)
│ ├── setItem(key, value)
│ ├── eachItem(callback(key, value))
│ ├── removeItem(key)
│ ├── saveFile(fileName, base64EncodedString)
│ └── deleteFile(fileName)
├── http
│ └── request(httpClientOption)
└── edge
├── decryptEncryptedNodesJson(decryptNodesOption)
└── requestBep(requestBepOption)
httpClientOption
├── type
├── data
├── url
├── authorization
├── success(result)
└── error(result)
decryptNodesOption
├── type
├── token
├── data
├── success(result)
└── error(result)
requestBepOption
├── success(result)
└── error(result)

Listing 1: The structure of the edgeEngine Context Object

[MORE TO COME: REFERENCE TO API DOCUMENTATION HERE]

Working with the edgeEngine Context Object when programming microservices

[TO BE PROVIDED]