func (vc *VolumeClock) UpdateFromChild(parentInode uint64, name string, child *clock.Clock) (changed bool, err error) { key := vc.pathToKey(parentInode, name) val := vc.b.Get(key) if val == nil { return false, &ClockNotFoundError{ParentInode: parentInode, Name: name} } var parentClock clock.Clock if err := parentClock.UnmarshalBinary(val); err != nil { return false, fmt.Errorf("corrupt clock for %d:%q", parentInode, name) } if changed := parentClock.UpdateFromChild(child); !changed { // no need to persist anything return false, nil } buf, err := parentClock.MarshalBinary() if err != nil { return false, err } if err := vc.b.Put(key, buf); err != nil { return false, err } return true, nil }