Skip to content

Commit

Permalink
chore(logs): added logging
Browse files Browse the repository at this point in the history
  • Loading branch information
cnlangzi committed Mar 25, 2024
1 parent e9118b7 commit 5d07bcb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ inspired by
- https://redis.io/docs/manual/patterns/distributed-locks
- https://martin.kleppmann.com/2016/02/08/how-to-do-distributed-locking.html
- http://thesecretlivesofdata.com/raft/
- https://medium.com/nerd-for-tech/leases-fences-distributed-design-patterns-c1983eccc9b1
- https://medium.com/nerd-for-tech/leases-fences-distributed-design-patterns-c1983eccc9b1
- https://www.golang.dk/articles/benchmarking-sqlite-performance-in-go
6 changes: 6 additions & 0 deletions node_rpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package dlm

import (
"errors"
"log"
"time"

"github.com/yaitoo/sqle"
Expand Down Expand Up @@ -51,6 +52,7 @@ func (n *Node) NewLock(req LockRequest, t *Lease) error {
*t = lease
}

log.Printf("renew: topic=%s key=%s lessee=%s ttl=%v\n", lease.Topic, lease.Key, lease.Lessee, lease.TTL)
return nil
}

Expand Down Expand Up @@ -87,6 +89,8 @@ func (n *Node) RenewLock(req LockRequest, t *Lease) error {
if t != nil {
*t = lease
}

log.Printf("renew: topic=%s key=%s lessee=%s ttl=%v\n", lease.Topic, lease.Key, lease.Lessee, lease.TTL)
return nil
}

Expand Down Expand Up @@ -114,6 +118,8 @@ func (n *Node) ReleaseLock(req LockRequest, ok *bool) error {

*ok = true

log.Printf("release: topic=%s key=%s lessee=%s ttl=%v\n", lease.Topic, lease.Key, lease.Lessee, lease.TTL)

return nil
}

Expand Down

0 comments on commit 5d07bcb

Please sign in to comment.