mirror of
https://github.com/wassname/ray.git
synced 2026-07-08 03:46:18 +08:00
[Streaming] Streaming Cross-Lang API (#7464)
This commit is contained in:
@@ -8,6 +8,14 @@ class Record:
|
||||
def __repr__(self):
|
||||
return "Record(%s)".format(self.value)
|
||||
|
||||
def __eq__(self, other):
|
||||
if type(self) is type(other):
|
||||
return (self.stream, self.value) == (other.stream, other.value)
|
||||
return False
|
||||
|
||||
def __hash__(self):
|
||||
return hash((self.stream, self.value))
|
||||
|
||||
|
||||
class KeyRecord(Record):
|
||||
"""Data record in a keyed data stream"""
|
||||
@@ -15,3 +23,12 @@ class KeyRecord(Record):
|
||||
def __init__(self, key, value):
|
||||
super().__init__(value)
|
||||
self.key = key
|
||||
|
||||
def __eq__(self, other):
|
||||
if type(self) is type(other):
|
||||
return (self.stream, self.key, self.value) ==\
|
||||
(other.stream, other.key, other.value)
|
||||
return False
|
||||
|
||||
def __hash__(self):
|
||||
return hash((self.stream, self.key, self.value))
|
||||
|
||||
Reference in New Issue
Block a user