Skip to content

Commit

Permalink
Preserve the original interface
Browse files Browse the repository at this point in the history
Add DaemonFetch method to fetch from the daemon.
  • Loading branch information
chrisr-spectra committed Jun 13, 2024
1 parent e29ef8f commit 602cda5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion rrd_c.go
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,12 @@ func Info(filename string) (map[string]interface{}, error) {
}

// Fetch retrieves data from RRD file.
func Fetch(filename, cf string, start, end time.Time, step time.Duration, daemon *string) (FetchResult, error) {
func Fetch(filename, cf string, start, end time.Time, step time.Duration) (FetchResult, error) {
return DaemonFetch(filename, cf, start, end, step, nil)
}

// DaemonFetch retrieves data from RRD file or the RRD daemon.
func DaemonFetch(filename, cf string, start, end time.Time, step time.Duration, daemon *string) (FetchResult, error) {
fn := C.CString(filename)
defer freeCString(fn)
cCf := C.CString(cf)
Expand Down
2 changes: 1 addition & 1 deletion rrd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ func TestAll(t *testing.T) {
fmt.Printf("Start: %s\n", start)
fmt.Printf("End: %s\n", end)
fmt.Printf("Step: %s\n", step*time.Second)
fetchRes, err := Fetch(dbfile, "AVERAGE", start, end, step*time.Second, nil)
fetchRes, err := Fetch(dbfile, "AVERAGE", start, end, step*time.Second)
if err != nil {
t.Fatal(err)
}
Expand Down

0 comments on commit 602cda5

Please sign in to comment.