-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
93 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,7 @@ makedocs(; | |
"genserver.md", | ||
"api.md", | ||
"callbacks.md", | ||
"template.md", | ||
], | ||
) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# GenServer Template | ||
|
||
In order to write your plugin to GenServers you can use the following template: | ||
|
||
```julia | ||
module MyPlugin | ||
using GenServers | ||
|
||
export start # export further interface functions | ||
|
||
# Client (interface) | ||
|
||
start(default...) = genserver(@__MODULE__, default...) | ||
start(name, default...) = genserver(@__MODULE__, default..., name=name) | ||
|
||
# | ||
# write your further interface functions here | ||
# | ||
|
||
# Server (callbacks) | ||
|
||
function init(default...) | ||
# write some initialization code here if needed | ||
return default # the server state gets this return value | ||
end | ||
|
||
function oncast(default..., msg...) | ||
# dispatch on Cast messages | ||
end | ||
|
||
function oncall(default..., msg...) | ||
# dispatch on Call messages | ||
end | ||
|
||
end | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
module MyPlugin | ||
using GenServers | ||
|
||
export start # export further interface functions | ||
|
||
# Client (interface) | ||
|
||
start(default...) = genserver(@__MODULE__, default...) | ||
start(name, default...) = genserver(@__MODULE__, default..., name=name) | ||
|
||
# | ||
# write your further interface functions here | ||
# | ||
|
||
# Server (callbacks) | ||
|
||
function init(default...) | ||
# write some initialization code here if needed | ||
return default # the server state gets this return value | ||
end | ||
|
||
function oncast(default..., msg...) | ||
# dispatch on Cast messages | ||
end | ||
|
||
function oncall(default..., msg...) | ||
# dispatch on Call messages | ||
end | ||
|
||
end |