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

Create Str container #3

Open
7 tasks
brunokim opened this issue Jun 4, 2022 · 1 comment
Open
7 tasks

Create Str container #3

brunokim opened this issue Jun 4, 2022 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@brunokim
Copy link
Owner

brunokim commented Jun 4, 2022

Currently, an InsertChar atom can be a direct children of the root atom, since we assume that the whole RList corresponds to a single string. However, in the process to create a nested data structure, we may want to have multiple strings in the same tree.

To accomplish that, we'll create a container for chars, called Str. Multiple Strs may appear as children of the root empty node, and InsertChar operations are only valid within a Str.

Data structures

type Str struct {} // implements AtomValue
  • Str atoms only accept InsertChar and Delete atoms as children.
  • InsertChar atoms only accept InsertChar and Delete atoms as children.
  • The root node must not accept InsertChar as children.

str

Build changes

  • RList.AsString() must validate that the cursor corresponds to a Str node.
  • RList.SetCursor must now be able to move in two dimensions: among the children of the root node, and over the children of a Str, as it does now.
    • Note: a good solution here should allow for deeply nested structures. We should be looking on how to specify a path within the (semantic) structure, and then translate it into a position in the array.
  • Add operation to crdt/rlist_operations_test.go
  • Run go test -fuzz FuzzList and fix any crashes that appear
  • Write manual tests in crdt/rlist_test.go

Demo changes

  • Fix cmd/demo/demo.go to create a str before starting to insert chars.
  • (bonus) allow multiple strings in the user interface.
@brunokim brunokim added the enhancement New feature or request label Jun 4, 2022
@brunokim
Copy link
Owner Author

The restriction that InsertChar can't be a child of root may be postponed, since it'd likely touch many places in the codebase.

@ArturAssisComp ArturAssisComp self-assigned this Aug 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants