api

package
v0.0.0-...-0c509a4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 13, 2019 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func TriggerAdaptation

func TriggerAdaptation(ac *AdaptationConfig)

func TriggerUserAdaptation

func TriggerUserAdaptation(wg *sync.WaitGroup, ac *AdaptationConfig, userId uint64)

Types

type AdaptationConfig

type AdaptationConfig struct {
	Scheme        AdaptationType `json:"scheme"`
	CompletionURL string         `json:"completionUrl"`
	// contains filtered or unexported fields
}

func (*AdaptationConfig) UnmarshalJSON

func (ac *AdaptationConfig) UnmarshalJSON(data []byte) error

type AdaptationResult

type AdaptationResult struct {
	DriverID uint64 `json:"driverId,omitempty"`
	Status   string `json:"status"`
}

type AdaptationService

type AdaptationService interface {
	None(userId uint64) error
	BlockSensitiveStoring(userId uint64) error
	CountryRedirection(userId uint64) error
	EdgePushDown(userId uint64) error
}

type AdaptationStatus

type AdaptationStatus struct {
	DriverID uint64         `json:"driverId,omitempty"`
	Scheme   AdaptationType `json:"scheme"`
	Since    string         `json:"since"`
}

type AdaptationType

type AdaptationType string
const (
	None                  AdaptationType = "None"
	BlockSensitiveStoring AdaptationType = "BlockSensitiveStoring"
	CountryRedirection    AdaptationType = "CountryRedirection"
	EdgePushDown          AdaptationType = "EdgePushDown"
)

func (AdaptationType) Int

func (a AdaptationType) Int() int

func (AdaptationType) String

func (a AdaptationType) String() string

type ClientConfig

type ClientConfig struct {
	Host         string
	Port         int
	APIKey       string
	Timeout      time.Duration
	PollInterval time.Duration
}

func DefaultClientConfig

func DefaultClientConfig() *ClientConfig

func (*ClientConfig) Receive

func (c *ClientConfig) Receive(ctx context.Context, sub *Subscription) []byte

func (*ClientConfig) Subscribe

func (c *ClientConfig) Subscribe(req *SubscriptionRequest) (*Subscription, error)

func (*ClientConfig) Unsubscribe

func (c *ClientConfig) Unsubscribe(sub *Subscription)

type DummyAdaptationService

type DummyAdaptationService struct{}

func (DummyAdaptationService) BlockSensitiveStoring

func (s DummyAdaptationService) BlockSensitiveStoring(userId uint64) error

func (DummyAdaptationService) CountryRedirection

func (s DummyAdaptationService) CountryRedirection(userId uint64) error

func (DummyAdaptationService) EdgePushDown

func (s DummyAdaptationService) EdgePushDown(userId uint64) error

func (DummyAdaptationService) None

func (s DummyAdaptationService) None(userId uint64) error

type Server

type Server struct {
	Host string
	Port int
	// contains filtered or unexported fields
}

func NewServer

func NewServer() *Server

func NewServerWithRouter

func NewServerWithRouter(router *mux.Router, prefix string) *Server

func (*Server) AdaptationHandler

func (srv *Server) AdaptationHandler(w http.ResponseWriter, r *http.Request)

func (*Server) AdaptationStatusHandler

func (srv *Server) AdaptationStatusHandler(w http.ResponseWriter, r *http.Request)

func (*Server) PullMessagesHandler

func (srv *Server) PullMessagesHandler(w http.ResponseWriter, r *http.Request)

func (*Server) RegisterAdaptationService

func (srv *Server) RegisterAdaptationService(as AdaptationService)

func (*Server) Start

func (srv *Server) Start() error

func (*Server) SubscriptionHandler

func (srv *Server) SubscriptionHandler(w http.ResponseWriter, r *http.Request)

func (*Server) SubscriptionRefreshHandler

func (srv *Server) SubscriptionRefreshHandler(w http.ResponseWriter, r *http.Request)

func (*Server) UnsubscriptionHandler

func (srv *Server) UnsubscriptionHandler(w http.ResponseWriter, r *http.Request)

func (*Server) UpdateHandler

func (srv *Server) UpdateHandler(w http.ResponseWriter, r *http.Request)

func (*Server) UserAdaptationHandler

func (srv *Server) UserAdaptationHandler(w http.ResponseWriter, r *http.Request)

func (*Server) UserAdaptationStatusHandler

func (srv *Server) UserAdaptationStatusHandler(w http.ResponseWriter, r *http.Request)

type ServerMetrics

type ServerMetrics struct {
	Adaptations       prometheus.Counter
	SystemAdaptations prometheus.Counter
	UserAdaptations   prometheus.Counter
	Subscriptions     prometheus.Gauge
}

func NewServerMetrics

func NewServerMetrics() ServerMetrics

type Subscription

type Subscription struct {
	SubscriptionID string `json:"subscriptionId"`
	ExpiresAt      string `json:"expiresAt,omitempty"`
	// contains filtered or unexported fields
}

type SubscriptionRequest

type SubscriptionRequest struct {
	Event       string `json:"event"`
	CallbackURL string `json:"callbackUrl,omitempty"`
}

type Topic

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

type TopicMessage

type TopicMessage struct {
	ID      string          `json:"id"`
	Message json.RawMessage `json:"message"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL