mirror of
https://github.com/gogrlx/nats-server.git
synced 2026-04-17 03:24:40 -07:00
Include config in info for msgset
Signed-off-by: Derek Collison <derek@nats.io>
This commit is contained in:
@@ -897,8 +897,11 @@ func (s *Server) jsMsgSetInfoRequest(sub *subscription, c *client, subject, repl
|
||||
s.sendInternalAccountMsg(c.acc, reply, fmt.Sprintf("%s %v", ErrPrefix, err))
|
||||
return
|
||||
}
|
||||
stats := mset.Stats()
|
||||
b, err := json.MarshalIndent(stats, "", " ")
|
||||
msi := MsgSetInfo{
|
||||
Stats: mset.Stats(),
|
||||
Config: mset.Config(),
|
||||
}
|
||||
b, err := json.MarshalIndent(msi, "", " ")
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -36,6 +36,11 @@ type MsgSetConfig struct {
|
||||
NoAck bool `json:"no_ack,omitempty"`
|
||||
}
|
||||
|
||||
type MsgSetInfo struct {
|
||||
Config MsgSetConfig `json:"name"`
|
||||
Stats MsgSetStats `json:"stats"`
|
||||
}
|
||||
|
||||
// RetentionPolicy determines how messages in a set are retained.
|
||||
type RetentionPolicy int
|
||||
|
||||
|
||||
@@ -95,6 +95,19 @@ const (
|
||||
workQueuePolicyString = "work_queue"
|
||||
)
|
||||
|
||||
func (rp RetentionPolicy) String() string {
|
||||
switch rp {
|
||||
case StreamPolicy:
|
||||
return "Limits"
|
||||
case InterestPolicy:
|
||||
return "Interest"
|
||||
case WorkQueuePolicy:
|
||||
return "WorkQueue"
|
||||
default:
|
||||
return "Unknown Retention Policy"
|
||||
}
|
||||
}
|
||||
|
||||
func (rp RetentionPolicy) MarshalJSON() ([]byte, error) {
|
||||
switch rp {
|
||||
case StreamPolicy:
|
||||
|
||||
Reference in New Issue
Block a user