services

package
v0.0.0-...-3a98d3a Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2025 License: BSD-3-Clause Imports: 14 Imported by: 0

Documentation

Overview

Copyright 2023 The Chromium Authors Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BotEvent

type BotEvent struct {
	Message  string
	Type     string
	Ts       *timestamp.Timestamp
	TaskID   string
	TaskLink string
	Version  string
}

BotEvent contains the information that we want to show on the UI

type BotEventsIterator

type BotEventsIterator struct {
	Cursor string

	Events []BotEvent
}

BotEventsIterator is a struct contains list of events

type CancelTasksRequest

type CancelTasksRequest struct {
	Tags  []string
	Start *timestamp.Timestamp
	End   *timestamp.Timestamp
}

type ISwarmingService

type ISwarmingService interface {
	// GetBot get the bot information from swarming API.
	GetBot(ctx context.Context, hostname string) (*swarmingapi.BotInfo, error)

	// ListBotTasks list the bot tasks from swarming API.
	ListBotTasks(ctx context.Context, hostname, cursor string, pageSize int) (*TasksIterator, error)

	// ListBotEvents list the bot events from swarming API
	ListBotEvents(ctx context.Context, hostname, cursor string, pageSize int) (*BotEventsIterator, error)

	// ListTasks lists the tasks from swarming API based on the tags passed.
	ListTasks(ctx context.Context, in *swarmingapi.TasksWithPerfRequest) (*swarmingapi.TaskListResponse, error)

	// ListBots lists the bot from swarming API.
	ListBots(ctx context.Context, in *swarmingapi.BotsRequest) (*swarmingapi.BotInfoListResponse, error)

	// CountTasks returns the count of swarming tasks for given tags and filters.
	CountTasks(ctx context.Context, in *swarmingapi.TasksCountRequest) (*swarmingapi.TasksCount, error)

	// CancelTasks cancels a subset of pending tasks based on the tags.
	CancelTasks(ctx context.Context, req CancelTasksRequest) error
}

ISwarmingService is the interface provides different services.

func NewSwarmingService

func NewSwarmingService(ctx context.Context) (ISwarmingService, error)

NewSwarmingService create a new swarming service

type JobsIterator

type JobsIterator struct {
	Cursor string
	Jobs   []*pb.Job
}

JobsIterator is a struct contains list of events

type MockISwarmingService

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

MockISwarmingService is a mock of ISwarmingService interface.

func NewMockISwarmingService

func NewMockISwarmingService(ctrl *gomock.Controller) *MockISwarmingService

NewMockISwarmingService creates a new mock instance.

func (*MockISwarmingService) CancelTasks

func (m *MockISwarmingService) CancelTasks(ctx context.Context, req CancelTasksRequest) error

CancelTasks mocks base method

func (*MockISwarmingService) CountTasks

CountTasks mocks base method.

func (*MockISwarmingService) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockISwarmingService) GetBot

func (m *MockISwarmingService) GetBot(ctx context.Context, hostname string) (*apipb.BotInfo, error)

GetBot mocks base method.

func (*MockISwarmingService) ListBotEvents

func (m *MockISwarmingService) ListBotEvents(ctx context.Context, hostname, cursor string, pageSize int) (*BotEventsIterator, error)

ListBotEvents mocks base method.

func (*MockISwarmingService) ListBotTasks

func (m *MockISwarmingService) ListBotTasks(ctx context.Context, hostname, cursor string, pageSize int) (*TasksIterator, error)

ListBotTasks mocks base method.

func (*MockISwarmingService) ListBots

ListBots mocks base method.

func (*MockISwarmingService) ListTasks

ListTasks mocks base method.

type MockISwarmingServiceMockRecorder

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

MockISwarmingServiceMockRecorder is the mock recorder for MockISwarmingService.

func (*MockISwarmingServiceMockRecorder) CancelTasks

CancelTasks indicates an expected call of CancelTasks

func (*MockISwarmingServiceMockRecorder) CountTasks

func (mr *MockISwarmingServiceMockRecorder) CountTasks(ctx, in interface{}) *gomock.Call

CountTasks indicates an expected call of CountTasks.

func (*MockISwarmingServiceMockRecorder) GetBot

func (mr *MockISwarmingServiceMockRecorder) GetBot(ctx, hostname interface{}) *gomock.Call

GetBot indicates an expected call of GetBot.

