Skip to content
Snippets Groups Projects
Select Git revision
  • f24b573cea1e1e60de4f435b0881fcd59910082b
  • main default protected
  • development
  • integration
  • v1.1.5
  • v1.1.4
  • v1.1.3
  • v1.1.2
  • v1.1.1
  • v1.1.0
  • v1.0.0
11 results

Bindings

Blame
  • bindings.go 1023 B
    ///////////////////////////////////////////////////////////////////////////////
    // Copyright © 2020 xx network SEZC                                          //
    //                                                                           //
    // Use of this source code is governed by a license that can be found in the //
    // LICENSE file                                                              //
    ///////////////////////////////////////////////////////////////////////////////
    
    package stoppable
    
    import "time"
    
    type Bindings interface {
    	Close(timeoutMS int) error
    	IsRunning() bool
    	Name() string
    }
    
    func WrapForBindings(s Stoppable) Bindings {
    	return &bindingsStoppable{s: s}
    }
    
    type bindingsStoppable struct {
    	s Stoppable
    }
    
    func (bs *bindingsStoppable) Close(timeoutMS int) error {
    	timeout := time.Duration(timeoutMS) * time.Millisecond
    	return bs.s.Close(timeout)
    }
    
    func (bs *bindingsStoppable) IsRunning() bool {
    	return bs.s.IsRunning()
    }
    
    func (bs *bindingsStoppable) Name() string {
    	return bs.s.Name()
    }