Exemplo n.º 1
0
func attemptEBlockUnmarshal(data []byte) (eblock interfaces.IEntryBlock, err error) {
	defer func() {
		if r := recover(); r != nil {
			err = fmt.Errorf("Bytes do not represent an eblock: %v\n", r)
		}
	}()

	eblock, err = entryBlock.UnmarshalEBlock(data)
	if err != nil {
		return nil, err
	}

	return eblock, nil
}
Exemplo n.º 2
0
func GetEBlock(keymr string) (interfaces.IEntryBlock, error) {
	for i := 0; i < 100; i++ {
		raw, err := GetRaw(keymr)
		if err != nil {
			continue
		}
		block, err := entryBlock.UnmarshalEBlock(raw)
		if err != nil {
			continue
		}
		return block, nil
	}
	panic("Failed 100 times to get the data " + keymr)
	return nil, nil
}