<commit_before>package main

import (
    "qmsk.net/clusterf/config"
    "qmsk.net/clusterf/clusterf"
    "flag"
    "log"
    "os"
)

var (
    etcdConfig  config.EtcdConfig
    ipvsConfig  clusterf.IpvsConfig
)

func init() {
    flag.StringVar(&etcdConfig.Machines, "etcd-machines", "http://127.0.0.1:2379",
        "Client endpoint for etcd")
    flag.StringVar(&etcdConfig.Prefix, "etcd-prefix", "/clusterf",
        "Etcd tree prefix")

    flag.BoolVar(&ipvsConfig.Debug, "ipvs-debug", false,
        "IPVS debugging")
}

func main() {
    flag.Parse()

    if len(flag.Args()) > 0 {
        flag.Usage()
        os.Exit(1)
    }

    // setup
    var config      *config.Etcd
    var driver      *clusterf.IPVSDriver

    // config
    if etcdClient, err := etcdConfig.Open(); err != nil {
        log.Fatalf("etcd.Open: %s\n", err)
    } else {
        log.Printf("etcd.Open: %s\n", etcdClient)

        config = etcdClient
    }

    // driver
    if ipvsDriver, err := ipvsConfig.Open(); err != nil {
        log.Fatalf("ipvs.Open: %s\n", err)
    } else {
        log.Printf("ipvs.Open: %s\n", ipvsDriver)

        driver = ipvsDriver
    }

    // start
    services := clusterf.NewServices(driver)

    if configs, err := config.Scan(); err != nil {
        log.Fatalf("etcd.Scan: %s\n", err)
    } else {
        log.Printf("etcd.Scan: %d configs\n", len(configs))

        if err := driver.StartSync(); err != nil {
            log.Fatalf("ipvsDriver.startSync: %s\n", err)
        }

        // iterate initial set of services
        for _, cfg := range configs {
            services.ApplyConfig("sync", cfg)
        }
    }

    // read channel for changes
    log.Printf("etcd.Sync...\n")

    for event := range config.Sync() {
        log.Printf("etcd.Sync: %+v\n", event)

        services.ApplyConfig(event.Action, event.Config)
    }

    // self.printIPVS()

    log.Printf("Exit\n")
}
<commit_msg>clusterf.go: sync as NewConfig; fixup package name shadowing, logging<commit_after>package main

import (
    "qmsk.net/clusterf/config"
    "qmsk.net/clusterf/clusterf"
    "flag"
    "log"
    "os"
)

var (
    etcdConfig  config.EtcdConfig
    ipvsConfig  clusterf.IpvsConfig
)

func init() {
    flag.StringVar(&etcdConfig.Machines, "etcd-machines", "http://127.0.0.1:2379",
        "Client endpoint for etcd")
    flag.StringVar(&etcdConfig.Prefix, "etcd-prefix", "/clusterf",
        "Etcd tree prefix")

    flag.BoolVar(&ipvsConfig.Debug, "ipvs-debug", false,
        "IPVS debugging")
}

func main() {
    flag.Parse()

    if len(flag.Args()) > 0 {
        flag.Usage()
        os.Exit(1)
    }

    // setup
    var configDriver    *config.Etcd
    var driver          *clusterf.IPVSDriver

    // config
    if etcdClient, err := etcdConfig.Open(); err != nil {
        log.Fatalf("etcd.Open: %s\n", err)
    } else {
        log.Printf("etcd.Open: %s\n", etcdClient)

        configDriver = etcdClient
    }

    // driver
    if ipvsDriver, err := ipvsConfig.Open(); err != nil {
        log.Fatalf("ipvs.Open: %s\n", err)
    } else {
        log.Printf("ipvs.Open: %s\n", ipvsDriver)

        driver = ipvsDriver
    }

    // start
    services := clusterf.NewServices(driver)

    if configs, err := configDriver.Scan(); err != nil {
        log.Fatalf("config.Scan: %s\n", err)
    } else {
        log.Printf("config.Scan: %d configs\n", len(configs))

        if err := driver.StartSync(); err != nil {
            log.Fatalf("driver.startSync: %s\n", err)
        }

        // iterate initial set of services
        for _, cfg := range configs {
            services.ApplyConfig(config.NewConfig, cfg)
        }
    }

    // read channel for changes
    log.Printf("config.Sync...\n")

    for event := range configDriver.Sync() {
        log.Printf("config.Sync: %+v\n", event)

        services.ApplyConfig(event.Action, event.Config)
    }

    // self.printIPVS()

    log.Printf("Exit\n")
}

{'fraction_non_alphanumeric': 0.15331981753674606, 'fraction_numerical': 0.006082108464267613, 'mean_word_length': 2.1300555114988104, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4837923', 'n_tokens_mistral': 1397, 'n_tokens_neox': 1356, 'n_words': 272}