User Tools

Site Tools


osrf-devel:persist-stacks

User Comments

STACK style Slot methods

Uses the Slot in FILO mode, pushing and pulling objects at the same end of a list. The STACK API-Namespace is useful for creating a global Application context stack.

opensrf.persist.stack.push( slot_name, object )

Adds an object to a Slot in FILO order.

  • Parameters:
    • slot_name
      The name of the Persistence Slot to use for storing the object.
    • object
      The object that should be pushed onto the front of the STACK.
  • Returns:
    • Success
      The name of the Slot that was used.
    • Failure
      An empty (NULL) result.

opensrf.persist.stack.pop( slot_name )

Removes and returns the next value in a STACK type Slot.

  • Parameters:
    • slot_name
      The name of the Persistence Slot from which an object should be retrieved.
  • Returns:
    • Success
      The next object on the STACK Slot, or an empty (NULL) result if the Slot is empty.
    • Failure
      An empty (NULL) result.

opensrf.persist.stack.peek( slot_name )

Returns the next value in a STACK type Slot <u>without</u> removing it.

  • Parameters:
    • slot_name
      The name of the Persistence Slot from which an object should be retrieved.
  • Returns:
    • Success
      The next object on the STACK Slot, or an empty (NULL) result if the Slot is empty.
    • Failure
      An empty (NULL) result.

opensrf.persist.stack.peek.all( slot_name )

Returns all values in a STACK type Slot <u>without</u> removing them.

  • Parameters:
    • slot_name
      The name of the Persistence Slot from which the objects should be retrieved.
  • Returns:
    • Success
      A stream of all objects on the STACK Slot, or an empty (NULL) result if the Slot is empty.
    • Failure
      An empty (NULL) result.

opensrf.persist.stack.peek.all.atomic( slot_name )

Returns all values in a STACK type Slot <u>without</u> removing them.

  • Parameters:
    • slot_name
      The name of the Persistence Slot from which the objects should be retrieved.
  • Returns:
    • Success
      A single array of all objects on the STACK Slot, or an empty array if the Slot is empty.
    • Failure
      An empty (NULL) result.

opensrf.persist.stack.depth( slot_name )

Returns the number of objects in the STACK type Slot.

  • Parameters:
    • slot_name
      The name of the Persistence Slot in question.
  • Returns:
    • Success
      The number of objects in the Persistence Slot.
    • Failure
      An empty (NULL) result.

opensrf.persist.stack.size( slot_name )

Returns the number bytes taken up by the JSON encoded version of the objects in the STACK type Slot.

  • Parameters:
    • slot_name
      The name of the Persistence Slot in question.
  • Returns:
    • Success
      The space, in bytes, used by the JSON encoded objects in the Persistence Slot.
    • Failure
      An empty (NULL) result.
osrf-devel/persist-stacks.txt · Last modified: 2022/02/10 13:34 by 127.0.0.1

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki

© 2008-2022 GPLS and others. Evergreen is open source software, freely licensed under GNU GPLv2 or later.
The Evergreen Project is a U.S. 501(c)3 non-profit organization.