acl/lib_acl_cpp/include/acl_cpp/beanstalk/beanstalk.hpp

310 lines
10 KiB
C++
Raw Normal View History

2014-11-19 00:25:21 +08:00
#pragma once
#include <stdarg.h>
#include <vector>
#include "acl_cpp/acl_cpp_define.hpp"
2015-03-08 21:34:00 +08:00
#include "acl_cpp/stdlib/string.hpp"
2014-11-19 00:25:21 +08:00
#include "acl_cpp/stream/socket_stream.hpp"
struct ACL_ARGV;
namespace acl {
/**
* <EFBFBD><EFBFBD>Ϣ ID <EFBFBD>Ŵ<EFBFBD> 1 <EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>(<EFBFBD>μ<EFBFBD> beanstalkd <EFBFBD><EFBFBD> job.c Դ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>е<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD>
* static uint64 next_id = 1; <EFBFBD><EFBFBD> make_job_with_id() <EFBFBD>е<EFBFBD>
* if (id) {
* j->r.id = id;
* if (id >= next_id) next_id = id + 1;
* } else {
* j->r.id = next_id++;
* }
* <EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD><EFBFBD>ȼ<EFBFBD> pri <EFBFBD><EFBFBD>ȡֵ<EFBFBD><EFBFBD>ΧΪ 0 ~ 4,294,968,295(<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>޷<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ)<EFBFBD><EFBFBD>ֵԽС
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȼ<EFBFBD><EFBFBD><EFBFBD>Խ<EFBFBD>ߣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>߼<EFBFBD><EFBFBD><EFBFBD>Ϊ 0 <EFBFBD><EFBFBD>
* <EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD>Ĭ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>󳤶<EFBFBD>Ϊ 65,535(<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>޷<EFBFBD><EFBFBD><EFBFBD> short ֵ)<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> beanstalkd ָ<EFBFBD><EFBFBD>
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ο<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ doc/ Ŀ¼<EFBFBD>µ<EFBFBD> <beanstalkЭ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.pdf>
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>е<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڲ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Զ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӳ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>У<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֮ǰ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> watch <EFBFBD><EFBFBD> use
* <EFBFBD><EFBFBD><EFBFBD>У<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Զ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Щ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̣<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD> open <EFBFBD><EFBFBD><EFBFBD>̣<EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* close <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>󣬲<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ͽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> beanstalkd <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӣ<EFBFBD>ͬʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>д<EFBFBD><EFBFBD>
* use <EFBFBD><EFBFBD> watch <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
*/
class ACL_CPP_API beanstalk
{
public:
/**
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* @param addr {const char*} beanstalkd <EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ<EFBFBD><EFBFBD>ip:port/domain:port
* @param conn_timeout {int} <EFBFBD><EFBFBD><EFBFBD>ӷ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ij<EFBFBD>ʱʱ<EFBFBD><EFBFBD>(<EFBFBD><EFBFBD>)
* @param retry {bool} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӷ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><EFBFBD>Զ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
*/
beanstalk(const char* addr, int conn_timeout, bool retry = true);
~beanstalk();
/////////////////////////////////////////////////////////////////////
// <20><><EFBFBD><EFBFBD><EFBFBD>ߵ<EFBFBD><DFB5>õĽӿ<C4BD>
/**
* ѡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>õķ<EFBFBD><EFBFBD>͹ܵ<EFBFBD>
* @param tube {const char*} <EFBFBD>ܵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* @return {bool} <EFBFBD>Ƿ<EFBFBD><EFBFBD>ɹ<EFBFBD>
*/
bool use(const char* tube);
/**
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD>ܵ<EFBFBD><EFBFBD><EFBFBD>ȱʡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>з<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
* @param data {const void*} <EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD><EFBFBD>ݵ<EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƕ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* @param len {size_t} data <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* @param pri {unsigned} <EFBFBD><EFBFBD><EFBFBD>ȼ<EFBFBD><EFBFBD><EFBFBD>ֵԽС<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȼ<EFBFBD>Խ<EFBFBD><EFBFBD>
* @param delay {unsigned} <EFBFBD><EFBFBD>ʾ<EFBFBD><EFBFBD>job<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ready<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD>ȴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* @param ttr {unsigned} <EFBFBD><EFBFBD>ʾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD>workerִ<EFBFBD>и<EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* @return {unsigned long long} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD>ţ<EFBFBD>
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ > 0 <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><EFBFBD><EFBFBD>ӳɹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> == 0 <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><EFBFBD>
* (<EFBFBD> beanstalkd Դ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Կ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD>Ŵ<EFBFBD> 1 <EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
*/
unsigned long long put(const void* data, size_t len,
unsigned pri = 1024, unsigned delay = 0, unsigned ttr = 60);
/**
* <EFBFBD>Ը<EFBFBD>ʽ<EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD>ܵ<EFBFBD><EFBFBD><EFBFBD>ȱʡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>з<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
* @param pri {unsigned} <EFBFBD><EFBFBD><EFBFBD>ȼ<EFBFBD><EFBFBD><EFBFBD>ֵԽС<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȼ<EFBFBD>Խ<EFBFBD><EFBFBD>
* @param delay {unsigned} <EFBFBD><EFBFBD>ʾ<EFBFBD><EFBFBD>job<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ready<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD>ȴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* @param ttr {unsigned} <EFBFBD><EFBFBD>ʾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD>workerִ<EFBFBD>и<EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* @param fmt {const char*} <EFBFBD><EFBFBD>ʽ<EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD>
* @return {unsigned long long} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD>ţ<EFBFBD>
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ > 0 <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><EFBFBD><EFBFBD>ӳɹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> == 0 <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><EFBFBD>
* (<EFBFBD> beanstalkd Դ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Կ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD>Ŵ<EFBFBD> 1 <EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
*/
unsigned long long format_put(unsigned pri, unsigned delay, unsigned ttr,
const char* fmt, ...) ACL_CPP_PRINTF(5, 6);
unsigned long long vformat_put(const char* fmt, va_list ap,
unsigned pri = 1024, unsigned delay = 0, unsigned ttr = 60);
/**
* <EFBFBD>Ը<EFBFBD>ʽ<EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD>ܵ<EFBFBD><EFBFBD><EFBFBD>ȱʡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>з<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>е<EFBFBD>
* <EFBFBD><EFBFBD> pri, delay, ttr <EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ĭ<EFBFBD><EFBFBD>ֵ
* @param fmt {const char*} <EFBFBD><EFBFBD>ʽ<EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD>
* @return {unsigned long long} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD>ţ<EFBFBD>
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ > 0 <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><EFBFBD><EFBFBD>ӳɹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> == 0 <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><EFBFBD>
* (<EFBFBD> beanstalkd Դ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Կ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD>Ŵ<EFBFBD> 1 <EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
*/
unsigned long long format_put(const char* fmt, ...) ACL_CPP_PRINTF(2, 3);
/////////////////////////////////////////////////////////////////////
// <20><><EFBFBD><EFBFBD><EFBFBD>ߵ<EFBFBD><DFB5>õĽӿ<C4BD>
/**
* ѡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡ<EFBFBD><EFBFBD>Ϣ<EFBFBD>Ĺܵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ع<EFBFBD><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD><EFBFBD>У<EFBFBD>
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ñ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD><EFBFBD>ȱʡ<EFBFBD>Ĺܵ<EFBFBD>(default)
* @param tube {const char*} <EFBFBD><EFBFBD>Ϣ<EFBFBD>ܵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* @return {unsigned} <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵΪ<EFBFBD><EFBFBD>ע<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD>ܵ<EFBFBD><EFBFBD><EFBFBD>, <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ > 0 <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<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<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD>Ѿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡ<EFBFBD><EFBFBD><EFBFBD>ڹ<EFBFBD><EFBFBD> ttr
* (<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>) û<EFBFBD>б<EFBFBD> delete_id
2014-11-19 00:25:21 +08:00
*/
unsigned long long reserve(string& buf, int timeout = -1);
/**
* <EFBFBD>Ӷ<EFBFBD><EFBFBD>з<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɾ<EFBFBD><EFBFBD>ָ<EFBFBD><EFBFBD> ID <EFBFBD>ŵ<EFBFBD><EFBFBD><EFBFBD>Ϣ
* @param id {unsigned long long} <EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD>
* @return {bool} <EFBFBD>Ƿ<EFBFBD><EFBFBD>ɹ<EFBFBD>ɾ<EFBFBD><EFBFBD>
*/
bool delete_id(unsigned long long id);
/**
* <EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD>Ѿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD><EFBFBD>·Ż<EFBFBD>ready<EFBFBD><EFBFBD><EFBFBD><EFBFBD>(<EFBFBD><EFBFBD><EFBFBD><EFBFBD>job״̬<EFBFBD><EFBFBD>Ϊ "ready")<EFBFBD><EFBFBD>
* <EFBFBD>ø<EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD><EFBFBD>Ա<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӻ<EFBFBD><EFBFBD><EFBFBD>
* @param id {unsigned long long} <EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD>
* @param pri {unsigned} <EFBFBD><EFBFBD><EFBFBD>ȼ<EFBFBD><EFBFBD><EFBFBD>
* @param delay {unsigned} <EFBFBD>ڸ<EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ready<EFBFBD><EFBFBD><EFBFBD><EFBFBD>֮ǰ<EFBFBD><EFBFBD>Ҫ<EFBFBD>ȴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* @return {bool} <EFBFBD>Ƿ<EFBFBD><EFBFBD>ɹ<EFBFBD>
*/
bool release(unsigned long long id, unsigned pri = 1024,
unsigned delay = 0);
/**
* <EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD>״̬<EFBFBD><EFBFBD>Ϊ "buried", Buried <EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD>FIFO<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>У<EFBFBD>
* <EFBFBD>ڿͻ<EFBFBD><EFBFBD>˵<EFBFBD><EFBFBD><EFBFBD>kick<EFBFBD><EFBFBD><EFBFBD><EFBFBD>֮ǰ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Щ<EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˴<EFBFBD><EFBFBD><EFBFBD>
* @param id {unsigned long long} <EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD>
* @param pri {unsigned int} <EFBFBD><EFBFBD><EFBFBD>ȼ<EFBFBD><EFBFBD><EFBFBD>
* @return {bool} <EFBFBD>Ƿ<EFBFBD><EFBFBD>ɹ<EFBFBD>
*/
bool bury(unsigned long long id, unsigned pri = 1024);
/**
*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EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>յ<EFBFBD>DEADLINE_SOON<EFBFBD>ǿ<EFBFBD><EFBFBD>Է<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
* @param id {unsigned long long} <EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD>
* @return {bool} <EFBFBD>Ƿ<EFBFBD><EFBFBD>ɹ<EFBFBD>
*/
bool touch(unsigned long long id);
/////////////////////////////////////////////////////////////////////
// <20><><EFBFBD><EFBFBD><EFBFBD>ӿ<EFBFBD>
/**
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD> beanstalkd <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͨ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>²<EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD>ʾ<EFBFBD>ص<EFBFBD><EFBFBD>øú<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* <EFBFBD><EFBFBD><EFBFBD>Զ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD>Զ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ñ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* @return {bool} <EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>
*/
bool open();
/**
* <EFBFBD><EFBFBD>ʾ<EFBFBD>ر<EFBFBD><EFBFBD><EFBFBD> beanstalkd <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD>Ե<EFBFBD><EFBFBD>ùرչ<EFBFBD><EFBFBD>̣<EFBFBD>
* <EFBFBD><EFBFBD><EFBFBD>ñ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڲ<EFBFBD><EFBFBD><EFBFBD> tube_used_ <EFBFBD><EFBFBD> tubes_watched_ <EFBFBD><EFBFBD>ͷ<EFBFBD>
*/
void close();
/**
* <EFBFBD><EFBFBD>ʾ֪ͨ beanstalkd <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˳<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>յ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ر<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
*/
void quit();
/**
* <EFBFBD><EFBFBD>ȡ<EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD>ŵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* @param buf {string&} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڲ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ոû<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* @param id {unsigned long long} ָ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD>
* @return {unsigned long long} <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡ<EFBFBD>õ<EFBFBD> ready ״̬<EFBFBD><EFBFBD>Ϣ<EFBFBD>ţ<EFBFBD>
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ > 0 <EFBFBD><EFBFBD>˵<EFBFBD><EFBFBD>ȡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾû<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
*/
unsigned long long peek(string& buf, unsigned long long id);
/**
* <EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD>ǰ<EFBFBD><EFBFBD>ע (watch) <EFBFBD>ܵ<EFBFBD><EFBFBD>е<EFBFBD>һ<EFBFBD><EFBFBD> ready ״̬<EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD>
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҳ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* @param buf {string&} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڲ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ոû<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* @return {unsigned long long} <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡ<EFBFBD>õ<EFBFBD> ready ״̬<EFBFBD><EFBFBD>Ϣ<EFBFBD>ţ<EFBFBD>
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ > 0 <EFBFBD><EFBFBD>˵<EFBFBD><EFBFBD>ȡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾû<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
*/
unsigned long long peek_ready(string& buf);
/**
* <EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD>ǰ<EFBFBD><EFBFBD>ע (watch) <EFBFBD>ܵ<EFBFBD><EFBFBD>е<EFBFBD>һ<EFBFBD><EFBFBD> delayed ״̬<EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD>
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҳ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* @param buf {string&} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڲ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ոû<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* @return {unsigned long long} <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡ<EFBFBD>õ<EFBFBD> delayed ״̬<EFBFBD><EFBFBD>Ϣ<EFBFBD>ţ<EFBFBD>
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ > 0 <EFBFBD><EFBFBD>˵<EFBFBD><EFBFBD>ȡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾû<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
*/
unsigned long long peek_delayed(string& buf);
/**
* <EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD>ǰ<EFBFBD><EFBFBD>ע (watch) <EFBFBD>ܵ<EFBFBD><EFBFBD>е<EFBFBD>һ<EFBFBD><EFBFBD> buried ״̬<EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD>
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҳ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* @param buf {string&} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڲ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ոû<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* @return {unsigned long long} <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡ<EFBFBD>õ<EFBFBD> buried ״̬<EFBFBD><EFBFBD>Ϣ<EFBFBD>ţ<EFBFBD>
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ > 0 <EFBFBD><EFBFBD>˵<EFBFBD><EFBFBD>ȡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾû<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
*/
unsigned long long peek_buried(string& buf);
/**
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֻ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ե<EFBFBD>ǰ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD>õ<EFBFBD>tubeִ<EFBFBD>У<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> buried
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD> delayed ״̬<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD>ƶ<EFBFBD><EFBFBD><EFBFBD> ready <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* @param n {unsigned} <EFBFBD><EFBFBD>ʾÿ<EFBFBD><EFBFBD> kick <EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ޣ<EFBFBD>
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˽<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> kick <EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* @return {int} <EFBFBD><EFBFBD>ʾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>kick<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> -1 <EFBFBD><EFBFBD>ʾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
*/
int kick(unsigned n);
/**
* <EFBFBD><EFBFBD><EFBFBD>ÿͻ<EFBFBD><EFBFBD><EFBFBD>ǰ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD>õ<EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD>ܵ<EFBFBD>
* @param buf {string&} <EFBFBD><EFBFBD><EFBFBD>ǰʹ<EFBFBD>õ<EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD>ܵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڲ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ոû<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* @return {bool} <EFBFBD>Ƿ<EFBFBD><EFBFBD>ɹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
*/
bool list_tube_used(string&buf);
/**
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ѿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD>ܵ<EFBFBD>(tube)<EFBFBD><EFBFBD><EFBFBD>б<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* @param buf {string&} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڲ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ոû<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* @return {bool} <EFBFBD>Ƿ<EFBFBD><EFBFBD>ɹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
*/
bool list_tubes(string& buf);
/**
* <EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD>ǰ<EFBFBD><EFBFBD>ע(watch)<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD>ܵ<EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD>
* @param buf {string&} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڲ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ոû<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* @return {bool} <EFBFBD>Ƿ<EFBFBD><EFBFBD>ɹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
*/
bool list_tubes_watched(string& buf);
/**
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͣ<EFBFBD><EFBFBD>ָ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD>ܵ<EFBFBD>(tube)<EFBFBD>л<EFBFBD>ȡ<EFBFBD><EFBFBD>Ϣ
* @param tube {const char*} <EFBFBD><EFBFBD>Ϣ<EFBFBD>ܵ<EFBFBD><EFBFBD><EFBFBD>
* @param delay {unsigned} ָ<EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* @return {bool} <EFBFBD>Ƿ<EFBFBD><EFBFBD>ɹ<EFBFBD>
*/
bool pause_tube(const char* tube, unsigned delay);
/////////////////////////////////////////////////////////////////////
// <20><><EFBFBD><EFBFBD><EFBFBD>ӿ<EFBFBD>
const char* get_error() const
{
2015-03-08 21:34:00 +08:00
return errbuf_.c_str();
2014-11-19 00:25:21 +08:00
}
socket_stream& get_conn()
{
return conn_;
}
/**
* <EFBFBD><EFBFBD><EFBFBD>ع<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> beanstalkd <EFBFBD>ķ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ<EFBFBD><EFBFBD>ip:port
* @return {const char*} <EFBFBD><EFBFBD>Զ<EFBFBD><EFBFBD><EFBFBD>طǿյ<EFBFBD> beanstalkd <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ
*/
const char* get_addr() const
{
return addr_;
}
2015-03-08 21:34:00 +08:00
2014-11-19 00:25:21 +08:00
private:
char* addr_;
int timeout_;
bool retry_;
2015-03-08 21:34:00 +08:00
string errbuf_;
2014-11-19 00:25:21 +08:00
char* tube_used_;
std::vector<char*> tubes_watched_;
2015-03-08 21:34:00 +08:00
socket_stream conn_;
2014-11-19 00:25:21 +08:00
unsigned long long peek_fmt(string& buf, const char* fmt, ...)
ACL_CPP_PRINTF(3, 4);
bool list_tubes_fmt(string& buf, const char* fmt, ...)
ACL_CPP_PRINTF(3, 4);
unsigned ignore_one(const char* tube);
bool beanstalk_open();
bool beanstalk_use();
unsigned beanstalk_watch(const char* tube);
ACL_ARGV* beanstalk_request(const string& cmdline,
const void* data = NULL, size_t len = 0);
};
} // namespace acl