class_docstr: The class for filesystem-like external storage.
  
  Raises:
      ValueError: Raises directory path to
          spill objects doesn't exist.
class_docstr_tok: ["The","class","for","filesystem-like","external","storage",".","Raises",":","ValueError",":","Raises","directory","path","to","spill","objects","does","n't","exist","."]
code: def __init__(self, directory_path, buffer_size=None):
      # -- sub directory name --
      self._spill_dir_name = DEFAULT_OBJECT_PREFIX
      # -- A list of directory paths to spill objects --
      self._directory_paths = []
      # -- Current directory to spill objects --
      self._current_directory_index = 0
      # -- File buffer size to spill objects --
      self._buffer_size = -1
  
      # Validation.
      assert (
          directory_path is not None
      ), "directory_path should be provided to use object spilling."
      if isinstance(directory_path, str):
          directory_path = [directory_path]
      assert isinstance(
          directory_path, list
      ), "Directory_path must be either a single string or a list of strings"
      if buffer_size is not None:
          assert isinstance(
              buffer_size, int
          ), "buffer_size must be an integer."
          self._buffer_size = buffer_size
  
      # Create directories.
      for path in directory_path:
          full_dir_path = os.path.join(path, self._spill_dir_name)
          os.makedirs(full_dir_path, exist_ok=True)
          if not os.path.exists(full_dir_path):
              raise ValueError(
                  "The given directory path to store objects, "
                  f"{full_dir_path}, could not be created."
              )
          self._directory_paths.append(full_dir_path)
      assert len(self._directory_paths) == len(directory_path)
      # Choose the current directory.
      # It chooses a random index to maximize multiple directories that are
      # mounted at different point.
      self._current_directory_index = random.randrange(
          0, len(self._directory_paths)
      )
  
imports: import abc
  import logging
  import os
  import random
  import shutil
  import time
  import urllib
  import uuid
  from collections import namedtuple
  from typing import IO, List, Optional, Tuple
  import ray
  from ray._private.ray_constants import DEFAULT_OBJECT_PREFIX
  from ray._raylet import ObjectRef
label_desc: Use image node_id 1 to create a new FileSystemStorage object from inherited base classes: ExternalStorage with example: obj = FileSystemStorage(directory_path, buffer_size)