// NewRedis - Creates a Redis using the provided configuration. func NewRedis(config RedisConfig, logger log.Modular) Authenticator { return &Redis{ logger: logger.NewModule(":redis_auth"), config: config, pool: newPool(config), } }
// New - Creates and returns a new curator, and launches its internal loop. func New( config Config, log log.Modular, stats metrics.Aggregator, auth acl.Authenticator, store store.Type, ) (Type, error) { curator := impl{ config: config, store: store, log: log.NewModule(":curator"), stats: stats, auth: auth, openBinders: make(map[string]binder.Type), errorChan: make(chan binder.Error, 10), closeChan: make(chan struct{}), closedChan: make(chan struct{}), } go curator.loop() return &curator, nil }
/* New - Creates a binder targeting an existing document determined via an ID. Must provide a store.Type to acquire the document and apply future updates to. */ func New( id string, block store.Type, config Config, errorChan chan<- Error, log log.Modular, stats metrics.Aggregator, ) (Type, error) { binder := impl{ id: id, config: config, otBuffer: text.NewOTBuffer(config.OTBufferConfig), block: block, log: log.NewModule(":binder"), stats: stats, clients: make([]*binderClient, 0), subscribeChan: make(chan subscribeRequest), transformChan: make(chan transformSubmission), messageChan: make(chan messageSubmission), usersRequestChan: make(chan usersRequest), exitChan: make(chan *binderClient), kickChan: make(chan kickRequest), errorChan: errorChan, closedChan: make(chan struct{}), } binder.log.Debugln("Bound to document, attempting flush") if _, err := binder.flush(); err != nil { stats.Incr("binder.new.error", 1) return nil, err } go binder.loop() stats.Incr("binder.new.success", 1) return &binder, nil }