"""Writer of the buffer."""
from abc import ABC, abstractmethod
from typing import List
[docs]
class BufferWriter(ABC):
"""Interface of the buffer writer."""
[docs]
@abstractmethod
def write(self, data: List) -> None:
"""Write to buffer."""
[docs]
@abstractmethod
def acquire(self) -> int:
"""Acquire the buffer writer.
Returns:
`int`: The reference count of the buffer after acquiring.
"""
[docs]
@abstractmethod
def release(self) -> int:
"""Release the buffer writer. After release, the buffer writer can not be used again.
Returns:
`int`: The reference count of the buffer after releasing.
"""