<commit_before>package main

import (
	"fmt"
	"github.com/Sirupsen/logrus"
	"github.com/codegangsta/cli"
	"github.com/gorilla/mux"
	"github.com/rancherio/volmgr/api"
	"github.com/rancherio/volmgr/drivers"
	"net"
	"net/http"
	"os"
	"sync"
	"time"
)

const (
	VERSION     = "0.1.5"
	API_VERSION = "1"
	LOCKFILE    = "lock"
	CONFIGFILE  = "volmgr.cfg"

	KEY_VOLUME      = "volume-uuid"
	KEY_SNAPSHOT    = "snapshot-uuid"
	KEY_BLOCKSTORE  = "objectstore-uuid"
	KEY_IMAGE       = "image-uuid"
	KEY_VOLUME_NAME = "volume-name"

	VOLUME_CFG_PREFIX = "volume_"
	CFG_POSTFIX       = ".json"
)

type Volume struct {
	UUID       string
	Name       string
	Base       string
	Size       int64
	MountPoint string
	FileSystem string
	Snapshots  map[string]bool
}

type Server struct {
	Router        *mux.Router
	StorageDriver drivers.Driver
	GlobalLock    *sync.RWMutex
	NameVolumeMap map[string]string
	Config
}

type Config struct {
	Root              string
	Driver            string
	ImagesDir         string
	MountsDir         string
	DefaultVolumeSize int64
}

var (
	lock    string
	logFile *os.File
	log     = logrus.WithFields(logrus.Fields{"pkg": "main"})

	sockFile string = "/var/run/rancher/volume.sock"
	client   Client
)

type Client struct {
	addr      string
	scheme    string
	transport *http.Transport
}

func cleanup() {
	if r := recover(); r != nil {
		api.ResponseLogAndError(r)
		os.Exit(1)
	}
}

func main() {
	logrus.SetLevel(logrus.DebugLevel)

	app := cli.NewApp()
	app.Name = "volmgr"
	app.Version = VERSION
	app.Usage = "A volume manager capable of snapshot and delta backup"
	app.CommandNotFound = cmdNotFound

	serverCmd := cli.Command{
		Name:  "server",
		Usage: "start rancher-volmgr server",
		Flags: []cli.Flag{
			cli.BoolFlag{
				Name:  "debug",<commit_msg>logging: make sure log output to either file or stderr<commit_after>package main

import (
	"fmt"
	"github.com/Sirupsen/logrus"
	"github.com/codegangsta/cli"
	"github.com/gorilla/mux"
	"github.com/rancherio/volmgr/api"
	"github.com/rancherio/volmgr/drivers"
	"net"
	"net/http"
	"os"
	"sync"
	"time"
)

const (
	VERSION     = "0.1.5"
	API_VERSION = "1"
	LOCKFILE    = "lock"
	CONFIGFILE  = "volmgr.cfg"

	KEY_VOLUME      = "volume-uuid"
	KEY_SNAPSHOT    = "snapshot-uuid"
	KEY_BLOCKSTORE  = "objectstore-uuid"
	KEY_IMAGE       = "image-uuid"
	KEY_VOLUME_NAME = "volume-name"

	VOLUME_CFG_PREFIX = "volume_"
	CFG_POSTFIX       = ".json"
)

type Volume struct {
	UUID       string
	Name       string
	Base       string
	Size       int64
	MountPoint string
	FileSystem string
	Snapshots  map[string]bool
}

type Server struct {
	Router        *mux.Router
	StorageDriver drivers.Driver
	GlobalLock    *sync.RWMutex
	NameVolumeMap map[string]string
	Config
}

type Config struct {
	Root              string
	Driver            string
	ImagesDir         string
	MountsDir         string
	DefaultVolumeSize int64
}

var (
	lock    string
	logFile *os.File
	log     = logrus.WithFields(logrus.Fields{"pkg": "main"})

	sockFile string = "/var/run/rancher/volume.sock"
	client   Client
)

type Client struct {
	addr      string
	scheme    string
	transport *http.Transport
}

func cleanup() {
	if r := recover(); r != nil {
		api.ResponseLogAndError(r)
		os.Exit(1)
	}
}

func main() {
	logrus.SetLevel(logrus.DebugLevel)
	logrus.SetOutput(os.Stderr)

	app := cli.NewApp()
	app.Name = "volmgr"
	app.Version = VERSION
	app.Usage = "A volume manager capable of snapshot and delta backup"
	app.CommandNotFound = cmdNotFound

	serverCmd := cli.Command{
		Name:  "server",
		Usage: "start rancher-volmgr server",
		Flags: []cli.Flag{
			cli.BoolFlag{
				Name:  "debug",
{'fraction_non_alphanumeric': 0.11083608360836084, 'fraction_numerical': 0.0049504950495049506, 'mean_word_length': 3.023230088495575, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, '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': '6967993', 'n_tokens_mistral': 1381, 'n_tokens_neox': 1358, 'n_words': 297}