import "github.com/alkasir/alkasir/pkg/central/client"
func AllSuggestions() []Suggestion
type Client struct {
// contains filtered or unexported fields
}
Client .
func (c *Client) CheckBinaryUpgrade(request shared.BinaryUpgradeRequest) (shared.BinaryUpgradeResponse, bool, error)
CheckBinaryUpgrade returns upgrade meta data if an upgrade is available.
func (c *Client) CreateSample(request shared.StoreSampleRequest) (shared.SampleResponse, error)
CreateSample posts an sample to central.
func (c *Client) CreateSuggestionToken(request shared.SuggestionTokenRequest) (shared.SuggestionTokenResponse, error)
CreateSuggestionToken requests an new suggestion token from central.
func (c *Client) UpdateHostlist(request shared.UpdateHostlistRequest) (shared.UpdateHostlistResponse, error)
UpdateHostlist posts an sample to central.
type Suggestion struct { ID string // ID is assigned by the client on creation. Token shared.SuggestionToken // SuggestionToken session key from central. URL string // The origin url for the suggestion session. CreatedAt time.Time // Timestamp. // contains filtered or unexported fields }
Suggestion keeps local and remote suggestions together.
func GetSuggestion(ID string) (Suggestion, bool)
GetSuggestion returns a suggestion by ID.
func NewSuggestion(URL string) Suggestion
NewSuggestion creates a new local suggestion
func (s *Suggestion) AddMeasurement(m measure.Measurement) error
func (s *Suggestion) AddSample(sampleType, data string)
AddSample adds a sample to the local cache ready to be sent to central using SendSamples.
func (s *Suggestion) DoneAddingSamples()
Prepared is called when no more samples are expected to arrive
func (s Suggestion) Prepared() (bool, error)
Prepared returns true if no othesamples are expected to be added
func (s *Suggestion) RequestToken(client *Client, clientAddr net.IP, countryCode string) (shared.SuggestionTokenResponse, error)
RequestToken requests a suggestion session from central. On success the Suggestion is updated the token id. Check SuggestionTokenResponse.Ok for validity.
func (sugg *Suggestion) SendSamples(client *Client) (int, error)
AddSample adds a sample to the local cache ready to be sent to central using SendSamples.
Package client imports 14 packages (graph) and is imported by 1 packages. Updated 2016-07-24. Refresh now. Tools for package owners.