feat: add syncthing for clone mode (#270)

* feat: add syncthing for clone mode

---------

Co-authored-by: wencaiwulue <895703375@qq.com>
This commit is contained in:
naison
2024-06-21 21:27:20 +08:00
committed by GitHub
parent a45688115c
commit ed4c6bbe2f
1033 changed files with 209671 additions and 17296 deletions

31
vendor/github.com/rcrowley/go-metrics/json.go generated vendored Normal file
View File

@@ -0,0 +1,31 @@
package metrics
import (
"encoding/json"
"io"
"time"
)
// MarshalJSON returns a byte slice containing a JSON representation of all
// the metrics in the Registry.
func (r *StandardRegistry) MarshalJSON() ([]byte, error) {
return json.Marshal(r.GetAll())
}
// WriteJSON writes metrics from the given registry periodically to the
// specified io.Writer as JSON.
func WriteJSON(r Registry, d time.Duration, w io.Writer) {
for _ = range time.Tick(d) {
WriteJSONOnce(r, w)
}
}
// WriteJSONOnce writes metrics from the given registry to the specified
// io.Writer as JSON.
func WriteJSONOnce(r Registry, w io.Writer) {
json.NewEncoder(w).Encode(r)
}
func (p *PrefixedRegistry) MarshalJSON() ([]byte, error) {
return json.Marshal(p.GetAll())
}