Commit 0de7803a authored by Geoff Simmons's avatar Geoff Simmons

Remove the Attacher interface (until and unless there's a use for it).

parent 9cdb136a
...@@ -44,32 +44,6 @@ import ( ...@@ -44,32 +44,6 @@ import (
"unsafe" "unsafe"
) )
// An Attacher can attach to a running instance of Varnish. This means
// that it can obtain information from resources that are actively
// managed and updated by the live Varnish child process.
type Attacher interface {
// Set the timeout for attaching to a Varnish instance. If the
// Duration, rounded to seconds toward 0s, is >= 0s, then wait
// that many seconds to attach. If the Duration < 0s, wait
// indefinitely. By default, the Varnish default timeout holds
// (5s in recent Varnish versions).
AttachTmo(time.Duration) error
// Attach to the default instance of Varnish -- the instance
// of varnishd invoked without the -n option.
//
// If the bool argument is true, a dot ('.') is printed to
// standard output for each second waiting for the attach to
// succeed. If the attach fails after timeout, a newline is
// printed. If the argument is false, there is no such output.
Attach(bool) error
// Attach to a named instance of Varnish, where the string
// corresponds to the -n argument in the invocation of
// varnishd.
AttachInstance(string, bool) error
}
// VSM provides methods for attaching to Varnish shared memory. // VSM provides methods for attaching to Varnish shared memory.
type VSM struct { type VSM struct {
vsm *C.struct_vsm vsm *C.struct_vsm
...@@ -120,8 +94,11 @@ func (v *VSM) Error() string { ...@@ -120,8 +94,11 @@ func (v *VSM) Error() string {
return C.GoString(C.VSM_Error(v.vsm)) return C.GoString(C.VSM_Error(v.vsm))
} }
// AttachTmo sets the timeout for attaching to a Varnish instance, as // AttachTmo sets the timeout for attaching to a Varnish instance. If
// documented for the Attacher interface. // the Duration, rounded to seconds toward 0s, is >= 0s, then wait
// that many seconds to attach. If the Duration < 0s, wait
// indefinitely. By default, the Varnish default timeout holds (5s in
// recent Varnish versions).
func (v *VSM) AttachTmo(tmo time.Duration) error { func (v *VSM) AttachTmo(tmo time.Duration) error {
if err := v.checkNil(); err != nil { if err := v.checkNil(); err != nil {
return err return err
...@@ -150,8 +127,13 @@ func (v *VSM) attach(progress bool) error { ...@@ -150,8 +127,13 @@ func (v *VSM) attach(progress bool) error {
return nil return nil
} }
// Attach attaches to the default instance of Varnish, as documented // Attach to the default instance of Varnish -- the instance of
// for the Attacher interface. // varnishd invoked without the -n option.
//
// If the bool argument is true, a dot ('.') is printed to standard
// output for each second waiting for the attach to succeed. If the
// attach fails after timeout, a newline is printed. If the argument
// is false, there is no such output.
func (v *VSM) Attach(progress bool) error { func (v *VSM) Attach(progress bool) error {
if err := v.checkNil(); err != nil { if err := v.checkNil(); err != nil {
return err return err
...@@ -159,8 +141,9 @@ func (v *VSM) Attach(progress bool) error { ...@@ -159,8 +141,9 @@ func (v *VSM) Attach(progress bool) error {
return v.attach(progress) return v.attach(progress)
} }
// AttachInstance attaches to a named instance of Varnish, as // AttachInstance attaches to a named instance of Varnish, where the
// documented for the Attacher interface. // string corresponds to the -n argument in the invocation of
// varnishd.
func (v *VSM) AttachInstance(inst string, progress bool) error { func (v *VSM) AttachInstance(inst string, progress bool) error {
if err := v.checkNil(); err != nil { if err := v.checkNil(); err != nil {
return err return err
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment