apache / apache/bookkeeper

BP-57: Add a public API for creating embeddable servers

Open
#3,494 2 comments 0 reactions 0 assignees View on GitHub
type/proposal
Dominant language
Java
Stars
2k
Forks
976
Avg merge
6d 15h
Merged PRs (30d)
7

Description

This is the master ticket for tracking BP-57

### Motivation

BK is used and run in many OS project as an embedded resource.
Every time a project needs to embed BK (think about Pulsar, Pravega or HerdDB as some examples) boilerplate code need to be written (and then mantained as per 4.15 changes).
Depending from the contest new feature cannot be made directly available and more code need to be added.
To run an embedded bookie you need to instantiate many components that are really in "public" api and can and will be subject to changes.

### Proposal

We already have the whole code to start a BK server instance, it just needs to be refactored and exposed as a public API.
My idea is to refactor all the code currently at `org.apache.bookkeeper.server.Main#buildBookieServer` and expose it with a builder pattern.
The builder will accept an initial BookieConfiguration (and with no more interaction will produce the same server currently produced from org.apache.bookkeeper.server.Main#buildBookieServer) and will create from the configuration any component not directly provided to the builder.
For example you can provide your instances for StatsProvider or MetadataBookieDriver instance or your custom ByteBufAllocator without the need to rewrite the same plain old code.
Another big improvement: new features that whould need additional code to be added (just think when integrity checking has been added in BP-46) are already and directly usable.

Proposal PR - [#3489]

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.