-
Notifications
You must be signed in to change notification settings - Fork 0
Home
MyNoSqlServer is a caching concept which makes possible to keep cached data locally at the microservices.
- MyNoSqlServer - Main node which has the ability to keep and update data;
- MyNoSqlServerNode - The read replica, which synchronizes data from the Main node and keeps it at the local data center. (https://github.com/MyJetTools/my-no-sql-node)
- MyNoSqlDataWriter - the client Library, which gives the ability to write data to the main node; (https://github.com/MyJetTools/my-no-sql-data-writer).
- MyNoSqlTcpReader - the client library, which uses TCP/IP Binary protocol to synchronize to the microservice once it Updated in Master Node. (https://github.com/MyJetTools/my-no-sql-tcp-reader)
Data is kept in DbRows. Each DbRow has reserved fields:
- PartitionKey: String; - name of partition. Should be specified by the client.
- RowKey: String; - name of row. Should be specified by the client.
- Timestamp: String; - Timestamp of the moment DbRow is inserted (generated by the server). Format: YYYY-MM-DDThh:mm:ss.ms;
- Expires: String - optional parameter. If it's not null - it must be formatted as YYYY-MM-DDThh:mm:ss.ms. If it's not null - record will be deleted after the Expires moment.
Example of the DbRow
{
"PartitionKey": "Partition Id",
"RowKey": "RowKeyValue",
"Timestamp": "2020-01-02T12:00:15.123456",
"Expires": "2020-01-02T12:00:17.123456",
"CustomField1": 0.14,
"CustomField2": "123",
"CustomField3": [1, 2, 3]
}
To Identify the DbRow your developer have to specify:
- TableName - which table is DbRow kept in;
- PartitionKey - which DbPartition is DbRow kept in;
- RowKey - Id of DbRow;
This way
- if we specify TableName only - we get all the Rows of all partitions table;
- if we specify TableName + PartitionKey - we get all the rows of the Partition;
- if we specify TableName + PartitionKey + RowKey - we get the specific DbRow if it exists;
Every moment we retrieve the Set of DbRows from MyNoSqlServer we can update the LastReadMoment of DbPartition and DbRows to the current one. As well - we can specify the maximum amount of DbRows can be held inside DbPartition; As well - we can specify the maximum amount of DbPartitions can be held inside Table;
MyNoSqlServer cleans the old records keeping the maximum amount of DbRows or DbPartition using the LastReadMoment property;
Every moment the developer inserts and updates the DbRow - LastReadMoment is updated to the current moment automatically;
When microservice architecture is being designed - the system usually is separated into the Microservices which Write DbRows and Which read DbRows to execute allocated user flows. The writer works in a quite classic way. We do HTTP request to execute CRUD Operations.
Readers on the other hand - are injected into microservices. They are Subscribed to tables and keep the local copy of table data inside the microservice.
Using Macros to describe MyNoSqlTableEntity: https://github.com/MyJetTools/my-no-sql-sdk/wiki/Macros