Uploaded image for project: 'Jackrabbit Oak'
  1. Jackrabbit Oak
  2. OAK-6378

Move the SegmentWriter API to its own interface



    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.7.3, 1.8.0
    • Component/s: segment-tar
    • Labels:


      In order to isolate SegmentWriter from the rest of the implementation, and to match the corresponding SegmentReader, I extracted the API exposed by SegmentWriter to its own interface and moved its implementation in a separate class.

      Moreover, I cleaned up the SegmentWriter a bit by letting. every method of its interface always return a RecordId. Before the refactoring, some methods returned concrete implementations of record classes. The cleanup improves the uniformity of the SegmentWriter interface.

      I see potential in this change for the following reasons.

      • The concrete record implementations (SegmentNodeState, Template, MapRecord, etc.) might be implemented directly on top of the SegmentReader and SegmentWriter API, moved to a different package and tested separately from the rest of the code.
      • SegmentWrier and SegmentReader provide a higher level API that isolates the SegmentStore and its supporting classes. Code using only SegmentWriter and SegmentReader might be able to use RecordId instances as opaque handles to the underlying records, with beneficial effects on code decoupling.

      I have a working version of the refactoring in this branch on GitHub.




            • Assignee:
              frm Francesco Mari
              frm Francesco Mari
            • Votes:
              0 Vote for this issue
              2 Start watching this issue


              • Created: