Skip to content

Commit dcebad5

Browse files
author
Kedar Chandrayan
authored
Merge pull request #57 from ostdotcom/develop
Merging develop to release 1.0
2 parents 13d2c2f + b5f2624 commit dcebad5

164 files changed

Lines changed: 1150 additions & 168231 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.jsdoc.json

Lines changed: 0 additions & 37 deletions
This file was deleted.

.travis.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ branches:
55
only:
66
- master
77
- develop
8-
- review-changes-2805
8+
- /^release-.*/
99
notifications:
1010
email:
1111
recipients:
@@ -33,8 +33,10 @@ before_script:
3333
- mkdir -p dynamodb_instance_2
3434
- nohup java -Djava.library.path=./dynamodb/DynamoDBLocal_lib -jar DynamoDBLocal.jar -sharedDb &
3535
- nohup java -Djava.library.path=./dynamodb/DynamoDBLocal_lib -jar DynamoDBLocal.jar -sharedDb -dbPath ./dynamodb_instance_2 -port 8001 &
36+
- sleep 30
3637
script:
3738
- node_modules/mocha/bin/mocha tests/mocha/services/dynamodb/* --timeout 10000 --exit
3839
after_script:
3940
- kill $(ps aux | grep 'DynamoDBLocal.jar' | awk '{print $2}')
40-
- rm -rf dynamodb
41+
- rm -rf dynamodb
42+
- rm -rf dynamodb_instance_2

CHANGELOG.md

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,24 @@
1-
## OpenST-Storage v1.0.2
2-
- Common style guide followed across all openst repos using prettier ([openst-storage#21](https://github.com/OpenSTFoundation/openst-storage/issues/21))
3-
- Environment variables were a hard dependency. These lead to problems when multiple instances of OpenST-Storage are needed,
1+
## Storage v1.0.3
2+
- Integrated with new Instance Composer.
3+
- Migrated to ES6.
4+
- Migrated repository from OpenST Foundation to OST organization and renamed it.
5+
- Removed TokenBalance Model and Cache.
6+
7+
## Storage v1.0.2
8+
- Common style guide followed across all OST repos using prettier ([Storage#21](https://github.com/ostdotcom/storage/issues/21))
9+
- Environment variables were a hard dependency. These lead to problems when multiple instances of OST Storage are needed,
410
each having connection to different cache instances (for example). Thus making scaling not possible. Instead of reading
5-
the environment variables, we now depend on config object passed in the OpenST Storage constructor. Thus 2 objects of
6-
OpenST Storage can have totally different config strategies and thus will not interfere amongst each other.
7-
([openst-storage#20](https://github.com/OpenSTFoundation/openst-storage/issues/20))
8-
- Integrated use of Amazon DynamoDB Accelerator (DAX) to speed up certain actions ([openst-storage#18](https://github.com/OpenSTFoundation/openst-storage/issues/18))
11+
the environment variables, we now depend on config object passed in the OST Storage constructor. Thus 2 objects of
12+
OST Storage can have totally different config strategies and thus will not interfere amongst each other.
13+
([Storage#20](https://github.com/ostdotcom/storage/issues/20))
14+
- Integrated use of Amazon DynamoDB Accelerator (DAX) to speed up certain actions ([Storage#18](https://github.com/ostdotcom/storage/issues/18))
915
- Exposed models/dynamodb/base. It is the base class for all models which use sharded tables.
1016
- Restructured model directory.
1117
- Updated versions for dependencies to resolve package vulnerabilities.
1218
- Available shards and managed shards tables are deprecated.
1319

14-
## OpenST-Storage v1.0.0
15-
- OpenST Storage contains storage and sharding related services.
20+
## Storage v1.0.0
21+
- OST Storage contains storage and sharding related services.
1622
- Wrapper services over Dynamo DB AWS SDK.
1723
- Auto Scale services to scale read/write capacity of DynamoDB tables.
1824
- Cache layer on top of Shard management services.

README.md

Lines changed: 46 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,60 @@
1-
# OpenST Storage
1+
Storage
2+
============
3+
[![Latest version](https://img.shields.io/npm/v/@ostdotcom/storage.svg?maxAge=3600)][npm]
4+
[![Build Status](https://travis-ci.org/ostdotcom/storage.svg?branch=develop)][travis]
5+
[![Downloads per month](https://img.shields.io/npm/dm/@ostdotcom/storage.svg?maxAge=3600)][npm]
26

3-
OpenST Storage contains DB storage libraries and respective services. It also contains data sharding libraries and services.
4-
While OpenST Storage is available as-is for anyone to use, we caution that this is early stage software and under heavy ongoing development and improvement. Please report bugs and suggested improvements.
7+
[npm]: https://www.npmjs.com/package/@ostdotcom/storage
8+
[travis]: https://travis-ci.org/ostdotcom/storage
9+
10+
11+
OST Storage contains DB storage libraries and respective services. It also contains data sharding libraries and services.
512

613
##### Constructor parameters:
714
There is 1 parameter required while creating the storage implementer.
815
* First parameter is mandatory and it specifies the configuration strategy to be used. An example of the configStrategy is:
916
```js
10-
configStrategy = {
11-
OST_DEBUG_ENABLED:'1',
12-
OS_DYNAMODB_API_VERSION: '2012-08-10',
13-
OS_DYNAMODB_ACCESS_KEY_ID: 'x',
14-
OS_DYNAMODB_SECRET_ACCESS_KEY: 'x',
15-
OS_DYNAMODB_REGION: 'localhost',
16-
OS_DYNAMODB_ENDPOINT: 'http://localhost:8000',
17-
OS_DYNAMODB_SSL_ENABLED: '0',
18-
OS_DYNAMODB_LOGGING_ENABLED: '1',
19-
AUTO_SCALE_DYNAMO: '0',
20-
21-
OS_AUTOSCALING_API_VERSION: '2016-02-06' ,
22-
OS_AUTOSCALING_ACCESS_KEY_ID: 'x' ,
23-
OS_AUTOSCALING_SECRET_ACCESS_KEY: 'x' ,
24-
OS_AUTOSCALING_REGION: 'localhost',
25-
OS_AUTOSCALING_ENDPOINT: 'http://localhost:8000',
26-
OS_AUTOSCALING_SSL_ENABLED: '0',
27-
OS_AUTOSCALING_LOGGING_ENABLED: '1',
28-
29-
OS_DYNAMODB_TABLE_NAME_PREFIX: 'd_pk_',
30-
OST_CACHING_ENGINE: 'memcached',
31-
OST_CACHE_CONSISTENT_BEHAVIOR: 1,
32-
OST_REDIS_HOST: '127.0.0.1',
33-
OST_REDIS_PORT: 6379,
34-
OST_REDIS_PASS: 'st123',
35-
OST_REDIS_TLS_ENABLED: 0,
36-
OST_DEFAULT_TTL: '36000',
37-
OST_CACHE_ENDPOINT: '127.0.0.1:6379',
38-
OST_MEMCACHE_SERVERS: '127.0.0.1:11211'
39-
};
17+
configStrategy =
18+
{
19+
"cache": {
20+
"engine": "memcached",
21+
"servers": [
22+
"127.0.0.1:11211"
23+
],
24+
"defaultTtl": 36000
25+
},
26+
"storage": {
27+
"endpoint": "http://localhost:8000",
28+
"region": "localhost",
29+
"apiVersion": "2012-08-10",
30+
"apiKey": "X",
31+
"apiSecret": "X",
32+
"enableSsl": "0",
33+
"enableLogging": "0",
34+
"enableAutoscaling": "0",
35+
"tablePrefix":"X",
36+
"maxRetryCount":"1",
37+
"autoScaling": {
38+
"endpoint": "http://localhost:8000",
39+
"region": "localhost",
40+
"apiKey": "X",
41+
"apiSecret": "X",
42+
"apiVersion": "2012-08-10",
43+
"enableSsl": "0"
44+
}
45+
}
46+
}
4047
```
4148

4249
## DynamoDB Apis
4350

4451
For all DynamoDB methods parameters description please refer [AWS DynamoDB Docs](https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/DynamoDB.html)
4552

46-
Note: Response of all the apis is in [ResponseHelper](https://github.com/OpenSTFoundation/openst-base/blob/master/lib/formatter/response_helper.js) object wrapped in Promise.
47-
4853
#### DynamoDB constructor
4954
  params [dynamodbConnectionParams](https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/DynamoDB.html#constructor-property)
5055
```js
51-
const OpenSTStorage = require('@openstfoundation/openst-storage');
52-
let storage = OpenSTStorage.getInstance( configStrategy );
56+
const OSTStorage = require('@ostdotcom/storage');
57+
let storage = OSTStorage.getInstance( configStrategy );
5358
let ddbServiceObj = storage.dynamoDBService;
5459
```
5560

@@ -262,8 +267,8 @@ Note: Response of all the apis is in [ResponseHelper](https://github.com/OpenSTF
262267
&nbsp; AutoScaling params [autoScalingConnectionParams](#autoscaling-constructor)<br/>
263268

264269
```js
265-
const OpenSTStorage = require('@openstfoundation/openst-storage');
266-
let storage = OpenSTStorage.getInstance( configStrategy );
270+
const OSTStorage = require('@ostdotcom/storage');
271+
let storage = OSTStorage.getInstance( configStrategy );
267272
let ddbServiceObj = storage.dynamoDBService;
268273
let shardManagementObj = ddbServiceObj.shardManagement();
269274
let autoScalingObj = storage.autoScalingService;
@@ -354,8 +359,8 @@ For Parameters description please refer [AWS DynamoDB Docs](https://docs.aws.ama
354359
&nbsp; params [autoScalingConnectionParams](https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/ApplicationAutoScaling.html#constructor-property)
355360

356361
```js
357-
const OpenSTStorage = require('@openstfoundation/openst-storage');
358-
let storage = OpenSTStorage.getInstance( configStrategy );
362+
const OSTStorage = require('@ostdotcom/storage');
363+
let storage = OSTStorage.getInstance( configStrategy );
359364
let autoScalingObj = storage.autoScalingService;
360365
```
361366

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.0.2
1+
1.0.3

config.json

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"ddbTablePrefix": "de_ma_",
3+
"cache": {
4+
"engine": "memcached",
5+
"servers": [
6+
"127.0.0.1:11211"
7+
],
8+
"defaultTtl": 36000
9+
},
10+
"storage": {
11+
"endpoint": "http://localhost:8000",
12+
"region": "localhost",
13+
"apiVersion": "2012-08-10",
14+
"apiKey": "X",
15+
"apiSecret": "X",
16+
"enableSsl": "0",
17+
"enableLogging": "0",
18+
"enableAutoscaling": "0",
19+
"enableDax": "0",
20+
"maxRetryCount": 10,
21+
"autoScaling": {
22+
"endpoint": "http://localhost:8000",
23+
"region": "localhost",
24+
"apiKey": "X",
25+
"apiSecret": "X",
26+
"apiVersion": "2012-08-10",
27+
"enableSsl": "0"
28+
}
29+
}
30+
}

config/coreConstant.js

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
'use strict';
2+
3+
/**
4+
* Load all the core constants from the environment variables OR define them as literals here and export them.
5+
*
6+
* @module config/coreConstant
7+
*
8+
*/
9+
10+
const rootPrefix = '..',
11+
paramErrorConfig = require(rootPrefix + '/config/error/param'),
12+
apiErrorConfig = require(rootPrefix + '/config/error/general');
13+
14+
/**
15+
* Constructor for core constants
16+
*
17+
* @constructor
18+
*/
19+
const CoreConstant = function() {
20+
const oThis = this;
21+
22+
// Generic env variable across NPM packages
23+
oThis.DEBUG_ENABLED = process.env.OST_DEBUG_ENABLED;
24+
25+
oThis.DAX_API_VERSION = '';
26+
oThis.DAX_ACCESS_KEY_ID = '';
27+
oThis.DAX_SECRET_ACCESS_KEY = '';
28+
oThis.DAX_REGION = '';
29+
oThis.DAX_ENDPOINT = '';
30+
oThis.DAX_SSL_ENABLED = '';
31+
};
32+
33+
CoreConstant.prototype = {
34+
// Generic env variable across NPM packages
35+
DEBUG_ENABLED: null,
36+
37+
ERROR_CONFIG: {
38+
param_error_config: paramErrorConfig,
39+
api_error_config: apiErrorConfig
40+
},
41+
42+
get icNameSpace() {
43+
return 'OSTStorage';
44+
},
45+
46+
// in ms fixed time after which we would retry
47+
fixedRetryAfterTime: function() {
48+
return 25;
49+
},
50+
51+
// in ms variable time (which is incremented after every iteration) which we would retry
52+
variableRetryAfterTime: function() {
53+
return 25;
54+
},
55+
56+
// default retry count
57+
defaultRetryCount: function() {
58+
return 50;
59+
}
60+
};
61+
62+
module.exports = new CoreConstant();

config/core_constants.js

Lines changed: 0 additions & 58 deletions
This file was deleted.

0 commit comments

Comments
 (0)