예제 #1
0
 def share_sizes(
         storage_index_or_slot=StorageIndex,
         # Notionally, ChoiceOf(None, SetOf(int, maxLength=MAX_BUCKETS)).
         # However, support for such a construction appears to be
         # unimplemented in Foolscap.  So, instead...
         sharenums=Any(),
 ):
     """
     Get the size of the given shares in the given storage index or slot.  If a
     share has no stored state, its size is reported as 0.
     """
     return DictOf(int, Offset)
예제 #2
0
    def stat_shares(storage_indexes_or_slots=ListOf(StorageIndex), ):
        """
        Get various metadata about shares in the given storage index or slot.

        :return [{int: ShareStat}]: A list of share stats.  Dictionaries in
            the list corresponds to the results for each storage index
            requested by the ``storage_indexes_or_slots`` argument.  Items in
            the dictionary give share stats for each share known to this
            server to be associated with the corresponding storage index.
            Keys are share numbers and values are the stats.
        """
        # Any() should be ShareStat but I don't know how to spell that.
        return ListOf(DictOf(int, Any()))
예제 #3
0
 def get_version():
     return DictOf(str, Any())
예제 #4
0
# Note that old v1 clients (which are gone now) did not sign messages, so v2
# servers would deliver v2-format messages with sig_vs=claimed_key_vs=None.
# These days we should always get a signature and a pubkey.

Announcement_v2 = Any()


class RIIntroducerSubscriberClient_v2(RemoteInterface):
    __remote_name__ = "RIIntroducerSubscriberClient_v2.tahoe.allmydata.com"

    def announce_v2(announcements=SetOf(Announcement_v2)):
        """I accept announcements from the publisher."""
        return None


SubscriberInfo = DictOf(str, Any())


class RIIntroducerPublisherAndSubscriberService_v2(RemoteInterface):
    """To publish a service to the world, connect to me and give me your
    announcement message. I will deliver a copy to all connected subscribers.
    To hear about services, connect to me and subscribe to a specific
    service_name."""
    __remote_name__ = "RIIntroducerPublisherAndSubscriberService_v2.tahoe.allmydata.com"

    def get_version():
        return DictOf(str, Any())

    def publish_v2(announcement=Announcement_v2, canary=Referenceable):
        return None
예제 #5
0
 def get_version():
     return DictOf(bytes, Any())
예제 #6
0
# backwards-compatibility code.

# Note that old v1 clients (which are gone now) did not sign messages, so v2
# servers would deliver v2-format messages with sig_vs=claimed_key_vs=None.
# These days we should always get a signature and a pubkey.

Announcement_v2 = Any()

class RIIntroducerSubscriberClient_v2(RemoteInterface):
    __remote_name__ = native_str("RIIntroducerSubscriberClient_v2.tahoe.allmydata.com")

    def announce_v2(announcements=SetOf(Announcement_v2)):
        """I accept announcements from the publisher."""
        return None

SubscriberInfo = DictOf(bytes, Any())

class RIIntroducerPublisherAndSubscriberService_v2(RemoteInterface):
    """To publish a service to the world, connect to me and give me your
    announcement message. I will deliver a copy to all connected subscribers.
    To hear about services, connect to me and subscribe to a specific
    service_name."""
    __remote_name__ = native_str("RIIntroducerPublisherAndSubscriberService_v2.tahoe.allmydata.com")
    def get_version():
        return DictOf(bytes, Any())
    def publish_v2(announcement=Announcement_v2, canary=Referenceable):
        return None
    def subscribe_v2(subscriber=RIIntroducerSubscriberClient_v2,
                     service_name=bytes, subscriber_info=SubscriberInfo):
        """Give me a subscriber reference, and I will call its announce_v2()
        method with any announcements that match the desired service name. I