Exemple #1
0
func main() {
	flag.Parse()
	if len(flag.Args()) != 1 {
		println("Usage:", os.Args[0], " DurablePath")
		os.Exit(1)
	}
	_, err := durablefs.OpenFile(flag.Arg(0))
	if err != nil {
		println(err.Error())
		os.Exit(1)
	}

	// XXX: Need to be able to read unregistered types
}
Exemple #2
0
// ReadCheckpoint reads a checkpoint structure from the durable file dfile.
func ReadCheckpoint(dfile string) (*Checkpoint, error) {
	// Fetch service info from durable fs
	f, err := durablefs.OpenFile(dfile)
	if err != nil {
		return nil, err
	}
	chk_, err := f.Read()
	if err != nil {
		return nil, err
	}
	if len(chk_) == 0 {
		return nil, circuit.NewError("no values in checkpoint durable file " + dfile)
	}
	chk, ok := chk_[0].(*Checkpoint)
	if !ok {
		return nil, circuit.NewError("unexpected checkpoint value (%#v) of type (%T) in durable file %s", chk_[0], chk_[0], dfile)
	}
	return chk, nil
}