Sunday, December 10, 2023

Okay. Here's something to describe my intentions.

This might be interesting. This code below discloses the mechanism in Clique Space(TM) by which a deliberation and one deliberator is created when a deliberation's sense datum is received via transmission through a synapse.

   
    public<_SYN extends Synapse<_SYN,?,_P,?,?,?,?,S,I>,_P extends SynapseOwnerParticipant<_SYN,_P,?,S,I>>void internalise(int distance,_P owner,KeyQuale<S,I>key,boolean isAffirming,long ordinal,byte[]signature)
     throws CommonDilemma{
        var t=Fielder.<_SYN,S,I>currentFielder();
        var y=t.currentSolution();
        
        if(owner==null){
            throw new Internalise_OwnerNotGiven(y);
        }

        var dMap=this.deliberations;
        synchronized(dMap){
            var d=dMap.get(ordinal);
            
            if(d==null){
                d=new Locker<Deliberation<R,S,I>,DeliberationQuale<R,S,I>,S,I>(t){
    @Override
    protected Deliberation<R, S, I> processInternally() throws CommonDilemma {
        return this.acquire(Subscriber.this.asQuale(key,isAffirming,ordinal,signature)).subcontent();
    }
                 }.process();
                
                dMap.putIfAbsent(d.ordinal(),d);

                new Deliberator<>(t.sovereign(),d){
    @Override
    protected FirstSolution<Deliberator<R,S,I>,S,I>firstSolution() throws CommonDilemma {
        return Subscriber.this.container().container().first(this,owner.getSynapse(),distance);
    }
                 }.start();
            } //TODO: Else check the key, isAffirming, ordinal, and signature fields correspond...
        }
    }

The code is an extract of the subscriber's "internalise" method, called by a fielder when the fielder is processing the collection of deliberations that reside in each transmitter of a set of transmitters that have been received from other Peers. Unlike the internalise method of a sense datum, this method also receives the Owner Participant of the synapse and the distance - the number of Peers that this deliberation sense datum has passed through before being processed - from this Peer.

The currently running fielder is retrieved and stored in the variable named t, the current solution being executed by the fielder in y. Housekeeping ensures no arguments capable of being null are indeed null.

The collection of deliberations associated to this subscription (assigned to the automatic variable dMap) is a shared resource, and hence is locked so the current fielder has exclusive access to it.

The uninteresting bit (the false branch) of statement that tests whether dMap has an entry that corresponds to the ordinal argument remains unimplemented; I have just written a comment to check that various variables correspond as I intend to put some code in later to do this.

The true branch (when there is no corresponding deliberation associated with the given ordinal) creates a new locker. This locker is used to get exclusive access to the Peer Device's quale container. The processInternally method can execute once the current fielder has access to the quale container so that it can call asQuale - creating a deliberation and its backing quale. The backing quale is acquired by the current fielder and its subcontent (the deliberation) is assigned to the variable d and added to dMap.

Lastly for the true branch, a deliberator is created using d and started.

******

So, what's going on here you may ask.

The running instance of the Peer Device has received a deliberation's sense datum that it hasn't yet encountered. In response, it creates the deliberation, and, by creating and starting a deliberator with the newly created deliberation, has now a chance to understand what it might need to do next - a process which will depend on the implementation of a specific set of methods called from the implementation of the "first" method for a class called the predicate.

The predicate is a component of the class generically referred to as the resonance, accessed by the call to the "first" method (the subscriber's container's container) appearing in the code. Manufacturers or other parties interested in creating a Peer Device instance for a specific type of hardware or software device would craft their own predicate and supply an implementation of these methods.

This is the intent of Clique Space. I believe one can build a network of cooperating Peers (indeed, a "neural" network) of arbitrary complexity using my Clique Space system architecture at its core.