Documentation
¶
Overview ¶
Package bsjob is a wrapper around beanspike jobs
Index ¶
- Constants
- Variables
- type Client
- type Conn
- type Job
- func (job *Job) Bury(reason string) error
- func (job *Job) Delete() (bool, error)
- func (job *Job) Monitor() chan struct{}
- func (job *Job) Release(delay time.Duration) error
- func (job *Job) ReleaseWithRetry(delay time.Duration, incr, retryFlag bool) error
- func (job *Job) RetryCount() int
- func (job *Job) String() string
- func (job *Job) Touch() error
- type Stats
- type TaskHandler
- type Tube
- func (tube *Tube) Bury(id int64, reason []byte) error
- func (tube *Tube) Delete(id int64) (bool, error)
- func (tube *Tube) KickJob(id int64) error
- func (tube *Tube) PeekBuried() (id int64, body []byte, ttr time.Duration, reason []byte, err error)
- func (tube *Tube) Put(body []byte, delay time.Duration, ttr time.Duration, lz bool, metadata string) (id int64, err error)
- func (tube *Tube) Release(id int64, delay time.Duration) error
- func (tube *Tube) ReleaseWithRetry(id int64, delay time.Duration, incr, retryFlag bool) error
- func (tube *Tube) Reserve() (id int64, body []byte, ttr time.Duration, retries int, retryFlag bool, ...)
- func (tube *Tube) ReserveBatch(batchSize int) (jobs []*Job, err error)
- func (tube *Tube) Stats() (s *Stats, err error)
- func (tube *Tube) Touch(id int64) error
- type TubeID
Constants ¶
View Source
const ( IdleInTubeTime = 2 * time.Second OutTubeTTR = 30 * time.Second )
View Source
const ( AerospikeHost = "aerospike" AerospikePort = 3000 AerospikeHostEnv = "AEROSPIKE_HOST" AerospikePortEnv = "AEROSPIKE_PORT" AerospikeNamespace = "beanspike" CompressionSizeThreshold = 1024 * 2 // run admin operations at most 1/10 seconds AerospikeAdminDelay = 2 AerospikeAdminScanSize = 2500 AerospikeMetadataSet = "metadata" // Bin names. Don't exceed 14 chars AerospikeNameStatus = "status" AerospikeNameBody = "body" AerospikeNameBy = "by" AerospikeNameReason = "reason" AerospikeNameDelay = "delay" AerospikeNameDelayValue = "seconds" // these are not used, review AerospikeNameTtr = "ttr" AerospikeNameTtrKey = "ttrkey" AerospikeNameTtrValue = "seconds" // these are not used, review AerospikeNameCompressedSize = "csize" AerospikeNameSize = "size" AerospikeNameRetries = "retries" AerospikeNameRetryFlag = "retryflag" AerospikeNameMetadata = "metadata" AerospikeNameBuriedMetadata = "buried_meta" // For the scan policy AerospikeQueryQueueSize = 4 // For bin AerospikeNameStatus AerospikeSymReady = "READY" AerospikeSymReserved = "RESERVED" AerospikeSymReservedTtr = "RESERVEDTTR" AerospikeSymBuried = "BURIED" AerospikeSymDelayed = "DELAYED" AerospikeSymDeleted = "DELETED" AerospikeKeySuffixTtr = "reservedttr" AerospikeKeySuffixDelayed = "delayed" )
Variables ¶
View Source
var ( ErrAlreadyConnected = errors.New("already connected") ErrNotConnected = errors.New("not connected") )
View Source
var ( ErrEmptyRecord = errors.New("ASSERT: Record empty") ErrNotBuriedOrDelayed = errors.New("Job is not buried or delayed") ErrJobNotFound = errors.New("Job not found") )
View Source
var ErrParsing = errors.New("error parsing body")
Functions ¶
This section is empty.
Types ¶
type Conn ¶
type Conn struct {
// contains filtered or unexported fields
}
func DialDefaultWithRetry ¶
type TaskHandler ¶
type TaskHandler interface { // ReserveAndDecode reserve a task and decode it to appropriate value type ReserveAndDecode(*Tube) (*Job, interface{}, error) // Handle processes incoming message. // Calling context.CancelFunc stops all underlying goroutines and release a beanspike job Handle(context.CancelFunc, interface{}) // OnRelease will be called when handler context canceled OnRelease(interface{}) }
Click to show internal directories.
Click to hide internal directories.