<commit_before>package termite

import (
	"log"
	"os"
	"rpc"
	"sync"
)

var _ = log.Println

type FileInfo struct {
	Delete      bool
	Path        string
	LinkContent string
	os.FileInfo
	Hash []byte
}

type WorkReply struct {
	Exit   *os.Waitmsg
	Files  []FileInfo
	Stderr string
	Stdout string
}

type WorkRequest struct {
	FileServer string
	Binary     string
	Argv       []string
	Env        []string
	Dir        string
}

// State associated with one master.
type MasterWorker struct {
	daemon *WorkerDaemon
	fileServer *rpc.Client
	readonlyRpcFs  *RpcFs

	fuseFileSystemsMutex sync.Mutex
	fuseFileSystems []*WorkerFuseFs
}

func (me *MasterWorker) ReturnFuse(wfs *WorkerFuseFs) {
	wfs.unionFs.DropBranchCache()
	wfs.unionFs.DropDeletionCache()

	me.fuseFileSystemsMutex.Lock()<commit_msg>Document TODO wrt linux kernel and stdin/stdout redirection.<commit_after>package termite

import (
	"log"
	"os"
	"rpc"
	"sync"
)

var _ = log.Println

type FileInfo struct {
	Delete      bool
	Path        string
	LinkContent string
	os.FileInfo
	Hash []byte
}

// TODO - WorkReply/WorkRequest is cute and simple, but doesn't work
// for Makefiles that use redirection, like the Makefiles of the Linux
// kernel. We can't read stdin on the master, because we don't know if
// is needed, and detecting it on the worker requires some sort
// streaming RPC.  An alternative is to use multiplexing of the
// connection carrying the RPC to hook up the worker's
// stdin/stdout/stderr directly with the invoking tool.
//
// For now, we can't compile the linux kernel.
type WorkReply struct {
	Exit   *os.Waitmsg
	Files  []FileInfo
	Stderr string
	Stdout string
}

type WorkRequest struct {
	FileServer string
	Binary     string
	Argv       []string
	Env        []string
	Dir        string
}

// State associated with one master.
type MasterWorker struct {
	daemon *WorkerDaemon
	fileServer *rpc.Client
	readonlyRpcFs  *RpcFs

	fuseFileSystemsMutex sync.Mutex
	fuseFileSystems []*WorkerFuseFs
}

func (me *MasterWorker) ReturnFuse(wfs *WorkerFuseFs) {
	wfs.unionFs.DropBranchCache()
	wfs.unionFs.DropDeletionCache()

	me.fuseFileSystemsMutex.Lock()
{'fraction_non_alphanumeric': 0.07775175644028103, 'fraction_numerical': 0.0, 'mean_word_length': 3.5446808510638297, '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': '6683780', 'n_tokens_mistral': 732, 'n_tokens_neox': 708, 'n_words': 225}