def streamInfo(self, uu, omitDescriptor, omitVersion): params = btrdb_pb2.StreamInfoParams(uuid=uu.bytes, omitVersion=omitVersion, omitDescriptor=omitDescriptor) result = self.stub.StreamInfo(params) desc = result.descriptor BTrDBError.checkProtoStat(result.stat) tagsanns = unpack_stream_descriptor(desc) return desc.collection, desc.propertyVersion, tagsanns[0], tagsanns[ 1], result.versionMajor
def streams_in_collection(self, *collection, is_collection_prefix=True, tags=None, annotations=None): """ Search for streams matching given parameters This function allows for searching Parameters ---------- collection: str collections to use when searching for streams, case sensitive. is_collection_prefix: bool Whether the collection is a prefix. tags: Dict[str, str] The tags to identify the stream. annotations: Dict[str, str] The annotations to identify the stream. Returns ------ list A list of stream objects found with the provided search arguments. """ result = [] if tags is None: tags = {} if annotations is None: annotations = {} if not collection: collection = [None] for item in collection: streams = self.ep.lookupStreams(item, is_collection_prefix, tags, annotations) for desclist in streams: for desc in desclist: tagsanns = unpack_stream_descriptor(desc) result.append( Stream(self, uuidlib.UUID(bytes=desc.uuid), known_to_exist=True, collection=desc.collection, tags=tagsanns[0], annotations=tagsanns[1], property_version=desc.propertyVersion)) return result