github.com/pachyderm/pachyderm@v1.13.4/src/server/pkg/watch/op.go (about)

     1  package watch
     2  
     3  import etcd "github.com/coreos/etcd/clientv3"
     4  
     5  // OpOption is a simple typedef for etcd.OpOption.
     6  type OpOption struct {
     7  	Get   etcd.OpOption
     8  	Watch etcd.OpOption
     9  }
    10  
    11  // WithFilterPut discards PUT events from the watcher.
    12  func WithFilterPut() OpOption {
    13  	return OpOption{Watch: etcd.WithFilterPut(), Get: nil}
    14  }
    15  
    16  // WithSort specifies the sort to use for the watcher
    17  func WithSort(sortBy etcd.SortTarget, sortOrder etcd.SortOrder) OpOption {
    18  	return OpOption{Get: etcd.WithSort(sortBy, sortOrder), Watch: nil}
    19  }
    20  
    21  // WithFilterDelete discards DELETE events from the watcher.
    22  func WithFilterDelete() OpOption {
    23  	return OpOption{Watch: etcd.WithFilterDelete()}
    24  }