Skip to content
Switch branches/tags
Go to file

Latest commit

Since the event-stream is using a chunked transfer-encoding, we
have to calculate the size of the data so that client knows how big the
chunk was

format for every chunked event:
size(in hex)\r\n

data itself has to be a sever-sent event following the spec

Whent the stream is done, before closing the connection, we have to end
the chunk stream by sending the following data:


Sending a 0 length data with along with an empty line will end the
keep-alive event-stream connection.

[rfc2616 3.6.1](

Context: We have to hijack the connection so that bbs can be shutdown in
the case of blocked write (slow consumer). If the connection is not in
the hijacked state, ifrit can't terminate the process until the process
get io. [Previous

Refers cloudfoundry/diego-release#552

Git stats


Failed to load latest commit information.
Latest commit message
Commit time

BBS Server GoDoc

Note: This repository should be imported as

API to access the database for Diego.

A general overview of the BBS is documented here.

Reporting issues and requesting features

Please report all issues and feature requests in cloudfoundry/diego-release.


To interact with the BBS from outside of Diego, use the methods provided on the Client interface.

Components within Diego may use the full InternalClient interface to modify internal state.

Code Generation

The protobuf models in this repository require version 3.5 or later of the protoc compiler.


On Mac OS X with Homebrew, run the following to install it:

brew install protobuf


  1. Download a zip archive of the latest protobuf release from here.
  2. Unzip the archive in /usr/local.
  3. chmod a+x /usr/local/bin/protoc to make sure you can use the binary.

If you already have an older version of protobuf installed, you must uninstall it first by running brew uninstall protobuf

Install the gogoproto compiler by running:

go install

Run go generate ./... from the root directory of this repository to generate code from the .proto files as well as to generate fake implementations of certain interfaces for use in test code.

Generating ruby models for BBS models

The following documentation assume the following versions:

  1. protoc > v3.5.0
  2. ruby protobuf gem > 3.6.12

Run the following commands from the models directory to generate .pb.rb files for the BBS models:

  1. gem install protobuf
  2. cp $(which protoc-gen-ruby){,2}
  3. protoc -I$GOPATH/src --proto_path=. --ruby2_out=/path/to/ruby/files *.proto

Note Replace /path/to/ruby/files with the desired destination of the .pb.rb files. That directory must exist before running this command.

Note The above steps assume that is on the GOPATH.

Note Since protoc v3 now ships with a ruby generator, the built-in generator will mask the gem's binary. This requires a small hack in order to be able to use the protobuf gem, the hack is simply to rename the protobuf gem's binary to be ruby2 and ask protoc to generate ruby2 code which will force it to use the binary. For more information please read this github issue


See the instructions in Running the SQL Unit Tests for testing against a SQL backend

See Migrations for information about writing database migrations.

Run Tests

  1. First setup your GOPATH and install the necessary dependencies for running tests.
  2. Setup a MySQL server or a postgres server. Please follow these instructions.
  3. Run the tests from the root directory of the bbs repo:
SQL_FLAVOR=mysql ginkgo -r -p -race


Internal API to access the database for Diego.




No releases published


No packages published