feat: remove un-necessary dependencies

This commit is contained in:
sujit
2024-10-15 20:34:56 +05:45
parent 8d96882d95
commit e9f98a0816
7 changed files with 18 additions and 18 deletions

View File

@@ -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 {

View File

@@ -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 {

View File

@@ -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) {

View File

@@ -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 {

View File

@@ -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
View File

@@ -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

View File

@@ -14,8 +14,8 @@ import (
)
type Publisher struct {
id string
opts *Options
id string
}
func NewPublisher(id string, opts ...Option) *Publisher {