MCPcopy
hub / github.com/perkeep/perkeep / String

Method String

pkg/server/sync.go:987–1017  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

985}
986
987func (cs *copyStatus) String() string {
988 var buf bytes.Buffer
989 now := time.Now()
990 buf.WriteString(cs.sb.Ref.String())
991 buf.WriteString(": ")
992
993 cs.mu.Lock()
994 defer cs.mu.Unlock()
995 sinceStart := now.Sub(cs.start)
996 sinceLast := now.Sub(cs.t)
997
998 switch cs.state {
999 case statusReading:
1000 buf.WriteString(cs.state)
1001 fmt.Fprintf(&buf, " (%d/%dB)", cs.nread, cs.sb.Size)
1002 case statusWriting:
1003 if cs.nwrite == cs.sb.Size {
1004 buf.WriteString("wrote all, waiting ack")
1005 } else {
1006 buf.WriteString(cs.state)
1007 fmt.Fprintf(&buf, " (%d/%dB)", cs.nwrite, cs.sb.Size)
1008 }
1009 default:
1010 buf.WriteString(cs.state)
1011
1012 }
1013 if sinceLast > 5*time.Second {
1014 fmt.Fprintf(&buf, ", last change %v ago (total elapsed %v)", sinceLast, sinceStart)
1015 }
1016 return buf.String()
1017}
1018
1019type failDetail struct {
1020 when time.Time

Callers 5

enqueueMethod · 0.45
startValidatePrefixMethod · 0.45
setErrorMethod · 0.45
storageDescFunction · 0.45
hourlyCompareMethod · 0.45

Calls 2

LockMethod · 0.80
UnlockMethod · 0.80

Tested by

no test coverage detected