<commit_before>package btrfs

import (
	"bufio"
	"bytes"
	"errors"
	"fmt"
	"io"
	"io/ioutil"
	"log"
	"math/rand"
	"os"
	"os/exec"
	"path"
	"path/filepath"
	"runtime"
	"strings"
	"sync"
	"syscall"
	"time"

	"code.google.com/p/go-uuid/uuid"
	"github.com/go-fsnotify/fsnotify"
	"github.com/pachyderm/pfs/lib/shell"
)

var letters = []rune("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ")
var once sync.Once

// volume is hardcoded because we can map any host directory in to this path
// using Docker's `volume`s.
var volume = "/var/lib/pfs/vol"
var hostVolume = "/home/jdoliner/.pfs/vol"

// Generates a random sequence of letters. Useful for making filesystems that won't interfere with each other.
// This should be factored out to another file.
func RandSeq(n int) string {
	once.Do(func() { rand.Seed(time.Now().UTC().UnixNano()) })
	b := make([]rune, n)
	for i := range b {
		b[i] = letters[rand.Intn(len(letters))]
	}
	return string(b)
}

func Sync() error {
	return shell.RunStderr(exec.Command("sync"))
}

func FilePath(name string) string {
	return path.Join(volume, name)
}

func HostPath(name string) string {
	return path.Join(hostVolume, name)
}

func TrimFilePath(name string) string {
	return strings.TrimPrefix(name, volume)
}
<commit_msg>Soft code volumes in btrfs.<commit_after>package btrfs

import (
	"bufio"
	"bytes"
	"errors"
	"fmt"
	"io"
	"io/ioutil"
	"log"
	"math/rand"
	"os"
	"os/exec"
	"path"
	"path/filepath"
	"runtime"
	"strings"
	"sync"
	"syscall"
	"time"

	"code.google.com/p/go-uuid/uuid"
	"github.com/go-fsnotify/fsnotify"
	"github.com/pachyderm/pfs/lib/shell"
)

var letters = []rune("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ")
var once sync.Once

// localVolume returns the path *inside* the container that we look for the
// btrfs volume at
func localVolume() string {
	if val := os.Getenv("PFS_LOCAL_VOLUME"); val != "" {
		return val
	}
	return "/var/lib/pfs/vol"
}

func hostVolume() string {
	if val := os.Getenv("PFS_HOST_VOLUME"); val != "" {
		return val
	}
	return "/var/lib/pfs/vol"
}

// Generates a random sequence of letters. Useful for making filesystems that won't interfere with each other.
// This should be factored out to another file.
func RandSeq(n int) string {
	once.Do(func() { rand.Seed(time.Now().UTC().UnixNano()) })
	b := make([]rune, n)
	for i := range b {
		b[i] = letters[rand.Intn(len(letters))]
	}
	return string(b)
}

func Sync() error {
	return shell.RunStderr(exec.Command("sync"))
}

func FilePath(name string) string {
	return path.Join(localVolume(), name)
}

func HostPath(name string) string {
	return path.Join(hostVolume(), name)
}

func TrimFilePath(name string) string {
	return strings.TrimPrefix(name, localVolume())
}

{'fraction_non_alphanumeric': 0.15016562384983437, 'fraction_numerical': 0.0, 'mean_word_length': 4.25725338491296, 'pattern_counts': {'":': 0, '<': 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': '5172484', 'n_tokens_mistral': 1092, 'n_tokens_neox': 1061, 'n_words': 256}