The cl-mongo-id Reference Manual

This is the cl-mongo-id Reference Manual, version 0.1.0, generated automatically by Declt version 4.0 beta 2 "William Riker" on Sun Dec 15 05:10:36 2024 GMT+0.

Table of Contents


1 Introduction


2 Systems

The main system appears first, followed by any subsystem dependency.


2.1 cl-mongo-id

A library for the creation/parsing of MongoDB Object IDs

Author

Andrew Lyon <>

License

MIT

Version

0.1.0

Dependencies
  • bordeaux-threads (system).
  • md5 (system).
  • local-time (system).
  • secure-random (system).
Source

cl-mongo-id.asd.

Child Component

mongo-id.lisp (file).


3 Files

Files are sorted by type and then listed depth-first from the systems components trees.


3.1 Lisp


3.1.1 cl-mongo-id/cl-mongo-id.asd

Source

cl-mongo-id.asd.

Parent Component

cl-mongo-id (system).

ASDF Systems

cl-mongo-id.


3.1.2 cl-mongo-id/mongo-id.lisp

Source

cl-mongo-id.asd.

Parent Component

cl-mongo-id (system).

Packages

cl-mongo-id.

Public Interface
Internals

4 Packages

Packages are listed by definition order.


4.1 cl-mongo-id

Source

mongo-id.lisp.

Nickname

mongoid

Use List

common-lisp.

Public Interface
Internals

5 Definitions

Definitions are sorted by export status, category, package, and then by lexicographic order.


5.1 Public Interface


5.1.1 Ordinary functions

Function: get-hostname (oid &key bytes)
Package

cl-mongo-id.

Source

mongo-id.lisp.

Function: get-inc (oid &key bytes)

Grab the inc value out of a vector oid. Passing :bytes t will return an array of bytes corresponding to the inc value of the ID instead of parsing it as an integer.

Package

cl-mongo-id.

Source

mongo-id.lisp.

Function: get-pid (oid &key bytes)
Package

cl-mongo-id.

Source

mongo-id.lisp.

Function: get-timestamp (oid &key bytes)

Grab the timestamp out of a vector oid. Passing :bytes t will return an array of bytes corresponding to the timestamp part of the ID instead of parsing it as an integer.

Package

cl-mongo-id.

Source

mongo-id.lisp.

Function: oid (&optional id)

Generate a mongo id, in byte vector format.

Package

cl-mongo-id.

Source

mongo-id.lisp.

Function: oid-str (oid)

Given a vector ID, convert it to a string.

Package

cl-mongo-id.

Source

mongo-id.lisp.


5.2 Internals


5.2.1 Special variables

Special Variable: *id-inc*
Package

cl-mongo-id.

Source

mongo-id.lisp.

Special Variable: *id-inc-lock*
Package

cl-mongo-id.

Source

mongo-id.lisp.

Special Variable: *random-value*
Package

cl-mongo-id.

Source

mongo-id.lisp.


5.2.2 Ordinary functions

Function: convert-hex-vector (hex-string)

Takes a hex string, IE 4f2b8096 and converts it into a byte array: 4f2b8096 -> #(79 43 128 150)
Hex string *must* have even number of bytes.

Package

cl-mongo-id.

Source

mongo-id.lisp.

Function: convert-vector-int (vector)

Convert a byte array to an integer: #(79 150 243 81) -> 1335292753

Package

cl-mongo-id.

Source

mongo-id.lisp.

Function: create-new-id ()

Create a brand-spankin-new ObjectId using the current timestamp/inc values, along with hostname and process pid.

Package

cl-mongo-id.

Source

mongo-id.lisp.

Function: get-current-pid (&key if-not-exists-return)

Get the current process’ PID. This function does it’s best to be cross- implementation. If it isn’t able to grab the PID from the system, it defaults to returning whatever value is passed into the :if-not-exists-return key.

Package

cl-mongo-id.

Source

mongo-id.lisp.

Function: get-current-timestamp ()

Get current unix timestamp.

Package

cl-mongo-id.

Source

mongo-id.lisp.

Function: get-inc-val ()

Thread-safe method to get current ObjectId inc value. Takes an optional timestamp value to calculate inc for.

Package

cl-mongo-id.

Source

mongo-id.lisp.


Appendix A Indexes


A.1 Concepts