Skip to content

Commit

Permalink
Update README.md (#33)
Browse files Browse the repository at this point in the history
  • Loading branch information
pavelpatrin authored Jun 29, 2024
1 parent 4b045bc commit 6c533d4
Showing 1 changed file with 36 additions and 36 deletions.
72 changes: 36 additions & 36 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,42 +126,6 @@ There are several predefined by container service types that may be used as a de
1. The `gontainer.Resolver` service provides a service to resolve dependencies dynamically.
1. The `gontainer.Invoker` service provides a service to invoke functions dynamically.

### Container Interface

```go
// Container defines service container interface.
type Container interface {
// Start initializes every service in the container.
Start() error

// Close closes service container with all services.
// Blocks invocation until the container is closed.
Close() error

// Done is closing after closing of all services.
Done() <-chan struct{}

// Factories returns all defined factories.
Factories() []*Factory

// Services returns all spawned services.
Services() []any

// Events returns events broker instance.
Events() Events

// Resolver returns service resolver instance.
// If container is not started, only requested services
// will be spawned on `resolver.Resolve(...)` call.
Resolver() Resolver

// Invoker returns function invoker instance.
// If container is not started, only requested services
// will be spawned to invoke the func.
Invoker() Invoker
}
```

### Services

A service is a functional component of the application, created and managed by a Service Factory.
Expand Down Expand Up @@ -222,6 +186,42 @@ to publish events to, and subscribe to events from, a centralized broker.
This mechanism allows services to remain decoupled while still being able to interact through a centralized medium.
In particular, the `gontainer.Events` service provides an interface to the events broker and can be injected as a dependency in any service factory.

### Container Interface

```go
// Container defines service container interface.
type Container interface {
// Start initializes every service in the container.
Start() error

// Close closes service container with all services.
// Blocks invocation until the container is closed.
Close() error

// Done is closing after closing of all services.
Done() <-chan struct{}

// Factories returns all defined factories.
Factories() []*Factory

// Services returns all spawned services.
Services() []any

// Events returns events broker instance.
Events() Events

// Resolver returns service resolver instance.
// If container is not started, only requested services
// will be spawned on `resolver.Resolve(...)` call.
Resolver() Resolver

// Invoker returns function invoker instance.
// If container is not started, only requested services
// will be spawned to invoke the func.
Invoker() Invoker
}
```

### Container Events

1. **ContainerStarting**: produced when container start method invoked. Synchronous.
Expand Down

0 comments on commit 6c533d4

Please sign in to comment.