Github user anmolnar commented on the issue:

    https://github.com/apache/zookeeper/pull/690
  
    @yisong-yue 
    Global state can still be maintained in a static field of a concrete class, 
it shouldn't be a problem.
    
    Though, you're probably right about `SnapStream` cannot maintain a state on 
its own, I believe because the methods should actually belong to `FileSnap`. 
Taking one step back and looking at how `FileSnap` works, I think - in terms of 
inheritance - the following would be the best to represent relationships:
    
    ```
    SnapShot (interface) - represents a single snapshot of the DataTree
    |
    \\ _ FileSnap (abstract) - implements common methods for all file-based 
snapshots
        |
        \\ _ GzipFileSnap (concrete) - Gzip-compressed file-based snapshot
        |
        \\ _ SnappyFileSnap (concrete) - Snappy compressed file-based snapshot
        |
        ...
    ```
    
    In this example, your new methods should go into the right concrete class 
whether it's Gzip, Snappy, etc. related or in the abstract `FileSnap` class if 
it's some common method.
    
    Of course, this needs to do a bit of a refactor which might not be trivial, 
so I wouldn't say we have to do this. I just wanted to give you an idea and get 
some feedback from you and the community. 


---

Reply via email to