Skip to content

couchbaselabs/expiry-notifier

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

expiry-notifier

A super lightweight shared nothing service for performing expiry callbacks against a Couchbase bucket where TTL (time to live) are set. The service provides a list of meta id's and expiry times for keys that will expire within a specified interval. It runs a simple instance of node.js and is configured exclusively through a REST API. It can be called dynamically as needed from an application, or configured to loop indefinitely and send the list of keys at a specified interval.

Installation

  • [1] Install Node.js
  • [2] Clone this repository
  • [3] From the expiry-notifier directory, run "npm install"
  • [4] Run, "npm start"

REST API DOCUMENTATION

/status [RETURNS: {JSON OBJECT} for configured parameters]

--Retrieves System Status.

/setup/server/:server/:port/:bucket [RETURNS: {JSON OBJECT} with status change]

--Sets the reference to the Couchbase server and bucket.

/setup/endpoint/:hostname/:port/:path/<:https> [RETURNS: {JSON OBJECT} with status change]

--Sets the endpoint url to send the list of expiring keys to as http://hostname:port/path. If "https" is passed, notifications will be sent over https. Note: omit any LEADING "/" characters in the :path. For example to send notifications to https://foo.com/bar call /setup/endpoint/foo.com/443/bar/https

/setup/poll/:interval/:loop [RETURNS: {JSON OBJECT} with status change]

--Sets the time window (:interval) in seconds to check for expiring keys. If :loop is set to "loop", the service will check run indefinitely, checking for expiring keys at the specified :interval. Looping requires endpoint above be defined.

/setup/poll/clear [RETURNS: {JSON OBJECT} with status change]

--clears existing looping functionality.

/setup/relative/:bool [RETURNS: {JSON OBJECT} with status change]

--Sets the timing format returned with each meta id for keys that have expiry within the current polling interval. Default is UNIX epoch time, the number of seconds from 1/1/1970 when the key will expire. If relative is set to "true" it will return the number of seconds until the key expires from now.

/poll/:interval [RETURNS: {JSON OBJECT} with meta.id, meta.expiry (or if relative set to "true": seconds until expiry)]

--Request for applications to dynamically call the service (instead of a looped instance) to return meta id's and expiry times for keys set to expire within the time window (:interval).

/create/:id/:sessioninfo/:TTL [RETURNS: {JSON OBJECT] with session information created]

--Creates a session with an id, information, and a ttl for testing.

About

Expiry Callback Notifier with Configurable Endpoint

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published