diff --git a/Rakefile b/Rakefile index ffd8e4db..abc6a3ff 100644 --- a/Rakefile +++ b/Rakefile @@ -1,15 +1,18 @@ require "bundler/gem_tasks" require "rake/testtask" require "standard/rake" -require "rdoc/task" +require "yard" +require "yard/rake/yardoc_task" -RDoc::Task.new do |rdoc| - rdoc.main = "docs/rdoc.rdoc" - rdoc.rdoc_files.include("docs/rdoc.rdoc", +YARD::Rake::YardocTask.new do |yard| + yard.files = [ "lib/sidekiq/api.rb", "lib/sidekiq/client.rb", "lib/sidekiq/worker.rb", - "lib/sidekiq/job.rb") + # "lib/sidekiq/job.rb", + "-", + "Changes.md", + "docs/menu.md"] end Rake::TestTask.new(:test) do |test| diff --git a/docs/menu.md b/docs/menu.md new file mode 100644 index 00000000..f168c8c6 --- /dev/null +++ b/docs/menu.md @@ -0,0 +1,29 @@ +# Sidekiq public API documentation + +Sidekiq provides a number of public APIs for various functionality. + +1. Middleware +2. Lifecycle Events +3. Data API +4. Components + +## Middleware + +Middleware run around the the client-side push and the server-side execution of jobs. This allows plugins which mutate job data or provide additional functionality during the executiong of specific jobs. + +## Lifecycle Events + +With lifecycle events, Sidekiq plugins can register a callback upon `startup`, `quiet` or `shutdown`. +This is useful for starting and stopping your own Threads or services within the Sidekiq process. + +## Data API + +The code in `sidekiq/api` provides a Ruby facade on top of Sidekiq's persistent data within Redis. +It contains many classes and methods for discovering, searching and iterating through the real-time job data within the queues and sets inside Redis. +This API powers the Sidekiq::Web UI. + +## Components (ALPHA) + +Coming in Sidekiq 7.0, Components are elements of code which run inside each Sidekiq process. +They are passed a handle to the Sidekiq container which gives them direct access +to resources like the Logger, Redis connection pool and other registered resources. \ No newline at end of file diff --git a/lib/sidekiq/api.rb b/lib/sidekiq/api.rb index cd43a4dc..bf0177fe 100644 --- a/lib/sidekiq/api.rb +++ b/lib/sidekiq/api.rb @@ -517,7 +517,7 @@ module Sidekiq # Change the scheduled time for this job. # - # @param [Time] the new timestamp for this job + # @param at [Time] the new timestamp for this job def reschedule(at) Sidekiq.redis do |conn| conn.zincrby(@parent.name, at.to_f - @score, Sidekiq.dump_json(@item)) @@ -678,8 +678,7 @@ module Sidekiq # Fetch jobs that match a given time or Range. Job ID is an # optional second argument. # - # @param score [Time] a specific timestamp - # @param score [Range] a timestamp range + # @param score [Time,Range] a specific timestamp or range # @param jid [String, optional] find a specific JID within the score # @return [Array] any results found, can be empty def fetch(score, jid = nil) @@ -706,7 +705,7 @@ module Sidekiq # *This is a slow O(n) operation*. Do not use for app logic. # # @param jid [String] the job identifier - # @returns [SortedEntry] the record or nil + # @return [SortedEntry] the record or nil def find_job(jid) Sidekiq.redis do |conn| conn.zscan_each(name, match: "*#{jid}*", count: 100) do |entry, score|