Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes to the event topology #28

Closed
JGAntunes opened this issue Feb 19, 2019 · 1 comment
Closed

Changes to the event topology #28

JGAntunes opened this issue Feb 19, 2019 · 1 comment
Labels
spec This is an issue that implies changes to the spec

Comments

@JGAntunes
Copy link
Owner

JGAntunes commented Feb 19, 2019

After discussion with @luisveiga some changes were performed to the specification of Pulsarcast. These changes have been implemented in https://github.com/JGAntunes/js-pulsarcast already.

Changes

The Allowed Publishers, ability to Request to Publish and the Linking of events are dictated by the topic descriptor. This is what we call event topology given it dictates how the event tree is structured.

The new Topic Descriptor:

const topicDescriptor = Joi.object().keys({
  name: Joi.string().required(),
  author: Joi.binary().required(),
  parent: Joi.object().keys({
    '/': Joi.binary()
  }).required(),
  '#': Joi.object().pattern(Joi.string(), Joi.object().keys({
    '/': Joi.binary().required()
  })).required(),
  metadata
})

const metadata = Joi.object().keys({
  created: Joi.date().iso().required(),
  protocolVersion: Joi.string().required(),
  allowedPublishers: Joi.object().keys({
    enabled: Joi.boolean(),
    peers: Joi.alternatives()
      .when('enabled', {is: true, then: Joi.array().items(Joi.binary()).min(1)})
  }).required(),
  requestToPublish: Joi.object().keys({
    enabled: Joi.boolean(),
    peers: Joi.array().items(Joi.binary())
  }).required(),
  eventLinking: Joi.string().valid(['LAST_SEEN', 'CUSTOM']).required()
}).required()

The event descriptor remains unchanged with the exception of two distinct fields in its metadata which is author and publisher.

This also introduces a new kind of RPC which is REQUEST_TO_PUBLISH essentially sending an event without a publisher, looking for someone willing to publish it.

Consequences

The essential idea is to add support for multiple scenarios where we want to control who's allowed to publish and how are the events linked.

Examples:

If we wanted to have order guarantee in our event tree (essentially creating a chain of linked events) we could have a topic with only its author as an allowed publisher, that would allow requests to publish and where the event linking is done based on the last seen event.

If we wanted to leave it up to application how the events are to be linked, we could allow custom event linking, giving the ability to set a custom parent to the event at the time of publish.

@JGAntunes JGAntunes added the spec This is an issue that implies changes to the spec label Feb 19, 2019
@JGAntunes JGAntunes mentioned this issue Aug 26, 2019
3 tasks
@JGAntunes
Copy link
Owner Author

Implemented and detailed already 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
spec This is an issue that implies changes to the spec
Projects
None yet
Development

No branches or pull requests

1 participant