Skip to content

Commit

Permalink
Add a field for duration for which a lock was held (#153)
Browse files Browse the repository at this point in the history
This would allow consumers of `mc support top locks --json` subcommand
to know the time for which the lock was held at the time of receiving the
JSON output.
  • Loading branch information
krisis authored Nov 14, 2022
1 parent 2af0d7e commit c0056dd
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions top-commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,14 @@ import (
// servers holding the lock, source on the client machine,
// ID, type(read or write) and time stamp.
type LockEntry struct {
Timestamp time.Time `json:"time"` // When the lock was first granted
Resource string `json:"resource"` // Resource contains info like bucket+object
Type string `json:"type"` // Type indicates if 'Write' or 'Read' lock
Source string `json:"source"` // Source at which lock was granted
ServerList []string `json:"serverlist"` // List of servers participating in the lock.
Owner string `json:"owner"` // Owner UUID indicates server owns the lock.
ID string `json:"id"` // UID to uniquely identify request of client.
Timestamp time.Time `json:"time"` // When the lock was first granted
Elapsed time.Duration `json:"elapsed"` // Duration for which lock has been held
Resource string `json:"resource"` // Resource contains info like bucket+object
Type string `json:"type"` // Type indicates if 'Write' or 'Read' lock
Source string `json:"source"` // Source at which lock was granted
ServerList []string `json:"serverlist"` // List of servers participating in the lock.
Owner string `json:"owner"` // Owner UUID indicates server owns the lock.
ID string `json:"id"` // UID to uniquely identify request of client.
// Represents quorum number of servers required to hold this lock, used to look for stale locks.
Quorum int `json:"quorum"`
}
Expand Down

0 comments on commit c0056dd

Please sign in to comment.