Computer and network resources, systems, scopes.

IAcquirableFactory

Available since version 1.0 (view source)

PROTOCOL with method -acquire!

A factory protocol for objects that can be acquired. By convention, resource uri (if object to be acquired is a resource) is stored under :uri key and scope options, if any, are stored under :scope key.

If a factory object also implements ISystem protocol, start! should be used instead, which implicitly calls acquire! when all dependencies are resolved.

-acquire!

Available since version 1.0 (view source)

not referred automatically

Usage:
  • (-acquire! factory)

Type signature:
  • (Any) → Any

Returns an acquired object. Does not neccessarily have to be releasable.

See also: IAcquirableFactory

IConfigurable

Available since version 1.0 (view source)

PROTOCOL with method -autoconf

A feature protocol for objects that can be automatically configured, either fully or partially, from external configuration map.

See also: system, start!

-autoconf

Available since version 1.0 (view source)

not referred automatically

Usage:
  • (-autoconf this)

Type signature:
  • (Any) → []

Returns collection of maps that specifies how individual fields should be configured. Example: [{:key :field-name :path [:path :in :cfg] :type ValueType}] When no type is specified, configuration framework should use field’s type signature for that. Can return just path instead, if all fields are on the same path and default types should be used. Can return :default in which case the configuration framework constructs path from type’s namespace.

See also: IConfigurable

IControllable

Available since version 1.0 (view source)

not referred automatically

PROTOCOL with method -controller

A protocol for resources with controllers.

-controller

Available since version 1.0 (view source)

not referred automatically

Usage:
  • (-controller this)

Type signature:
  • (Any) → IAdjustable

Returns mutable reference to the controller map.

See also: IControllable

IFlushable

Available since version 1.0 (view source)

not referred automatically

PROTOCOL with method -flush!

A protocol for flushable objects.

See also: flushable?, flush

-flush!

Available since version 1.0 (view source)

not referred automatically

Usage:
  • (-flush! this)

Type signature:
  • (Any) → nil

Flushes any pending operations, returns nil. May block.

See also: IFlushable

IImmutableReadable

Available since version 1.0 (view source)

not referred automatically

PROTOCOL with method -read

A protocol for objects that support immutable reads. This protocol should be implemented on resource factories, not on acquired resources.

See also: read, read!

-read

Available since version 1.0 (view source)

not referred automatically

Usage:
  • (-read this)

Type signature:
  • (Any) → IRed

Returns finite collection recipe attached to this.

See also: IImmutableReadable

IReadable

Available since version 1.0 (view source)

not referred automatically

PROTOCOL with method -read!

extensions of this protocol on existing types are forbidden (performance and/or backwards compatibility reasons).

A protocol for readable objects. May return postponed object if object is in non-blocking mode. It is a conscious decision to not support timeouts. Such logic should be handled up in the abstraction by e.g. channels.

See also: readable?, read!, read

-read!

Available since version 1.0 (view source)

not referred automatically

Usage:
  • (-read! this)

Type signature:
  • (Any) → IRed

Returns collection recipe attached to this. Returned collection recipe must be reduced inside io! block. The returned collection recipe may be infinite and may block.

Reducing collection while it is being released may end by reduction premature end or by an I/O exception. It is thus advised to either expect an exception or to stop reducing before releasing the resource.

May return postponed object if this is in a non-blocking mode.

See also: IReadable

IReleasable

Available since version 1.0 (view source)

not referred automatically

PROTOCOL with method -release!

A state protocol for releasable objects. Note that there are no public functions for this protocol, as the release process should be handled through scopes. Types implementing IReleasable must also call -release! in their finalize method. defreleasable macro handles this transparently.

-release!

Available since version 1.0 (view source)

not referred automatically

Usage:
  • (-release! this)

Type signature:
  • (Any) → nil

Releases this object, blocking until the release is not finished (either successfully or not). Releasing an object not in OPEN state must be a nop. Returns nil. Throws if release has failed. Object must not be left in OPEN state both during the release process is running and after the release process is done (either successfully or not). Thread safe resources must manage their state so that several threads calling -release!, open?, etc. will work fine.

See also: IReleasable

IRequestable

Available since version 1.0 (view source)

not referred automatically

PROTOCOL with method -request!

A protocol for synchronized requestable objects.

experimental, subject to change.

See also: request!

-request!

Available since version 1.0 (view source)

not referred automatically

Usage:
  • (-request! this request)

Type signature:
  • (Any ⨯ Any) → Any

Returns a response to the request. Blocks.

See also: IRequestable

ISeekable

Available since version 1.0 (view source)

not referred automatically

PROTOCOL with methods -size, -position

A protocol for seekable objects with fixed size.

See also: seekable?, size, position

-size

Available since version 1.0 (view source)

not referred automatically

Usage:
  • (-size this)

Type signature:
  • (Any) → Integer+

Returns the current size of this.

See also: ISeekable

-position

Available since version 1.0 (view source)

not referred automatically

Usage:
  • (-position this)

Type signature:
  • (Any) → IMutable

Returns a mutable reference to the current position.

See also: ISeekable

IStatusable

Available since version 1.0 (view source)

not referred automatically

PROTOCOL with method -status

A protocol for statusable objects.

-status

Available since version 1.0 (view source)

not referred automatically

Usage:
  • (-status this)

Type signature:
  • (Any) → IReference

Returns an immutable reference to the status map. Returned reference usually also behaves as a Mult.

See also: IStatusable

ISystem

Available since version 1.0 (view source)

not referred automatically

MARKER PROTOCOL

A marker protocol for system objects which should be started with start! function.

See also: system?, start!, acquire!, system

IWritable

Available since version 1.0 (view source)

not referred automatically

PROTOCOL with method -write!

extensions of this protocol on existing types are forbidden (performance and/or backwards compatibility reasons).

A protocol for writable object. It is a conscious decision to not support timeouts. Such logic should be handled up in the abstraction tree by e.g. channels.

-write!

Available since version 1.0 (view source)

not referred automatically

Usage:
  • (-write! this coll)

Type signature:
  • (Any ⨯ IRed) → (U Integer+ Postponed)

Writes coll into this and returns number of items written. Blocks or returns postponed object if in non-blocking mode. Throws if I/O error occurs.

See also: IWritable