Skip to content

Instantly share code, notes, and snippets.

@avuserow
Created February 10, 2015 06:08
Show Gist options
  • Save avuserow/d015dd9a34891880de37 to your computer and use it in GitHub Desktop.
Save avuserow/d015dd9a34891880de37 to your computer and use it in GitHub Desktop.
Sample enum conversion
enum GearmanReturn (
'GEARMAN_SUCCESS',
'GEARMAN_IO_WAIT',
'GEARMAN_SHUTDOWN',
'GEARMAN_SHUTDOWN_GRACEFUL',
'GEARMAN_ERRNO',
'GEARMAN_EVENT', # DEPRECATED', SERVER ONLY
'GEARMAN_TOO_MANY_ARGS',
'GEARMAN_NO_ACTIVE_FDS', # No servers available
'GEARMAN_INVALID_MAGIC',
'GEARMAN_INVALID_COMMAND',
'GEARMAN_INVALID_PACKET',
'GEARMAN_UNEXPECTED_PACKET',
'GEARMAN_GETADDRINFO',
'GEARMAN_NO_SERVERS',
'GEARMAN_LOST_CONNECTION',
'GEARMAN_MEMORY_ALLOCATION_FAILURE',
'GEARMAN_JOB_EXISTS', # see gearman_client_job_status()
'GEARMAN_JOB_QUEUE_FULL',
'GEARMAN_SERVER_ERROR',
'GEARMAN_WORK_ERROR',
'GEARMAN_WORK_DATA',
'GEARMAN_WORK_WARNING',
'GEARMAN_WORK_STATUS',
'GEARMAN_WORK_EXCEPTION',
'GEARMAN_WORK_FAIL',
'GEARMAN_NOT_CONNECTED',
'GEARMAN_COULD_NOT_CONNECT',
'GEARMAN_SEND_IN_PROGRESS', # DEPRECATED', SERVER ONLY
'GEARMAN_RECV_IN_PROGRESS', # DEPRECATED', SERVER ONLY
'GEARMAN_NOT_FLUSHING',
'GEARMAN_DATA_TOO_LARGE',
'GEARMAN_INVALID_FUNCTION_NAME',
'GEARMAN_INVALID_WORKER_FUNCTION',
'GEARMAN_NO_REGISTERED_FUNCTION',
'GEARMAN_NO_REGISTERED_FUNCTIONS',
'GEARMAN_NO_JOBS',
'GEARMAN_ECHO_DATA_CORRUPTION',
'GEARMAN_NEED_WORKLOAD_FN',
'GEARMAN_PAUSE', # Used only in custom application for client return based on work status', exception', or warning.
'GEARMAN_UNKNOWN_STATE',
'GEARMAN_PTHREAD', # DEPRECATED', SERVER ONLY
'GEARMAN_PIPE_EOF', # DEPRECATED', SERVER ONLY
'GEARMAN_QUEUE_ERROR', # DEPRECATED', SERVER ONLY
'GEARMAN_FLUSH_DATA', # Internal state', should never be seen by either client or worker.
'GEARMAN_SEND_BUFFER_TOO_SMALL',
'GEARMAN_IGNORE_PACKET', # Internal only
'GEARMAN_UNKNOWN_OPTION', # DEPRECATED
'GEARMAN_TIMEOUT',
'GEARMAN_ARGUMENT_TOO_LARGE',
'GEARMAN_INVALID_ARGUMENT',
'GEARMAN_IN_PROGRESS', # See gearman_client_job_status()
'GEARMAN_MAX_RETURN', # Always add new error code before
);
say GEARMAN_MAX_RETURN.value;
say +GEARMAN_MAX_RETURN; # the same
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment