Example #1
0
func (fs *FS) Add(msg string /*, affected circuit.Addr*/) int64 {
	fs.Lock()
	defer fs.Unlock()

	// Crate issue structure
	issue := &issuefs.Issue{
		ID:       issuefs.ChooseID(),
		Time:     time.Now(),
		Reporter: circuit.WorkerAddr(),
		//Affected: affected,
		Anchor: anchorfs.Created(),
		Msg:    msg,
	}

	// Prepare body
	var w bytes.Buffer
	if err := gob.NewEncoder(&w).Encode(issue); err != nil {
		panic(err)
	}

	// Write to zookeeper
	if _, err := fs.z.Create(path.Join(fs.root, "unresolved", issuefs.IDString(issue.ID)), string(w.Bytes()), 0, zutil.PermitAll); err != nil {
		panic(err)
	}

	return issue.ID
}
Example #2
0
// JailTail opens a file within this worker's jail directory and prepares a
// cross-circuit pointer to the open file
func (a *Acid) JailTail(jailFile string) (circuit.X, error) {
	abs := path.Join(config.Config.Deploy.JailDir(), circuit.WorkerAddr().WorkerID().String(), jailFile)

	cmd := exec.Command("/bin/sh", "-c", "tail -f "+abs)

	stdout, err := cmd.StdoutPipe()
	if err != nil {
		return nil, circuit.FlattenError(err)
	}

	if err = cmd.Start(); err != nil {
		return nil, circuit.FlattenError(err)
	}

	return circuit.Ref(teleio.NewServer(&tailStdout{stdout, cmd})), nil
}