File tree Expand file tree Collapse file tree 1 file changed +41
-0
lines changed
src/main/kotlin/spp/protocol/service Expand file tree Collapse file tree 1 file changed +41
-0
lines changed Original file line number Diff line number Diff line change @@ -80,6 +80,47 @@ interface LiveInstrumentService {
8080 }
8181 }
8282
83+ @GenIgnore
84+ fun <T : LiveInstrument > upsertLiveInstrument (
85+ instrument : T
86+ ): Future <T > {
87+ return getLiveInstrument(instrument.id!! ).compose { liveInstrument ->
88+ if (liveInstrument != null ) {
89+ if (liveInstrument.javaClass != instrument.javaClass) {
90+ Future .failedFuture(" Instrument type mismatch" )
91+ } else {
92+ Future .succeededFuture(liveInstrument as T )
93+ }
94+ } else {
95+ addLiveInstrument(instrument).map { it as T }
96+ }
97+ }
98+ }
99+
100+ @GenIgnore
101+ fun upsertLiveWatch (
102+ location : LiveSourceLocation ,
103+ variables : List <String > = emptyList(),
104+ id : String
105+ ): Future <LiveBreakpoint > {
106+ return getLiveInstrument(id).compose { liveInstrument ->
107+ if (liveInstrument != null ) {
108+ Future .succeededFuture(liveInstrument as LiveBreakpoint )
109+ } else {
110+ addLiveBreakpoint(
111+ LiveBreakpoint (
112+ location = location,
113+ variableControl = LiveVariableControl (
114+ variableNameConfig = variables.associateWith { LiveVariableControlBase () }
115+ ),
116+ id = id,
117+ hitLimit = - 1
118+ )
119+ )
120+ }
121+ }
122+ }
123+
83124 /* *
84125 * Applies the given [LiveInstrument].
85126 */
You can’t perform that action at this time.
0 commit comments