alkasir: github.com/alkasir/alkasir/pkg/central/client Index | Files

package client

import "github.com/alkasir/alkasir/pkg/central/client"

Index

Package Files

client.go

func AllSuggestions Uses

func AllSuggestions() []Suggestion

type Client Uses

type Client struct {
    // contains filtered or unexported fields
}

Client .

func NewClient Uses

func NewClient(baseurl string, httpclient *http.Client) *Client

func (*Client) CheckBinaryUpgrade Uses

func (c *Client) CheckBinaryUpgrade(request shared.BinaryUpgradeRequest) (shared.BinaryUpgradeResponse, bool, error)

CheckBinaryUpgrade returns upgrade meta data if an upgrade is available.

func (*Client) CreateSample Uses

func (c *Client) CreateSample(request shared.StoreSampleRequest) (shared.SampleResponse, error)

CreateSample posts an sample to central.

func (*Client) CreateSuggestionToken Uses

func (c *Client) CreateSuggestionToken(request shared.SuggestionTokenRequest) (shared.SuggestionTokenResponse, error)

CreateSuggestionToken requests an new suggestion token from central.

func (*Client) UpdateHostlist Uses

func (c *Client) UpdateHostlist(request shared.UpdateHostlistRequest) (shared.UpdateHostlistResponse, error)

UpdateHostlist posts an sample to central.

type Suggestion Uses

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 Uses

func GetSuggestion(ID string) (Suggestion, bool)

GetSuggestion returns a suggestion by ID.

func NewSuggestion Uses

func NewSuggestion(URL string) Suggestion

NewSuggestion creates a new local suggestion

func (*Suggestion) AddMeasurement Uses

func (s *Suggestion) AddMeasurement(m measure.Measurement) error

func (*Suggestion) AddSample Uses

func (s *Suggestion) AddSample(sampleType, data string)

AddSample adds a sample to the local cache ready to be sent to central using SendSamples.

func (*Suggestion) DoneAddingSamples Uses

func (s *Suggestion) DoneAddingSamples()

Prepared is called when no more samples are expected to arrive

func (Suggestion) Prepared Uses

func (s Suggestion) Prepared() (bool, error)

Prepared returns true if no othesamples are expected to be added

func (*Suggestion) RequestToken Uses

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 (*Suggestion) SendSamples Uses

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.