file based and zookeeper based custom rule implementation

To enable dynamic custom rule configuration for vttablet, this patch implements two sets of dynamic rule updating mechanisms:

ZkCustomRule: zookeeper based custom rule manager
FileCustomRule: file based custom rule manager

This patch also sets up an interface, the CustomRuleManager. Future custom rule implementations which conforms with CustomRuleManager interface can be easily plugged in.
Er...Not sure about this: if we don't make an interface, then different
implementation for custom rules may have difficulty plugging themselves
into our system. Actually, I made this interface to allow more implements
to come in

2014-12-15 21:05 GMT-08:00 sougou <notifications@github.com>:
>
> In go/vt/tabletserver/customrule/customrule.go
> <https://github.com/youtube/vitess/pull/233#discussion-diff-21878089>:
>
> > +	"flag"
> > +	"fmt"
> > +
> > +	"github.com/youtube/vitess/go/vt/tabletserver"
> > +	"github.com/youtube/vitess/go/zk"
> > +)
> > +
> > +// CustomRuleManager outlines the methods needed to manage
> > +// custom query rules. CustomRuleManager gets custom query
> > +// rules from certain souces (file, zookeeper, etc) and push
> > +// the rules to vttablet through SqlQuery.SetQueryRules
> > +type CustomRuleManager interface {
> > +	Open(rulePath string, queryService *tabletserver.SqlQuery) error    // Open sets up everything ready for future actions
> > +	Close()                                                             // Close tears down everything
> > +	GetRules() (qrs *tabletserver.QueryRules, version int64, err error) // GetRules returns the current set of rules available to CustomRuleManager
> > +}
>
> Looking at how you've wired things, this interface looks unnecessary:
>
>    - This interface is not used outside this package. So, there's no
>    value in formalizing this.
>    - GetRules is unused, except for tests.
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/youtube/vitess/pull/233/files#r21878089>.
>