newTaskPersistence creates a new instance of TaskStore
( db sqlplugin.DB, taskScanPartitions int, logger log.Logger, enableFairness bool, serializer serialization.Serializer, )
| 23 | |
| 24 | // newTaskPersistence creates a new instance of TaskStore |
| 25 | func newTaskPersistence( |
| 26 | db sqlplugin.DB, |
| 27 | taskScanPartitions int, |
| 28 | logger log.Logger, |
| 29 | enableFairness bool, |
| 30 | serializer serialization.Serializer, |
| 31 | ) (persistence.TaskStore, error) { |
| 32 | store := SqlStore{ |
| 33 | DB: db, |
| 34 | logger: logger, |
| 35 | serializer: serializer, |
| 36 | } |
| 37 | userDataStore := userDataStore{SqlStore: store} |
| 38 | taskQueueStore := taskQueueStore{ |
| 39 | SqlStore: store, |
| 40 | version: sqlplugin.MatchingTaskVersion1, |
| 41 | taskScanPartitions: uint32(taskScanPartitions), |
| 42 | } |
| 43 | if enableFairness { |
| 44 | taskQueueStore.version = sqlplugin.MatchingTaskVersion2 |
| 45 | return newTaskManagerV2(db, userDataStore, taskQueueStore, logger, serializer) |
| 46 | } |
| 47 | return newTaskManagerV1(db, userDataStore, taskQueueStore, logger, serializer) |
| 48 | } |
no test coverage detected