npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

optimus-image-store

v1.0.4

Published

store for optimus image

Downloads

13

Readme

optimus-image-store

Overview

이 프로젝트는 옵티머스 이미지 중 스토어 모듈에 해당하는 프로젝트입니다.

주 기능은 AWS 환경의 Database(DynamoDB)와 파일 저장소(S3)를 관리합니다.

  • registerTask - 작업 정보 등록
  • registerResult - 작업 결과 등록
  • registerImageStore - 이미지를 파일 저장소에 등록
  • getBatchList - 배치 목록 리스트 조회
  • registerBatch - 배치 작업 정보 등록
  • updateBatchStatus - 배치 목록 상태 업데이트

Install

git clone <this repo>

Initialize

DB 체크 및 파일 저장소 체크를 하며 초기화가 완료되면 이벤트를 발생시킵니다.

var optimusStore = require('optimus-image-store');

// AWS config
var 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 config
var 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 setting
optimusStore.setConfig(awsConfig, config.fileConfig);

// config changed
optimusStore.on("CONFIG_CHANGED", function(err){
	// TODO
});

Get result

제공되는 기능의 결과를 받는 방법입니다.

  1. event
var param = {
	// your param
};

optimusStore.registerTask(param, "event name");

optimusStore.on("event name", function(err, data){
	// TODO
});
  1. callback function
var param = {
	// your param
};

optimusStore.registerTask(param, function(err, data){
	// TODO
});
  1. common callback function
// set common callback
optimusStore.setCallback(commonCallback);

var param = {
	// your param
};

optimusStore.registerTask(param, "callback name");

function commonCallback(err, data, callbackName) {
	if(callbackName === "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.getDate("YYYYMMDDHH24MISS") //date string (length = 14)
};

// event 처리시 
optimusStore.registerTask(param, function(err, data){
	// TODO
});

registerResult(param, [event name or callback function])

작업 결과를 등록합니다.

var param = registerTask 에 전달한 param;

// 작업 성공 결과
param.success = boolean;

// 작업 실패시 
param.errorCode = 'S'; // 작업 에러 코드
param.errorDescription = 'error description'; // 작업 에러 상세 내용 

optimusStore.registerResult(param, function(err, data){
	// TODO
});

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.registerImageStore(param, function(err, data){
	// TODO
	var path = data.path; //batch list

});

getBatchList(fileName, [event name or callback function])

S3의 배치 파일을 읽어 리스트로 전달합니다.

var fileName = //batch list file name 

optimusStore.getBatchList(fileName, function(err, data){
	// TODO
	var list = data.productList; //new path to upload images
});

registerBatch(param, [event name or callback function])

배치 작업 시작 정보를 등록합니다.

var params = {
	type : 'B', // task type (B-Batch, R-Realtime)
	totalCount : //batch list count,
	taskStartDatetime : optimusStore.getDate("YYYYMMDDHH24MISS") //date string (length = 14)
};

optimusStore.registerBatch(param, function(err, data){
	// TODO
});

updateBatchStatus()

배치정보의 상태를 업데이트 합니다.

optimusStore.updateBatchStatus();