Include config in info for msgset

Signed-off-by: Derek Collison <derek@nats.io>
This commit is contained in:
Derek Collison
2019-12-10 22:00:20 +01:00
parent 8a29444616
commit b3b2feebc5
5 changed files with 44 additions and 13 deletions

View File

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

View File

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

View File

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