func (*MockISwarmingServiceMockRecorder) ListBotEvents

func (mr *MockISwarmingServiceMockRecorder) ListBotEvents(ctx, hostname, cursor, pageSize interface{}) *gomock.Call

ListBotEvents indicates an expected call of ListBotEvents.

func (*MockISwarmingServiceMockRecorder) ListBotTasks

func (mr *MockISwarmingServiceMockRecorder) ListBotTasks(ctx, hostname, cursor, pageSize interface{}) *gomock.Call

ListBotTasks indicates an expected call of ListBotTasks.

func (*MockISwarmingServiceMockRecorder) ListBots

func (mr *MockISwarmingServiceMockRecorder) ListBots(ctx, in interface{}) *gomock.Call

ListBots indicates an expected call of ListBots.

func (*MockISwarmingServiceMockRecorder) ListTasks

func (mr *MockISwarmingServiceMockRecorder) ListTasks(ctx, in interface{}) *gomock.Call

ListTasks indicates an expected call of ListTasks.

type MockTasksClient

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

MockTasksClient is a mock of TasksClient interface.

func NewMockTasksClient

func NewMockTasksClient(ctrl *gomock.Controller) *MockTasksClient

NewMockTasksClient creates a new mock instance.

func (*MockTasksClient) CountTasks

CountTasks mocks base method.

func (*MockTasksClient) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockTasksClient) ListTasks

ListTasks mocks base method.

type MockTasksClientMockRecorder

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

MockTasksClientMockRecorder is the mock recorder for MockTasksClient.

func (*MockTasksClientMockRecorder) CountTasks

func (mr *MockTasksClientMockRecorder) CountTasks(ctx, in interface{}, opts ...interface{}) *gomock.Call

CountTasks indicates an expected call of CountTasks.

func (*MockTasksClientMockRecorder) ListTasks

func (mr *MockTasksClientMockRecorder) ListTasks(ctx, in interface{}, opts ...interface{}) *gomock.Call

ListTasks indicates an expected call of ListTasks.

type SwarmingService

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

SwarmingService is the implementation of ISwarmingService

func (*SwarmingService) CancelTasks

func (s *SwarmingService) CancelTasks(ctx context.Context, req CancelTasksRequest) error

CancelTasks cancels a subset of pending tasks based on the tags.

func (*SwarmingService) CountTasks

CountTasks returns the count of swarming tasks for given tags and filters.

func (*SwarmingService) GetBot

func (s *SwarmingService) GetBot(
	ctx context.Context,
	hostname string,
) (*swarmingapi.BotInfo, error)

GetBot get the bot information from swarming API.

func (*SwarmingService) ListBotEvents

func (s *SwarmingService) ListBotEvents(
	ctx context.Context,
	hostname, cursor string,
	pageSize int,
) (*BotEventsIterator, error)

ListBotEvents lsit the bot events from swarming API

func (*SwarmingService) ListBotTasks

func (s *SwarmingService) ListBotTasks(
	ctx context.Context,
	hostname, cursor string,
	pageSize int,
) (*TasksIterator, error)

ListBotTasks list the bot tasks from swarming API.

func (*SwarmingService) ListBots

func (*SwarmingService) ListTasks

ListTasks returns the list of swarming tasks for given tags and filters.

type Task

type Task struct {
	Id      string
	Name    string
	StartAt *timestamp.Timestamp
	// Duration uses second
	Duration  float32
	Url       string
	IsSuccess bool
}

Task contains the information that we want to show on the UI

type TasksClient

type TasksClient interface {
	ListTasks(ctx context.Context, in *swarmingapi.TasksWithPerfRequest, opts ...grpc.CallOption) (*swarmingapi.TaskListResponse, error)

	// CountTasks returns the count of swarming tasks for given tags and filters.
	CountTasks(ctx context.Context, in *swarmingapi.TasksCountRequest, opts ...grpc.CallOption) (*swarmingapi.TasksCount, error)

	// CancelTasks cancels a subset of pending tasks based on the tags.
	CancelTasks(ctx context.Context, in *swarmingapi.TasksCancelRequest, opts ...grpc.CallOption) (*swarmingapi.TasksCancelResponse, error)
}

type TasksIterator

type TasksIterator struct {
	Cursor string

	Tasks []Task
}

TasksIterator is a struct contains list of Task

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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