mirror of
https://github.com/oarkflow/mq.git
synced 2025-09-26 20:11:16 +08:00
feat: remove un-necessary dependencies
This commit is contained in:
@@ -11,9 +11,9 @@ import (
|
||||
type Message struct {
|
||||
Headers map[string]string `msgpack:"h"`
|
||||
Queue string `msgpack:"q"`
|
||||
Command consts.CMD `msgpack:"c"`
|
||||
Payload []byte `msgpack:"p"`
|
||||
m sync.RWMutex
|
||||
Command consts.CMD `msgpack:"c"`
|
||||
}
|
||||
|
||||
func NewMessage(cmd consts.CMD, payload []byte, queue string, headers map[string]string) *Message {
|
||||
|
@@ -32,9 +32,9 @@ type Consumer struct {
|
||||
conn net.Conn
|
||||
handler Handler
|
||||
pool *Pool
|
||||
opts *Options
|
||||
id string
|
||||
queue string
|
||||
opts *Options
|
||||
}
|
||||
|
||||
func NewConsumer(id string, queue string, handler Handler, opts ...Option) *Consumer {
|
||||
|
16
dag/dag.go
16
dag/dag.go
@@ -32,11 +32,11 @@ const (
|
||||
)
|
||||
|
||||
type Node struct {
|
||||
processor mq.Processor
|
||||
Name string
|
||||
Key string
|
||||
Edges []Edge
|
||||
isReady bool
|
||||
processor mq.Processor
|
||||
}
|
||||
|
||||
func (n *Node) ProcessTask(ctx context.Context, msg *mq.Task) mq.Result {
|
||||
@@ -61,20 +61,20 @@ type (
|
||||
)
|
||||
|
||||
type DAG struct {
|
||||
name string
|
||||
key string
|
||||
startNode string
|
||||
consumerTopic string
|
||||
nodes map[string]*Node
|
||||
server *mq.Broker
|
||||
consumer *mq.Consumer
|
||||
taskContext map[string]*TaskManager
|
||||
conditions map[FromNode]map[When]Then
|
||||
mu sync.RWMutex
|
||||
paused bool
|
||||
opts []mq.Option
|
||||
pool *mq.Pool
|
||||
taskCleanupCh chan string
|
||||
name string
|
||||
key string
|
||||
startNode string
|
||||
consumerTopic string
|
||||
opts []mq.Option
|
||||
mu sync.RWMutex
|
||||
paused bool
|
||||
}
|
||||
|
||||
func (tm *DAG) SetKey(key string) {
|
||||
|
@@ -12,14 +12,14 @@ import (
|
||||
)
|
||||
|
||||
type TaskManager struct {
|
||||
taskID string
|
||||
dag *DAG
|
||||
mutex sync.Mutex
|
||||
createdAt time.Time
|
||||
processedAt time.Time
|
||||
results []mq.Result
|
||||
dag *DAG
|
||||
nodeResults map[string]mq.Result
|
||||
wg *WaitGroup
|
||||
taskID string
|
||||
results []mq.Result
|
||||
mutex sync.Mutex
|
||||
}
|
||||
|
||||
func NewTaskManager(d *DAG, taskID string) *TaskManager {
|
||||
|
@@ -5,9 +5,9 @@ import (
|
||||
)
|
||||
|
||||
type WaitGroup struct {
|
||||
sync.Mutex
|
||||
counter int
|
||||
cond *sync.Cond
|
||||
counter int
|
||||
sync.Mutex
|
||||
}
|
||||
|
||||
func NewWaitGroup() *WaitGroup {
|
||||
|
2
go.mod
2
go.mod
@@ -1,6 +1,6 @@
|
||||
module github.com/oarkflow/mq
|
||||
|
||||
go 1.23.0
|
||||
go 1.22.0
|
||||
|
||||
require (
|
||||
github.com/oarkflow/date v0.0.4
|
||||
|
@@ -14,8 +14,8 @@ import (
|
||||
)
|
||||
|
||||
type Publisher struct {
|
||||
id string
|
||||
opts *Options
|
||||
id string
|
||||
}
|
||||
|
||||
func NewPublisher(id string, opts ...Option) *Publisher {
|
||||
|
Reference in New Issue
Block a user