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

Add StateType and StateWrapper objects to the model #13858

Merged
merged 1 commit into from
Jun 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
"$schema": http://json-schema.org/draft-07/schema#
"$id": https://github.com/airbytehq/airbyte/blob/master/airbyte-config/models/src/main/resources/types/StateType.yaml
title: StateType
description: State Types
type: string
enum:
- global
- stream
- legacy
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add notSet here, I think it will be valuable.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not clear the value it adds. I understand we currently consider notSet as legacy and we are should be defaulting new ones to global or stream.
With that in mind, notSet feels like a duplicate of legacy at the moment.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this can be confusing for example:

  • start: legacy state
  • 1 sync is run with the new format: stream or global state
  • 1 full reset is run, all the set will be deleted. The state will then be considered as a legacy state.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed, we can use Optional<StateWrapper>.empty() to represent the notSet state.

Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
"$schema": http://json-schema.org/draft-07/schema#
"$id": https://github.com/airbytehq/airbyte/blob/master/airbyte-config/models/src/main/resources/types/StateWrapper.yaml
title: StateWrapper
description: Wrapper around the different type of States
type: object
additionalProperties: false
required:
- stateType
properties:
stateType:
description: The type of the state being wrapped
"$ref": StateType.yaml
legacyState:
description: Legacy State for states that haven't been migrated yet
type: object
existingJavaType: com.fasterxml.jackson.databind.JsonNode
global:
description: Representation of the shared
type: object
existingJavaType: io.airbyte.protocol.models.AirbyteStateMessage
stateMessages:
type: array
items:
type: object
existingJavaType: io.airbyte.protocol.models.AirbyteStateMessage