|
1 | | -# OpenST Storage |
| 1 | +Storage |
| 2 | +============ |
| 3 | +[][npm] |
| 4 | +[][travis] |
| 5 | +[][npm] |
2 | 6 |
|
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. |
5 | 12 |
|
6 | 13 | ##### Constructor parameters: |
7 | 14 | There is 1 parameter required while creating the storage implementer. |
8 | 15 | * First parameter is mandatory and it specifies the configuration strategy to be used. An example of the configStrategy is: |
9 | 16 | ```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 | +} |
40 | 47 | ``` |
41 | 48 |
|
42 | 49 | ## DynamoDB Apis |
43 | 50 |
|
44 | 51 | For all DynamoDB methods parameters description please refer [AWS DynamoDB Docs](https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/DynamoDB.html) |
45 | 52 |
|
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 | | - |
48 | 53 | #### DynamoDB constructor |
49 | 54 | params [dynamodbConnectionParams](https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/DynamoDB.html#constructor-property) |
50 | 55 | ```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 ); |
53 | 58 | let ddbServiceObj = storage.dynamoDBService; |
54 | 59 | ``` |
55 | 60 |
|
@@ -262,8 +267,8 @@ Note: Response of all the apis is in [ResponseHelper](https://github.com/OpenSTF |
262 | 267 | AutoScaling params [autoScalingConnectionParams](#autoscaling-constructor)<br/> |
263 | 268 |
|
264 | 269 | ```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 ); |
267 | 272 | let ddbServiceObj = storage.dynamoDBService; |
268 | 273 | let shardManagementObj = ddbServiceObj.shardManagement(); |
269 | 274 | let autoScalingObj = storage.autoScalingService; |
@@ -354,8 +359,8 @@ For Parameters description please refer [AWS DynamoDB Docs](https://docs.aws.ama |
354 | 359 | params [autoScalingConnectionParams](https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/ApplicationAutoScaling.html#constructor-property) |
355 | 360 |
|
356 | 361 | ```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 ); |
359 | 364 | let autoScalingObj = storage.autoScalingService; |
360 | 365 | ``` |
361 | 366 | |
|
0 commit comments