コード例 #1
0
ファイル: block.go プロジェクト: pombredanne/bar
func NewBlockStorage(options *BlockStorageOptions) *BlockStorage {
	return &BlockStorage{
		BlockStorageOptions: options,
		FDLocks:             concurrency.NewLocks(context.Background(), options.MaxFiles, time.Minute*5),
		BatchPool:           concurrency.NewPool(options.PoolSize),
	}
}
コード例 #2
0
ファイル: model.go プロジェクト: pombredanne/bar
func New(wd string, useGit bool, chunkSize int64, pool int) (res *Model, err error) {
	res = &Model{
		WD:        wd,
		BatchPool: concurrency.NewPool(pool * 32),
		chunkSize: chunkSize,
		FdLocks:   concurrency.NewLocks(context.Background(), pool, time.Minute*5),
	}
	if useGit {
		res.Git, err = git.NewGit(wd)
	}
	return
}