appengine

package
v1.22.0 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2020 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// AppEngineTaskName Header Key
	AppEngineTaskName = "X-AppEngine-TaskName"

	// AppEngineQueueName Header Key
	AppEngineQueueName = "X-AppEngine-QueueName"

	// AppEngineTaskRetryCount Header Key
	AppEngineTaskRetryCount = "X-AppEngine-TaskRetryCount"

	// AppEngineTaskExecutionCount Header Key
	AppEngineTaskExecutionCount = "X-AppEngine-TaskExecutionCount"

	// AppEngineTaskETA Header Key
	AppEngineTaskETA = "X-AppEngine-TaskETA"

	// AppEngineTaskPreviousResponse Header Key
	AppEngineTaskPreviousResponse = "X-AppEngine-TaskPreviousResponse"

	// AppEngineTaskRetryReason Header Key
	AppEngineTaskRetryReason = "X-AppEngine-TaskRetryReason"

	// AppEngineFailFast Header Key
	AppEngineFailFast = "X-AppEngine-FailFast"
)

Variables

View Source
var ErrNotFoundHeader = errors.New("not found cloudtasks header")

ErrNotFoundHeader is Cloud Tasks の Headerがない時に利用されます。

Functions

This section is empty.

Types

type GetTask

type GetTask struct {
	Routing     *Routing
	Headers     map[string]string
	RelativeUri string
}

GetTask is Get Request 用の Task

type Header struct {

	// QueueName is The name of the queue.
	// Always there
	QueueName string

	// TaskName is The "short" name of the task, or, if no name was specified at creation, a unique system-generated id.
	// This is the 'my-task-id' value in the complete task name, ie, task_name = projects/my-project-id/locations/my-location/queues/my-queue-id/tasks/my-task-id.
	// Always there
	TaskName string

	// TaskRetryCount is The number of times this task has been retried.
	// For the first attempt, this value is 0.
	// This number includes attempts where the task failed due to a lack of available instances and never reached the execution phase.
	// Always there
	TaskRetryCount int64

	// TaskExecutionCount is The total number of times that the task has received a response from the handler.
	// Since Cloud Tasks deletes the task once a successful response has been received, all previous handler responses were failures.
	// This number does not include failures due to a lack of available instances.
	// Always there
	TaskExecutionCount int64

	// TaskEAT is The schedule time of the task
	// Always there
	TaskETA time.Time

	// TaskPreviousResponse is The HTTP response code from the previous retry.
	// optional
	TaskPreviousResponse string

	// TaskRetryReason is The reason for retrying the task.
	// optional
	TaskRetryReason string

	// FailFast is Indicates that a task fails immediately if an existing instance is not available.
	// optional
	FailFast bool
}

Header is App Engine task handlers plz see https://cloud.google.com/tasks/docs/creating-appengine-handlers

func GetHeader

func GetHeader(r *http.Request) (*Header, error)

GetHeader return App Engine task header

type JsonPostTask

type JsonPostTask struct {
	Routing     *Routing
	RelativeUri string
	Body        interface{}
}

JsonPostTask is JsonをBodyに入れるTask

type Queue

type Queue struct {
	ProjectID string
	Region    string
	Name      string
}

Queue is Cloud Tasks Queue

func (*Queue) Parent

func (q *Queue) Parent() string

Parent is return Cloud Tasks Parent format value

type Routing

type Routing struct {
	Service string
	Version string
}

Routing is Push 先の App EngineのServiceとVersionを指定するのに使う

type Service

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

Service is App Engine Task Service

func NewService

func NewService(ctx context.Context, taskClient *cloudtasks.Client) (*Service, error)

NewService is return Service

func (*Service) CreateGetTask

func (s *Service) CreateGetTask(ctx context.Context, queue *Queue, task *GetTask) (string, error)

CreateGetTask is Get Request 用の Task を作る

func (*Service) CreateJsonPostTask

func (s *Service) CreateJsonPostTask(ctx context.Context, queue *Queue, task *JsonPostTask) (string, error)

CreateJsonPostTask is BodyにJsonを入れるTaskを作る

func (*Service) CreateTask

func (s *Service) CreateTask(ctx context.Context, queue *Queue, task *Task) (string, error)

CreateTask is QueueにTaskを作成する

type Task

type Task struct {
	Routing     *Routing
	Headers     map[string]string
	Method      string
	RelativeUri string
	Body        []byte
}

Task is Task

Jump to

Keyboard shortcuts

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