optimus-image-store
Overview
이 프로젝트는 옵티머스 이미지 중 스토어 모듈에 해당하는 프로젝트입니다.
주 기능은 AWS 환경의 Database(DynamoDB)와 파일 저장소(S3)를 관리합니다.
- registerTask - 작업 정보 등록
- registerResult - 작업 결과 등록
- registerImageStore - 이미지를 파일 저장소에 등록
- getBatchList - 배치 목록 리스트 조회
- registerBatch - 배치 작업 정보 등록
- updateBatchStatus - 배치 목록 상태 업데이트
Install
git clone <this repo>
Initialize
DB 체크 및 파일 저장소 체크를 하며 초기화가 완료되면 이벤트를 발생시킵니다.
var optimusStore = ; // AWS configvar awsConfig = accessKeyId: your accessKey", secretAccessKey: your secretAccessKey, region : your region, sslEnabled" : ssl option apiVersions" : { "dynamodb" : "2012-08-10", "s3" : "2006-03-01" }};// See: http://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/Config.html // file configvar fileConfig = { bucketName : your S3 bucketName, domain : your S3(or CDN) domain, filePath : your S3 file path, batchPath : your S3 file path under batch file path" batchBackupPath" : your S3 file path under batch file backup path}; // config settingoptimusStore.setConfig(awsConfig, config.fileConfig); // config changedoptimusStore.on("CONFIG_CHANGED", function(err){ // TODO});
Get result
제공되는 기능의 결과를 받는 방법입니다.
- event
var param = // your param; optimusStore; optimusStore;
- callback function
var param = // your param; optimusStore;
- common callback function
// set common callbackoptimusStore; var param = // your param; optimusStore; { ifcallbackName === "callback name" // TODO }
registerTask(param, [event name or callback function])
작업 시작 정보를 등록합니다.
var param = type : 'R' // task type (B-Batch, R-Realtime) productId : // product id (length = 8) taskStartDatetime : optimusStore //date string (length = 14); // event 처리시 optimusStore;
registerResult(param, [event name or callback function])
작업 결과를 등록합니다.
var param = registerTask 에 전달한 param; // 작업 성공 결과paramsuccess = boolean; // 작업 실패시 paramerrorCode = 'S'; // 작업 에러 코드paramerrorDescription = 'error description'; // 작업 에러 상세 내용 optimusStore;
registerImageStore(param, [event name or callback function])
캡처된 이미지 파일들을 파일 저장소에 등록합니다.
var param = productId : // product id (length = 8) imagePath : // source path on local file system to upload to S3; optimusStore;
getBatchList(fileName, [event name or callback function])
S3의 배치 파일을 읽어 리스트로 전달합니다.
var fileName = //batch list file name optimusStore;
registerBatch(param, [event name or callback function])
배치 작업 시작 정보를 등록합니다.
var params = type : 'B' // task type (B-Batch, R-Realtime) totalCount : //batch list count, taskStartDatetime : optimusStore //date string (length = 14); optimusStore;
updateBatchStatus()
배치정보의 상태를 업데이트 합니다.
optimusStore;