mirror of
https://github.com/pgsty/minio.git
synced 2026-08-11 00:33:28 +03:00
api: Implement bucket notification. (#2271)
* Implement basic S3 notifications through queues Supports multiple queues and three basic queue types: 1. NilQueue -- messages don't get sent anywhere 2. LogQueue -- messages get logged 3. AmqpQueue -- messages are sent to an AMQP queue * api: Implement bucket notification. Supports two different queue types - AMQP - ElasticSearch. * Add support for redis
This commit is contained in:
committed by
Anand Babu (AB) Periasamy
parent
f85d94288d
commit
f248089523
+44
@@ -0,0 +1,44 @@
|
||||
// Copyright 2012-2015 Oliver Eilhard. All rights reserved.
|
||||
// Use of this source code is governed by a MIT-license.
|
||||
// See http://olivere.mit-license.org/license.txt for details.
|
||||
|
||||
package elastic
|
||||
|
||||
type Rescore struct {
|
||||
rescorer Rescorer
|
||||
windowSize *int
|
||||
defaultRescoreWindowSize *int
|
||||
}
|
||||
|
||||
func NewRescore() *Rescore {
|
||||
return &Rescore{}
|
||||
}
|
||||
|
||||
func (r *Rescore) WindowSize(windowSize int) *Rescore {
|
||||
r.windowSize = &windowSize
|
||||
return r
|
||||
}
|
||||
|
||||
func (r *Rescore) IsEmpty() bool {
|
||||
return r.rescorer == nil
|
||||
}
|
||||
|
||||
func (r *Rescore) Rescorer(rescorer Rescorer) *Rescore {
|
||||
r.rescorer = rescorer
|
||||
return r
|
||||
}
|
||||
|
||||
func (r *Rescore) Source() (interface{}, error) {
|
||||
source := make(map[string]interface{})
|
||||
if r.windowSize != nil {
|
||||
source["window_size"] = *r.windowSize
|
||||
} else if r.defaultRescoreWindowSize != nil {
|
||||
source["window_size"] = *r.defaultRescoreWindowSize
|
||||
}
|
||||
rescorerSrc, err := r.rescorer.Source()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
source[r.rescorer.Name()] = rescorerSrc
|
||||
return source, nil
|
||||
}
|
||||
Reference in New Issue
Block a user