Support watching names and selector

This commit is contained in:
Darren Shepherd
2020-06-22 09:42:18 -07:00
parent 9571ce9890
commit a9c39ef89b
4 changed files with 19 additions and 6 deletions

View File

@@ -11,7 +11,7 @@ import (
type Partitioner interface {
Lookup(apiOp *types.APIRequest, schema *types.APISchema, verb, id string) (Partition, error)
All(apiOp *types.APIRequest, schema *types.APISchema, verb string) ([]Partition, error)
All(apiOp *types.APIRequest, schema *types.APISchema, verb, id string) ([]Partition, error)
Store(apiOp *types.APIRequest, partition Partition) (types.Store, error)
}
@@ -74,7 +74,7 @@ func (s *Store) List(apiOp *types.APIRequest, schema *types.APISchema) (types.AP
result types.APIObjectList
)
paritions, err := s.Partitioner.All(apiOp, schema, "list")
paritions, err := s.Partitioner.All(apiOp, schema, "list", "")
if err != nil {
return result, err
}
@@ -123,13 +123,13 @@ func (s *Store) Update(apiOp *types.APIRequest, schema *types.APISchema, data ty
}
func (s *Store) Watch(apiOp *types.APIRequest, schema *types.APISchema, wr types.WatchRequest) (chan types.APIEvent, error) {
partitions, err := s.Partitioner.All(apiOp, schema, "watch")
partitions, err := s.Partitioner.All(apiOp, schema, "watch", wr.ID)
if err != nil {
return nil, err
}
ctx, cancel := context.WithCancel(apiOp.Context())
apiOp = apiOp.WithContext(ctx)
apiOp = apiOp.Clone().WithContext(ctx)
eg := errgroup.Group{}
response := make(chan types.APIEvent)