Repository navigation
[Fix #1691] MVStore additional objects persistence #1715
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
Merged
ricardozanini
merged 4 commits into
open-workflow-specification:main
from
fjtirado:Fix_#1691
Sep 28, 2026
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
71 changes: 71 additions & 0 deletions
71
.../api/src/main/java/io/serverlessworkflow/impl/persistence/hashing/DefaultHashFactory.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| /* | ||
| * Copyright 2020-Present The Serverless Workflow Specification Authors | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
| package io.serverlessworkflow.impl.persistence.hashing; | ||
|
|
||
| import com.github.f4b6a3.ulid.Ulid; | ||
| import com.github.f4b6a3.ulid.UlidFactory; | ||
| import io.serverlessworkflow.impl.marshaller.WorkflowInputBuffer; | ||
| import java.util.Optional; | ||
|
|
||
| public class DefaultHashFactory implements HashFactory { | ||
|
|
||
| private final UlidFactory idFactory = UlidFactory.newMonotonicInstance(); | ||
|
|
||
| @Override | ||
| public Optional<HashItem> fromBuffer(byte id, WorkflowInputBuffer buffer) { | ||
| return Optional.ofNullable( | ||
| switch (id) { | ||
| case MD5HashItem.ID -> new MD5HashItem(buffer); | ||
| case IntegerHashItem.ID -> new IntegerHashItem(buffer); | ||
| case HashItem.HASHING_DISABLED -> null; | ||
| default -> throw new UnsupportedOperationException("Unsupported id " + id); | ||
| }); | ||
|
fjtirado marked this conversation as resolved.
|
||
| } | ||
|
|
||
| @Override | ||
| public Optional<HashItem> fromData(byte[] data) { | ||
| if (md5Condition(data)) { | ||
| return Optional.of(new MD5HashItem(data)); | ||
| } else if (intCondition(data)) { | ||
| return Optional.of(new IntegerHashItem(data)); | ||
| } else { | ||
| return Optional.empty(); | ||
| } | ||
| } | ||
|
|
||
| protected boolean intCondition(byte[] data) { | ||
| return data.length > IntegerHashItem.SIZE_THRESHOLD; | ||
| } | ||
|
|
||
| protected boolean md5Condition(byte[] data) { | ||
| return data.length > MD5HashItem.SIZE_THRESHOLD; | ||
| } | ||
|
|
||
| @Override | ||
| public HashIndex indexFromBytes(byte[] bytes) { | ||
| return new DefaultHashIndex(Ulid.from(bytes)); | ||
| } | ||
|
|
||
| @Override | ||
| public HashIndex indexFromString(String str) { | ||
| return new DefaultHashIndex(Ulid.from(str)); | ||
| } | ||
|
|
||
| @Override | ||
| public HashIndex newIndex() { | ||
| return new DefaultHashIndex(idFactory.create()); | ||
| } | ||
| } | ||
51 changes: 51 additions & 0 deletions
51
...ce/api/src/main/java/io/serverlessworkflow/impl/persistence/hashing/DefaultHashIndex.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| /* | ||
| * Copyright 2020-Present The Serverless Workflow Specification Authors | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
| package io.serverlessworkflow.impl.persistence.hashing; | ||
|
|
||
| import com.github.f4b6a3.ulid.Ulid; | ||
| import java.util.Objects; | ||
|
|
||
| public class DefaultHashIndex implements HashIndex { | ||
|
|
||
| private final Ulid ulid; | ||
|
|
||
| public DefaultHashIndex(Ulid ulid) { | ||
| this.ulid = ulid; | ||
| } | ||
|
|
||
| public String toString() { | ||
| return ulid.toString(); | ||
| } | ||
|
|
||
| @Override | ||
| public byte[] toBytes() { | ||
| return ulid.toBytes(); | ||
| } | ||
|
|
||
| @Override | ||
| public int hashCode() { | ||
| return Objects.hash(ulid); | ||
| } | ||
|
|
||
| @Override | ||
| public boolean equals(Object obj) { | ||
| if (this == obj) return true; | ||
| if (obj == null) return false; | ||
| if (getClass() != obj.getClass()) return false; | ||
| DefaultHashIndex other = (DefaultHashIndex) obj; | ||
| return Objects.equals(ulid, other.ulid); | ||
| } | ||
| } |
32 changes: 32 additions & 0 deletions
32
...istence/api/src/main/java/io/serverlessworkflow/impl/persistence/hashing/HashFactory.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| /* | ||
| * Copyright 2020-Present The Serverless Workflow Specification Authors | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
| package io.serverlessworkflow.impl.persistence.hashing; | ||
|
|
||
| import io.serverlessworkflow.impl.marshaller.WorkflowInputBuffer; | ||
| import java.util.Optional; | ||
|
|
||
| public interface HashFactory { | ||
|
|
||
| Optional<HashItem> fromData(byte[] data); | ||
|
|
||
| Optional<HashItem> fromBuffer(byte id, WorkflowInputBuffer buffer); | ||
|
|
||
| HashIndex indexFromBytes(byte[] bytes); | ||
|
|
||
| HashIndex indexFromString(String str); | ||
|
|
||
| HashIndex newIndex(); | ||
| } |
23 changes: 23 additions & 0 deletions
23
...rsistence/api/src/main/java/io/serverlessworkflow/impl/persistence/hashing/HashIndex.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| /* | ||
| * Copyright 2020-Present The Serverless Workflow Specification Authors | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
| package io.serverlessworkflow.impl.persistence.hashing; | ||
|
|
||
| public interface HashIndex { | ||
|
|
||
| String toString(); | ||
|
|
||
| byte[] toBytes(); | ||
| } |
33 changes: 33 additions & 0 deletions
33
...ersistence/api/src/main/java/io/serverlessworkflow/impl/persistence/hashing/HashItem.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| /* | ||
| * Copyright 2020-Present The Serverless Workflow Specification Authors | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
| package io.serverlessworkflow.impl.persistence.hashing; | ||
|
|
||
| import io.serverlessworkflow.impl.marshaller.WorkflowOutputBuffer; | ||
|
|
||
| public interface HashItem { | ||
| final byte HASHING_DISABLED = 0; | ||
|
|
||
| /** | ||
| * byte identifying this hash item type | ||
| * | ||
| * @return any byte except 0, which is reserved value | ||
| */ | ||
| byte id(); | ||
|
|
||
| void writeKey(WorkflowOutputBuffer buffer); | ||
|
|
||
| String key(); | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.