+1 Really helpful! Enrico
Il Dom 18 Set 2022, 15:02 Diego Salvi <lothruin.mir...@gmail.com> ha scritto: > Hi BookKeepers, > I've added a new BP to add a public API for creating embeddable servers: > BP-57 <https://github.com/apache/bookkeeper/issues/3494> > > *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. > > What do you think about it? > > Diego Salvi >