! Copyright (C) 2007 Chris Double. All Rights Reserved. ! See http://factorcode.org/license.txt for BSD license. ! ! Remote Channels USING: kernel init namespaces assocs arrays random sequences channels match concurrency.messaging concurrency.distributed threads accessors ; IN: channels.remote : publish ( channel -- id ) 256 random-bits dup [ remote-channels set-at ] dip ; : get-channel ( id -- channel ) remote-channels at ; : unpublish ( id -- ) remote-channels delete-at ; TUPLE: remote-channel node id ; C: remote-channel > "remote-channels" send-synchronous dup no-channel = [ no-channel throw ] when* ; PRIVATE> M: remote-channel to ( value remote-channel -- ) [ id>> swap to-message boa ] keep send-message drop ; M: remote-channel from ( remote-channel -- value ) [ id>> from-message boa ] keep send-message ; [ H{ } clone \ remote-channels set-global start-channel-node ] "channel-registry" add-init-hook