Security News
Input Validation Vulnerabilities Dominate MITRE's 2024 CWE Top 25 List
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
github.com/curator-go/curator
We've moved away from Zookeeper and no longer have this project running in our codebase. No community has been established and too many issues have not been resolved in this project. Therefore we have decided to archive this project. We'll keep it on this location for those wanting it as reference but that's it.
Curator n ˈkyoor͝ˌātər: a keeper or custodian of a museum or other collection - A ZooKeeper Keeper.
Curator-go is a Golang porting for Curator, which base on the go-zookeeper.
Curator-go users are assumed to know ZooKeeper. A good place to start is ZooKeeper Getting Started Guide
$ go get github.com/curator-go/curator
Curator-go is available from github.com. You can easily include Curator-go into your code.
import (
"github.com/curator-go/curator"
)
Curator uses Fluent Style. If you haven't used this before, it might seem odd so it's suggested that you familiarize yourself with the style.
Curator connection instances (CuratorFramework) are allocated from the CuratorFrameworkBuilder. You only need one CuratorFramework object for each ZooKeeper cluster you are connecting to:
curator.NewClient(connString, retryPolicy)
This will create a connection to a ZooKeeper cluster using default values. The only thing that you need to specify is the retry policy. For most cases, you should use:
retryPolicy := curator.NewExponentialBackoffRetry(time.Second, 3, 15*time.Second)
client := curator.NewClient(connString, retryPolicy)
client.Start()
defer client.Close()
The client must be started (and closed when no longer needed).
Once you have a CuratorFramework instance, you can make direct calls to ZooKeeper in a similar way to using the raw ZooKeeper object provided in the ZooKeeper distribution. E.g.:
client.Create().ForPathWithData(path, payload)
The benefit here is that Curator manages the ZooKeeper connection and will retry operations if there are connection problems.
lock := curator.NewInterProcessMutex(client, lockPath)
if ( lock.Acquire(maxWait, waitUnit) )
{
defer lock.Release()
// do some work inside of the critical section here
}
listener := curator.NewLeaderSelectorListener(func(CuratorFramework client) error {
// this callback will get called when you are the leader
// do whatever leader work you need to and only exit
// this method when you want to relinquish leadership
}))
selector := curator.NewLeaderSelector(client, path, listener)
selector.AutoRequeue() // not required, but this is behavior that you will probably expect
selector.Start()
This module contains example usages of various Curator features. Each directory in the module is a separate example.
See the examples source repo for each example.
FAQs
Unknown package
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.