architecture.service-provider

API Reference

architecture.service-provider

Provides a framework for registering and finding services and providers of these.

SERVICE-PROVIDER

This package contains functions and classes for defining, using
    and introspecting services and providers thereof.

    For services, the most important functions and macros are
    `find-service' and `define-service'.

    For providers, the most important functions and macros are
    `find-provider', `make-provider', `register-provider/class' and
    `register-provider/funtion'.
  • Type SERVICE-DESIGNATOR
    A symbol designating a service or a service.
  • Type PROVIDER-DESIGNATOR
    A symbol designating a service provider or a service provider.
  • Condition SERVICE-PROVIDER-CONDITION  (CONDITION)
    Superclass of all conditions signaled by the service-provider system.
  • Condition MISSING-SERVICE-WARNING  (STYLE-WARNING, MISSING-SERVICE-CONDITION)
    This warning is signaled when a service specified by a designator cannot be found.
  • Condition MISSING-SERVICE-ERROR  (ERROR, MISSING-SERVICE-CONDITION)
    Subclasses of this are signaled when services specified by designators cannot be found.
  • Condition MISSING-PROVIDER-WARNING  (STYLE-WARNING, MISSING-PROVIDER-CONDITION)
    This warning is signaled when a provider of a certain service is specified as a designator but cannot be found.
  • Condition MISSING-PROVIDER-ERROR  (ERROR, MISSING-PROVIDER-CONDITION)
    This error is signaled when a provider of a certain service is specified as a designator but cannot be found.
  • Generic-Function SERVICE-NAME (service)
    Return the symbol which is the name of SERVICE.
  • Generic-Function SERVICE-PROVIDERS (service)
    Return a sequence of the providers of SERVICE.
  • Generic-Function SERVICE-PROVIDERS/ALIST (service)
    Return the providers of SERVICE as an alist in which CARs are provider names and CDRs are the corresponding provider objects.
  • Generic-Function SERVICE-PROVIDERS/PLIST (service)
    Return the providers of SERVICE as a plist in which keys are provider names and values are the corresponding provider objects.
  • Generic-Function FIND-SERVICE (name &key if-does-not-exist)
    Find and return the service designated by the `service-designator' NAME. IF-DOES-NOT-EXIST controls the behavior in case the designated service cannot be found: The values #'error and 'error cause a `missing-service-error' to be signaled. The values #'warn and 'warn cause a `missing-service-warning' to be signaled and nil to be returned. The value nil causes nil to be returned without any conditions being signaled. `retry' and `use-value' restarts are established around error signaling (if IF-DOES-NOT-EXIST mandates that).
  • Generic-Function (setf FIND-SERVICE) (new-value name &key if-does-not-exist)
    Set the service designated by the `service-designator' NAME to NEW-VALUE. When non-nil, NEW-VALUE has to implement the service protocol. If NAME already designates a service, the existing service object is replaced with NEW-VALUE. If NEW-VALUE is nil, an existing service designated by NAME is removed. IF-DOES-NOT-EXIST is accepted for parity with `find-service' and usually ignored. However, when NEW-VALUE is nil, IF-DOES-NOT-EXIST controls whether an error should be signaled in case the to-be-removed service does not exist.
  • Method SERVICE-NAME ((service symbol))
  • Method SERVICE-PROVIDERS ((service symbol))
  • Method SERVICE-PROVIDERS/ALIST ((service symbol))
  • Method SERVICE-PROVIDERS/PLIST ((service symbol))
  • Method FIND-SERVICE ((name symbol) &key (if-does-not-exist #'error))
  • Method (setf FIND-SERVICE) ((new-value t) (name symbol) &key if-does-not-exist)
  • Generic-Function PROVIDER-NAME (provider)
    Return the symbol which is the name of PROVIDER.
  • Generic-Function FIND-PROVIDER (service provider &key if-does-not-exist)
    Find and return the provider designated by the `provider-designator' PROVIDER in the service designated by the `service-designator' SERVICE. IF-DOES-NOT-EXIST controls the behavior in case SERVICE or PROVIDER cannot be found: The values #'error and 'error cause a `missing-service-error' to be signaled if SERVICE cannot be found and a `missing-provider-error' to be signaled if PROVIDER cannot be found. The values #'warn and 'warn cause a `missing-service-warning' to be signaled if SERVICE cannot be found and a `missing-provider-warning' to be signaled if PROVIDER cannot be found. In both cases, nil is returned. The value nil causes nil to be returned without any conditions being signaled. `retry' and `use-value' restarts are established around error signaling (if IF-DOES-NOT-EXIST mandates that).
  • Generic-Function (setf FIND-PROVIDER) (new-value service provider &key if-does-not-exist)
    Set the provider designated by the `provider-designator' PROVIDER in the service designated by the `service-designator' SERVICE to NEW-VALUE. When non-nil, NEW-VALUE has to implement the provider protocol. If SERVICE and PROVIDER already designate a provider, the existing provider object is replaced with NEW-VALUE. If NEW-VALUE is nil, an existing provider designated by SERVICE and PROVIDER is removed. IF-DOES-NOT-EXIST is accepted for parity with `find-provider' and usually ignored. However, when NEW-VALUE is nil, IF-DOES-NOT-EXIST controls whether an error should be signaled in case the to-be-removed provider does not exist.
  • Generic-Function UPDATE-PROVIDER (service name provider)
    Update the provider designated by NAME in SERVICE with the new value PROVIDER.
  • Generic-Function ADD-PROVIDER (service name provider)
    Add PROVIDER to SERVICE as the provider designated by NAME.
  • Generic-Function REMOVE-PROVIDER (service name provider)
    Remove PROVIDER from SERVICE as the provider designated by NAME.
  • Generic-Function MAKE-PROVIDER (service provider &rest args)
    Make and return an instance of the provider designated by the `provider-designator' PROVIDER of the service designated by the `service-designator' SERVICE.
  • Method FIND-PROVIDER ((service t) (provider t) &key (if-does-not-exist #'error))
  • Method FIND-PROVIDER ((service symbol) (provider t) &key if-does-not-exist)
  • Method (setf FIND-PROVIDER) ((new-value t) (service symbol) (provider t) &key (if-does-not-exist #'warn))
  • Method MAKE-PROVIDER ((service symbol) (provider t) &rest args)
  • Method MAKE-PROVIDER ((service t) (provider t) &rest args)
  • Method SERVICE-PROVIDERS ((service provider-list-mixin))
  • Method SERVICE-PROVIDERS/ALIST ((service provider-list-mixin))
  • Method SERVICE-PROVIDERS/PLIST ((service provider-list-mixin))
  • Method FIND-PROVIDER ((service provider-list-mixin) (provider symbol) &key if-does-not-exist)
  • Method FIND-PROVIDER ((service provider-list-mixin) (provider cons) &key if-does-not-exist)
  • Method (setf FIND-PROVIDER) ((new-value t) (service provider-list-mixin) (provider symbol) &key if-does-not-exist)
  • Method (setf FIND-PROVIDER) ((new-value t) (service provider-list-mixin) (provider cons) &key if-does-not-exist)
  • Method UPDATE-PROVIDER ((service provider-list-mixin) (name t) (provider t))
  • Method ADD-PROVIDER ((service provider-list-mixin) (name t) (provider t))
  • Method REMOVE-PROVIDER ((service provider-list-mixin) (name t) (provider t))
  • Class STANDARD-SERVICE  (NAME-MIXIN, DOCUMENTATION-MIXIN, PROVIDER-LIST-MIXIN, PRINT-ITEMS-MIXIN)
    This class provides a basic implementation of the service protocol. It can be used as a superclass for specialized service classes.
    NAME   Reader: SERVICE-NAME
  • Class CLASS-PROVIDER  (NAME-MIXIN, PRINT-ITEMS-MIXIN)
    Instances of this class provide a particular service by instantiating a given class.
    NAME   Reader: PROVIDER-NAME
    CLASS   Reader: PROVIDER-CLASS
    Stores the class providing the service.
  • Method MAKE-PROVIDER ((service t) (provider class-provider) &rest args)
  • Class FUNCTION-PROVIDER  (NAME-MIXIN, PRINT-ITEMS-MIXIN)
    Instances of this class provide a particular service by calling a given function and returning the result.
    NAME   Reader: PROVIDER-NAME
    FUNCTION   Reader: PROVIDER-FUNCTION
    Stores the function providing the service.
  • Method MAKE-PROVIDER ((service t) (provider function-provider) &rest args)
  • Function REGISTER-SERVICE (name service-class &rest initargs)
    Register a service named NAME according to SERVICE-CLASS and INITARGS. If NAME does not name an existing service, an instance of SERVICE-CLASS is made with INITARGS and registered. If NAME names an existing service, the service is updated via re-initialization, potentially changing its class to SERVICE-CLASS. The new or updated service instance is returned.
  • Macro DEFINE-SERVICE (name &body options)
    Define a service named NAME with additional aspects specified in OPTIONS. The following OPTIONS are accepted: (:service-class CLASS-NAME) Name of the class of the to-be-defined service. Defaults to `standard-service'. (:documentation STRING) If NAME already designates a service, the existing service object is destructively modified according to OPTIONS. The service definition is performed at compile, load and execute time to ensure availability in subsequent provider definitions and/or compilation of e.g. `find-service' calls.
  • Function REGISTER-PROVIDER/CLASS (service-name provider-name &rest args &key (provider-class 'class-provider) (class provider-name) &allow-other-keys)
    Register CLASS as the provider named PROVIDER-NAME of the service designated by SERVICE-NAME. PROVIDER-CLASS can be used to select the class of which the created provider should be an instance. The `cl:documentation' of CLASS is used as the documentation of the provider.
  • Function REGISTER-PROVIDER/FUNCTION (service-name provider-name &rest args &key (provider-class 'function-provider) (function provider-name) &allow-other-keys)
    Register FUNCTION as the provider named PROVIDER-NAME of the service designated by SERVICE-NAME. PROVIDER-CLASS can be used to select the class of which the created provider should be an instance. The `cl:documentation' of FUNCTION is used as the documentation of the provider.

architecture.service-provider-and-hooks

Run hooks when service providers change.

No packages.