Browse Source

consul: Adding BlockingQuery to structs to wait for changes

pull/19/head
Armon Dadgar 11 years ago
parent
commit
f0205e1974
  1. 20
      consul/structs/structs.go

20
consul/structs/structs.go

@ -4,6 +4,7 @@ import (
"bytes" "bytes"
"fmt" "fmt"
"github.com/ugorji/go/codec" "github.com/ugorji/go/codec"
"time"
) )
var ( var (
@ -26,6 +27,16 @@ const (
HealthCritical = "critical" HealthCritical = "critical"
) )
// BlockingQuery is used to block on a query and wait for a change.
// Either both fields, or neither must be provided.
type BlockingQuery struct {
// If set, wait until query exceeds given index
MinQueryIndex uint64
// Provided with MinQueryIndex to wait for change
MaxQueryTime time.Duration
}
// RegisterRequest is used for the Catalog.Register endpoint // RegisterRequest is used for the Catalog.Register endpoint
// to register a node as providing a service. If no service // to register a node as providing a service. If no service
// is provided, the node is registered. // is provided, the node is registered.
@ -47,24 +58,33 @@ type DeregisterRequest struct {
CheckID string CheckID string
} }
// DCSpecificRequest is used to query about a specific DC
type DCSpecificRequest struct {
Datacenter string
BlockingQuery
}
// ServiceSpecificRequest is used to query about a specific node // ServiceSpecificRequest is used to query about a specific node
type ServiceSpecificRequest struct { type ServiceSpecificRequest struct {
Datacenter string Datacenter string
ServiceName string ServiceName string
ServiceTag string ServiceTag string
TagFilter bool // Controls tag filtering TagFilter bool // Controls tag filtering
BlockingQuery
} }
// NodeSpecificRequest is used to request the information about a single node // NodeSpecificRequest is used to request the information about a single node
type NodeSpecificRequest struct { type NodeSpecificRequest struct {
Datacenter string Datacenter string
Node string Node string
BlockingQuery
} }
// ChecksInStateRequest is used to query for nodes in a state // ChecksInStateRequest is used to query for nodes in a state
type ChecksInStateRequest struct { type ChecksInStateRequest struct {
Datacenter string Datacenter string
State string State string
BlockingQuery
} }
// Used to return information about a node // Used to return information about a node

Loading…
Cancel
Save