old_contents: from corehq.blobs import Error as BlobError
  from corehq.form_processor.exceptions import CaseNotFound, XFormNotFound
  from corehq.form_processor.interfaces.dbaccessors import FormAccessors, CaseAccessors
  from pillowtop.dao.exceptions import DocumentNotFoundError
  from pillowtop.dao.interface import ReadOnlyDocumentStore
  
  
  class ReadonlyFormDocumentStore(ReadOnlyDocumentStore):
  
      def __init__(self, domain):
          self.domain = domain
          self.form_accessors = FormAccessors(domain=domain)
  
      def get_document(self, doc_id):
          try:
              return self.form_accessors.get_form(doc_id).to_json()
          except (XFormNotFound, BlobError) as e:
              raise DocumentNotFoundError(e)
  
      def iter_document_ids(self, last_id=None):
          # todo: iterate over sql form IDs
          raise NotImplementedError("You can't do this for SQL form data sources yet.")
  
  
  class ReadonlyCaseDocumentStore(ReadOnlyDocumentStore):
  
      def __init__(self, domain):
          self.domain = domain
          self.case_accessors = CaseAccessors(domain=domain)
  
      def get_document(self, doc_id):
          try:
              return self.case_accessors.get_case(doc_id).to_json()
          except CaseNotFound as e:
              raise DocumentNotFoundError(e)
  
      def iter_document_ids(self, last_id=None):
          return iter(CaseAccessors(self.domain).get_case_ids_in_domain())
  
      def iter_documents(self, ids):
          for wrapped_case in self.case_accessors.iter_cases(ids):
              yield wrapped_case.to_json()
  
new_contents: from corehq.blobs import Error as BlobError
  from corehq.form_processor.exceptions import CaseNotFound, XFormNotFound
  from corehq.form_processor.interfaces.dbaccessors import FormAccessors, CaseAccessors
  from pillowtop.dao.exceptions import DocumentNotFoundError
  from pillowtop.dao.interface import ReadOnlyDocumentStore
  
  
  class ReadonlyFormDocumentStore(ReadOnlyDocumentStore):
  
      def __init__(self, domain):
          self.domain = domain
          self.form_accessors = FormAccessors(domain=domain)
  
      def get_document(self, doc_id):
          try:
              return self.form_accessors.get_form(doc_id).to_json()
          except (XFormNotFound, BlobError) as e:
              raise DocumentNotFoundError(e)
  
      def iter_document_ids(self, last_id=None):
          # todo: iterate over sql form IDs
          raise NotImplementedError("You can't do this for SQL form data sources yet.")
  
      def iter_documents(self, ids):
          for wrapped_form in self.form_accessors.iter_forms(ids):
              yield wrapped_form.to_json()
  
  
  class ReadonlyCaseDocumentStore(ReadOnlyDocumentStore):
  
      def __init__(self, domain):
          self.domain = domain
          self.case_accessors = CaseAccessors(domain=domain)
  
      def get_document(self, doc_id):
          try:
              return self.case_accessors.get_case(doc_id).to_json()
          except CaseNotFound as e:
              raise DocumentNotFoundError(e)
  
      def iter_document_ids(self, last_id=None):
          return iter(CaseAccessors(self.domain).get_case_ids_in_domain())
  
      def iter_documents(self, ids):
          for wrapped_case in self.case_accessors.iter_cases(ids):
              yield wrapped_case.to_json()
  
subject: support iter_documents on forms