Skip to content

Commit

Permalink
[feenkcom/gtoolkit#4251] Log unknown proxy ID requests.
Browse files Browse the repository at this point in the history
  • Loading branch information
akgrant43 committed Dec 17, 2024
1 parent 781b35d commit a766b8c
Show file tree
Hide file tree
Showing 9 changed files with 100 additions and 58 deletions.
2 changes: 1 addition & 1 deletion src/PharoLink/PharoLinkErrorRequestSignal.class.st
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Class {
#name : #PharoLinkErrorRequestSignal,
#superclass : #BeaconSignal,
#superclass : #PharoLinkSignal,
#instVars : [
'dictionary'
],
Expand Down
20 changes: 14 additions & 6 deletions src/PharoLink/PharoLinkRegistry.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ Class {
#superclass : #Object,
#instVars : [
'idToObjMap',
'objToIdMap'
'objToIdMap',
'oldIds'
],
#classVars : [
'Default'
Expand Down Expand Up @@ -46,11 +47,15 @@ PharoLinkRegistry >> createNewObjId [
{ #category : #registry }
PharoLinkRegistry >> deregister: anObjId [
"Remove the supplied id"
| object |
| object olds |

object := idToObjMap at: anObjId ifAbsent: [ ^ nil ].
olds := oldIds at: anObjId ifAbsentPut: [ OrderedCollection new ].
object := idToObjMap at: anObjId ifAbsent:
[ olds add: DateAndTime now -> #missing.
^ nil ].
idToObjMap removeKey: anObjId.
objToIdMap removeKey: object.
olds add: DateAndTime now -> object class name.
^ nil.
]

Expand All @@ -67,6 +72,7 @@ PharoLinkRegistry >> initialize [
super initialize.
idToObjMap := Dictionary new.
objToIdMap := Dictionary new.
oldIds := Dictionary new.
]

{ #category : #registry }
Expand Down Expand Up @@ -135,7 +141,9 @@ PharoLinkRegistry >> register: anObject withId: newObjId [
PharoLinkRegistry >> resolve: objId [
"Answer the object with the supplied id"

^ idToObjMap
at: objId
ifAbsent: [ PharoLinkRegistryUnknownObjectError signalId: objId ]
^ idToObjMap at: objId ifAbsent:
[ PharoLinkRegistryUnknownIdSignal new
unknownId: objId;
isOld: (oldIds includes: objId).
PharoLinkRegistryUnknownObjectError signalId: objId ]
]
16 changes: 8 additions & 8 deletions src/PharoLink/PharoLinkRegistryDifferentIdError.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,21 @@ PharoLinkRegistryDifferentIdError class >> signalId: objId object: anObject [
]

{ #category : #accessing }
PharoLinkRegistryDifferentIdError >> object [
^ object
PharoLinkRegistryDifferentIdError >> objId [
^ objId
]

{ #category : #accessing }
PharoLinkRegistryDifferentIdError >> object: anObject [
object := anObject
PharoLinkRegistryDifferentIdError >> objId: anObject [
objId := anObject
]

{ #category : #accessing }
PharoLinkRegistryDifferentIdError >> objId [
^ objId
PharoLinkRegistryDifferentIdError >> object [
^ object
]

{ #category : #accessing }
PharoLinkRegistryDifferentIdError >> objId: anObject [
objId := anObject
PharoLinkRegistryDifferentIdError >> object: anObject [
object := anObject
]
29 changes: 29 additions & 0 deletions src/PharoLink/PharoLinkRegistryUnknownIdSignal.class.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
Class {
#name : #PharoLinkRegistryUnknownIdSignal,
#superclass : #PharoLinkServerSignal,
#instVars : [
'unknownId',
'isOld'
],
#category : #'PharoLink-Registry'
}

{ #category : #accessing }
PharoLinkRegistryUnknownIdSignal >> isOld [
^ isOld
]

{ #category : #accessing }
PharoLinkRegistryUnknownIdSignal >> isOld: anObject [
isOld := anObject
]

{ #category : #accessing }
PharoLinkRegistryUnknownIdSignal >> unknownId [
^ unknownId
]

{ #category : #accessing }
PharoLinkRegistryUnknownIdSignal >> unknownId: anObject [
unknownId := anObject
]
44 changes: 22 additions & 22 deletions src/PharoLink/PharoLinkServerConnection.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,28 @@ PharoLinkServerConnection >> globals [
^ server globals
]

{ #category : #private }
PharoLinkServerConnection >> handlEnqueue: aDictionary [
"Process the supplied statements"
| command bindings |

bindings := Dictionary new.
(aDictionary at: #bindings) keysAndValuesDo: [ :key :value |
bindings
at: key asSymbol
put: (self deserialize: value) ].
command := PharoLinkEvalCommand
source: (aDictionary at: #statements)
bindings: bindings
id: (aDictionary at: #commandId).
command connection: self.
processes add: ([
PharoLinkServerCurrentConnection
value: self
during: [ command execute: self globals ] ] forkAt:
Processor userSchedulingPriority)
]

{ #category : #'error handling' }
PharoLinkServerConnection >> handleError: aDictionary [

Expand Down Expand Up @@ -106,28 +128,6 @@ PharoLinkServerConnection >> handleNextRequestSafely [
do: [ :ex | self notifyError: ex in: request ]
]

{ #category : #private }
PharoLinkServerConnection >> handlEnqueue: aDictionary [
"Process the supplied statements"
| command bindings |

bindings := Dictionary new.
(aDictionary at: #bindings) keysAndValuesDo: [ :key :value |
bindings
at: key asSymbol
put: (self deserialize: value) ].
command := PharoLinkEvalCommand
source: (aDictionary at: #statements)
bindings: bindings
id: (aDictionary at: #commandId).
command connection: self.
processes add: ([
PharoLinkServerCurrentConnection
value: self
during: [ command execute: self globals ] ] forkAt:
Processor userSchedulingPriority)
]

{ #category : #public }
PharoLinkServerConnection >> handleRequest: aDictionary [
| type syncId registryEntry |
Expand Down
5 changes: 5 additions & 0 deletions src/PharoLink/PharoLinkServerSignal.class.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Class {
#name : #PharoLinkServerSignal,
#superclass : #PharoLinkSignal,
#category : #'PharoLink-Signals'
}
12 changes: 6 additions & 6 deletions src/PharoLink/PharoLinkTestCaseEndAnnouncement.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,12 @@ PharoLinkTestCaseEndAnnouncement class >> testCase: aTestCase startTimestamp: aD
yourself
]

{ #category : #adding }
PharoLinkTestCaseEndAnnouncement >> addToTestResult: aTestResult [

self subclassResponsibility
]

{ #category : #accessing }
PharoLinkTestCaseEndAnnouncement >> additionalProperties [
^ additionalProperties
Expand All @@ -71,12 +77,6 @@ PharoLinkTestCaseEndAnnouncement >> additionalProperties: aDictionary [
^ additionalProperties := aDictionary
]

{ #category : #adding }
PharoLinkTestCaseEndAnnouncement >> addToTestResult: aTestResult [

self subclassResponsibility
]

{ #category : #accessing }
PharoLinkTestCaseEndAnnouncement >> asGtExampleResult [
"Answer the receiver wrapped in the appropriate GtExampleResultX class."
Expand Down
16 changes: 8 additions & 8 deletions src/PharoLink/PharoLinkTraceGroup.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,14 @@ PharoLinkTraceGroup >> populateTree [
self traces do: [ :trace | self addToTreeTrace: trace ]
]

{ #category : #initialization }
PharoLinkTraceGroup >> traceStrings: aCollection [

self traces: (aCollection collect: [ :string |
PharoLinkTrace new traceString: string ]).

]

{ #category : #accessing }
PharoLinkTraceGroup >> traces [

Expand All @@ -43,11 +51,3 @@ PharoLinkTraceGroup >> traces: aCollection [
traces := aCollection.
self populateTree.
]

{ #category : #initialization }
PharoLinkTraceGroup >> traceStrings: aCollection [

self traces: (aCollection collect: [ :string |
PharoLinkTrace new traceString: string ]).

]
14 changes: 7 additions & 7 deletions src/PharoLink/TGtPharoLinkPlayground.trait.st
Original file line number Diff line number Diff line change
Expand Up @@ -77,17 +77,17 @@ TGtPharoLinkPlayground >> gtPlaygroundText [
^ self gtPlaygroundString asRopedText attributesBuilder
]

{ #category : #'ui - accessing' }
TGtPharoLinkPlayground >> gtPlaygroundXdocStore [
"Answer the XDoc store for the receiver."

^ XdKeyDocumentStore forKey: self gtPlaygroundXDocStoreKey
]

{ #category : #'ui - accessing' }
TGtPharoLinkPlayground >> gtPlaygroundXDocStoreKey [
"Answer the key to be used for storing documents.
The base class should override this to use a custom key"

^ self class name
]

{ #category : #'ui - accessing' }
TGtPharoLinkPlayground >> gtPlaygroundXdocStore [
"Answer the XDoc store for the receiver."

^ XdKeyDocumentStore forKey: self gtPlaygroundXDocStoreKey
]

0 comments on commit a766b8c

Please sign in to comment.