storage

package
v0.0.0-...-1864f74 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	JobStatus_name = map[int32]string{
		0: "ACTIVE",
		1: "DELETED",
	}
	JobStatus_value = map[string]int32{
		"ACTIVE":  0,
		"DELETED": 1,
	}
)

Enum value maps for JobStatus.

View Source
var File_proto_storage_job_proto protoreflect.FileDescriptor

Functions

This section is empty.

Types

type JobRecord

type JobRecord struct {
	Status              JobStatus         `protobuf:"varint,1,opt,name=status,proto3,enum=storage.JobStatus" json:"status,omitempty"`
	Rhythm              string            `protobuf:"bytes,2,opt,name=rhythm,proto3" json:"rhythm,omitempty"`
	StartTimestamp      int64             `protobuf:"varint,3,opt,name=startTimestamp,proto3" json:"startTimestamp,omitempty"`           // time that the schedule start
	ExpirationTimestamp int64             `protobuf:"varint,4,opt,name=expirationTimestamp,proto3" json:"expirationTimestamp,omitempty"` // time that the job expires
	Repeats             int32             `protobuf:"varint,5,opt,name=repeats,proto3" json:"repeats,omitempty"`                         // total number of times the job should trigger
	Metadata            map[string]string ``                                                                                             /* 157-byte string literal not displayed */
	Payload             *anypb.Any        `protobuf:"bytes,7,opt,name=payload,proto3" json:"payload,omitempty"`
	// contains filtered or unexported fields
}

JobRecord is the record persisted as value in Etcd (not the key). Namespace is handled by prefixing the key in the database.

func (*JobRecord) Descriptor deprecated

func (*JobRecord) Descriptor() ([]byte, []int)

Deprecated: Use JobRecord.ProtoReflect.Descriptor instead.

func (*JobRecord) GetExpirationTimestamp

func (x *JobRecord) GetExpirationTimestamp() int64

func (*JobRecord) GetMetadata

func (x *JobRecord) GetMetadata() map[string]string

func (*JobRecord) GetPayload

func (x *JobRecord) GetPayload() *anypb.Any

func (*JobRecord) GetRepeats

func (x *JobRecord) GetRepeats() int32

func (*JobRecord) GetRhythm

func (x *JobRecord) GetRhythm() string

func (*JobRecord) GetStartTimestamp

func (x *JobRecord) GetStartTimestamp() int64

func (*JobRecord) GetStatus

func (x *JobRecord) GetStatus() JobStatus

func (*JobRecord) ProtoMessage

func (*JobRecord) ProtoMessage()

func (*JobRecord) ProtoReflect

func (x *JobRecord) ProtoReflect() protoreflect.Message

func (*JobRecord) Reset

func (x *JobRecord) Reset()

func (*JobRecord) String

func (x *JobRecord) String() string

type JobStatus

type JobStatus int32

JobStatus to keep track of jobs to be deleted.

const (
	JobStatus_ACTIVE  JobStatus = 0
	JobStatus_DELETED JobStatus = 1
)

func (JobStatus) Descriptor

func (JobStatus) Descriptor() protoreflect.EnumDescriptor

func (JobStatus) Enum

func (x JobStatus) Enum() *JobStatus

func (JobStatus) EnumDescriptor deprecated

func (JobStatus) EnumDescriptor() ([]byte, []int)

Deprecated: Use JobStatus.Descriptor instead.

func (JobStatus) Number

func (x JobStatus) Number() protoreflect.EnumNumber

func (JobStatus) String

func (x JobStatus) String() string

func (JobStatus) Type

type JobStore

type JobStore interface {
	Start(ctx context.Context) error
	Put(ctx context.Context, jobName string, job *JobRecord) error
	Delete(ctx context.Context, jobName string) error
	Wait()
}

The JobStore persists and reads jobs from Etcd.

func NewEtcdJobStore

func NewEtcdJobStore(
	client *etcdclient.Client,
	organizer partitioning.Organizer,
	partitioning partitioning.Partitioner,
	putCallback func(context.Context, string, *JobRecord) error,
	deleteCallback func(context.Context, string) error) JobStore

Jump to

Keyboard shortcuts

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