urbit/ape/work.hoon

287 lines
8.1 KiB
Plaintext
Raw Normal View History

2015-08-21 02:28:58 +03:00
:: not implemented: set audience
2015-08-20 01:40:03 +03:00
::
::::
::
/? 314
2015-08-20 03:36:40 +03:00
/- *work
2015-08-20 01:40:03 +03:00
/+ talk
!:
::::
::
|%
++ move (pair bone card) :: all actions
++ card :: general card
2015-08-20 03:36:40 +03:00
$% [%diff %work-report client] ::
2015-08-20 01:40:03 +03:00
[%peer wire dock path] ::
[%poke wire dock pear] ::
== ::
++ pear :: poke fruit
2015-08-20 03:36:40 +03:00
$% [%talk-command command:talk] ::
2015-08-20 01:40:03 +03:00
== ::
--
!:
::::
::
2015-08-21 00:00:18 +03:00
|_ [bowl client connected=_|]
2015-08-20 01:40:03 +03:00
++ at
2015-08-21 00:15:02 +03:00
|= [claiming=? audience=(set station:talk) task]
=* tax +<+>
2015-08-20 01:40:03 +03:00
=| moves=(list move)
|%
++ abet
^- [(list move) _+>.$]
2015-08-21 00:15:02 +03:00
[(flop moves) +>.$(tasks (~(put by tasks) id +<.$))]
2015-08-21 00:00:18 +03:00
::
++ abut
^- [(list move) _+>.$]
[(flop moves) +>.$]
::
2015-08-20 01:40:03 +03:00
++ send
2015-08-20 03:36:40 +03:00
|= action=duty:work-stuff:talk
2015-08-20 01:40:03 +03:00
^+ +>
%_ +>.$
eny (sham eny action)
moves
2015-08-20 03:36:40 +03:00
:_ ~
^- move
2015-08-20 01:40:03 +03:00
:* ost %poke
2015-08-20 22:40:21 +03:00
/sending/(scot %uv id)/(scot %ud version)
2015-08-20 01:40:03 +03:00
[our %talk]
%talk-command
2015-08-20 03:36:40 +03:00
^- command:talk
2015-08-20 01:40:03 +03:00
:- %publish
|- ^- (list thought)
:_ ~
:+ (shaf %task eny)
2015-08-20 21:03:10 +03:00
%- mo ^- (list ,[partner envelope delivery]:talk)
%+ turn (~(tap in audience))
|=(sat=station:talk [[%& sat] [*envelope %pending]])
2015-08-20 01:40:03 +03:00
[now *bouquet [%tax action]]
==
==
2015-08-21 00:00:18 +03:00
::
2015-08-20 22:04:52 +03:00
++ claim
%_ .
2015-08-21 00:00:18 +03:00
eny (sham eny %direct)
claiming &
2015-08-20 22:04:52 +03:00
moves
:_ ~
^- move
:* ost %poke
2015-08-20 22:40:21 +03:00
/claiming/(scot %uv id)
2015-08-20 22:04:52 +03:00
[our %talk]
%talk-command
^- command:talk
:- %publish
|- ^- (list thought)
:_ ~
:+ (shaf %task eny)
[[[%& owner (main owner)] [*envelope %pending]] ~ ~]
[now *bouquet [%tax %claim id]]
==
==
2015-08-21 00:00:18 +03:00
::
2015-08-21 01:03:09 +03:00
++ create %+ send %create
tax(date-created now, version 0, date-modified now)
2015-08-21 01:57:13 +03:00
++ send-update |*(* (send %update id +<))
++ release |=([vers=@u her=@p] (send-update vers %release her))
++ accept |=(vers=@u (send-update vers %accept ~))
2015-08-20 03:36:40 +03:00
++ process-update
2015-08-21 01:57:13 +03:00
|= [vers=@u up=update]
2015-08-20 03:36:40 +03:00
^+ +>
?- -.up
2015-08-21 01:57:13 +03:00
%add ?>(?=(%comment +<.up) (send-update vers %add-comment +>.up))
2015-08-20 03:36:40 +03:00
%own
?- +<.up
2015-08-21 01:57:13 +03:00
%announce (send-update vers %announce ~)
2015-08-20 03:36:40 +03:00
%claim claim
==
%set
?- +<.up
2015-08-21 01:57:13 +03:00
%date-due (send-update vers %set-date-due +>.up)
%title (send-update vers %set-title +>.up)
%description (send-update vers %set-description +>.up)
%tags (send-update vers %set-tags +>.up)
%done (send-update vers %set-done +>.up)
%audience ~|(%not-implemented !!)
2015-08-20 03:36:40 +03:00
==
==
2015-08-20 01:40:03 +03:00
--
::
++ initialize
^- [(list move) _.]
2015-08-20 04:37:09 +03:00
:_ .(connected %&) :_ ~
[ost %peer /peering [our %talk] /f/(main our)/0]
2015-08-20 01:40:03 +03:00
::
++ process-duty
2015-08-20 03:36:40 +03:00
|= [when=@da her=ship from=(set station:talk) action=duty:work-stuff:talk]
2015-08-20 01:40:03 +03:00
^- [(list move) _+>.$]
2015-08-20 22:04:52 +03:00
=- =^ mof con mirror-to-web:con
[(welp mos mof) con]
^- [mos=(list move) con=_+>.$]
2015-08-20 01:40:03 +03:00
?- -.action
2015-08-20 22:04:52 +03:00
%create :: XX should verify ownership
=+ existing-task=(~(get by tasks) id.tax.action)
2015-08-20 03:36:40 +03:00
~? ?& ?=(^ existing-task)
!=(tax.action task.u.existing-task)
2015-08-20 03:36:40 +03:00
==
:* %new-task-with-old-id
2015-08-20 01:40:03 +03:00
her=her
from=from
new-task=tax.action
2015-08-20 01:40:03 +03:00
existing-task=u.existing-task
==
?. |(=(her owner.tax.action) =(%released status.tax.action))
~& :* %created-with-bad-owner
her=her
from=from
new-task=tax.action
2015-08-21 00:00:18 +03:00
existing-task=existing-task
==
[~ +>.$]
2015-08-21 01:57:13 +03:00
?. =(0 version.tax.action)
~& :* %new-task-version-not-zero
her=her
from=from
new-task=tax.action
existing-task=existing-task
==
[~ +>.$]
2015-08-20 01:40:03 +03:00
=. tasks
2015-08-21 00:15:02 +03:00
%^ ~(put by tasks) id.tax.action |
:_ tax.action
2015-08-20 01:40:03 +03:00
?~ existing-task from
(~(uni in audience.u.existing-task) from)
2015-08-21 00:00:18 +03:00
=. sort ?^(existing-task sort [id.tax.action sort])
2015-08-20 22:04:52 +03:00
[~ +>.$]
::
%claim
=+ tax=(~(got by tasks) id.action)
2015-08-21 00:00:18 +03:00
?. &(=(our owner.task.tax) =(%announced status.task.tax))
~& :* %bad-claim
her=her
from=from
task=tax
==
[~ +>.$]
2015-08-21 01:57:13 +03:00
abet:(release:(at (~(got by tasks) id.action)) +(version.task.tax) her)
2015-08-20 01:40:03 +03:00
::
%update
=+ tax=(~(get by tasks) id.action)
?~ tax
2015-08-20 03:36:40 +03:00
~& :* %update-for-nonexistent-task
2015-08-20 01:40:03 +03:00
her=her
from=from
action=action
==
2015-08-20 22:04:52 +03:00
[~ +>.$]
2015-08-20 03:36:40 +03:00
?. =(version.action +(version.task.u.tax))
~& :* %update-bad-version
2015-08-20 01:40:03 +03:00
her
from=from
action=action
tax=tax
==
2015-08-20 22:04:52 +03:00
[~ +>.$]
2015-08-20 01:40:03 +03:00
=. tasks
%^ ~(put by tasks) id.action
2015-08-21 00:15:02 +03:00
?: ?=(%release -.meat.action)
|
claiming.u.tax
2015-08-20 22:53:35 +03:00
:- (~(uni in audience.u.tax) from)
2015-08-21 00:15:02 +03:00
?: ?& ?=(?(%announce %release %accept) -.meat.action)
!=(her owner.task.u.tax)
==
~& :* %not-owner
her=her
from=from
action=action
tax=tax
==
task.u.tax
2015-08-21 01:57:13 +03:00
=. version.task.u.tax version.action
2015-08-21 01:03:09 +03:00
=. date-modified.task.u.tax when
2015-08-21 00:15:02 +03:00
?- -.meat.action
%announce task.u.tax(status %announced)
%release task.u.tax(owner her.meat.action, status %released)
%accept task.u.tax(status %accepted)
%set-date-due task.u.tax(date-due wen.meat.action)
%set-tags task.u.tax(tags tag.meat.action)
%set-title task.u.tax(title til.meat.action)
%set-description task.u.tax(description des.meat.action)
%set-done task.u.tax(done ?.(don.meat.action ~ `when))
%add-comment
%= task.u.tax
discussion [[when her com.meat.action] discussion.task.u.tax]
==
==
2015-08-21 00:00:18 +03:00
?: ?& =([%release our] meat.action)
claiming.u.tax
==
2015-08-21 01:57:13 +03:00
abet:(accept:(at (~(got by tasks) id.action)) +(+(version.task.u.tax)))
2015-08-20 22:04:52 +03:00
[~ +>.$]
2015-08-20 01:40:03 +03:00
==
::
++ mirror-to-web
^- [(list move) _.]
2015-08-20 04:37:09 +03:00
~& [%mirroring tasks=tasks sort=sort]
2015-08-20 01:40:03 +03:00
:_ .
2015-08-20 04:37:09 +03:00
%+ murn (~(tap by sup))
|= [ust=bone her=ship pax=path]
^- (unit move)
2015-08-21 03:03:19 +03:00
?:(?=([%sole *] pax) ~ `[ust full-report])
2015-08-20 04:37:09 +03:00
::
2015-08-21 01:49:21 +03:00
++ full-report [%diff %work-report tasks sort]
++ peer-repo |=(path [[ost full-report]~ +>.$])
2015-08-20 04:37:09 +03:00
++ coup
|= [way=wire saw=(unit tang)]
^- [(list move) _+>.$]
?> ?=(~ saw)
[~ +>.$]
2015-08-20 01:40:03 +03:00
::
++ reap-peering
|= [way=wire saw=(unit tang)]
^- [(list move) _+>.$]
?> ?=([~ ~] +<)
[~ +>.$]
::
2015-08-20 03:36:40 +03:00
++ poke-work-command
|= cod=command
2015-08-21 02:12:06 +03:00
?. =(our src)
~|([%wrong-user our=our src=src] !!)
2015-08-20 03:36:40 +03:00
=^ mos +>.$
?: connected
[~ +>.$]
initialize
=^ mof +>.$
?- -.cod
2015-08-21 00:15:02 +03:00
%new abut:create:(at [| - +]:+.cod)
2015-08-21 01:57:13 +03:00
%old =+ (at (~(got by tasks) id.cod))
abet:(process-update:- version.cod dif.cod)
2015-08-21 02:12:06 +03:00
%sort mirror-to-web(sort p.cod)
2015-08-20 03:36:40 +03:00
==
[(welp mos mof) +>.$]
::
2015-08-20 01:40:03 +03:00
:: XX maybe need to check that we haven't received this message before
:: by keeping a counter of last message received
2015-08-20 04:37:09 +03:00
++ diff-talk-report
|= [way=wire rep=report:talk]
2015-08-20 01:40:03 +03:00
^- [(list move) _+>.$]
?> ?=(%grams -.rep)
|- ^- [(list move) _+>.^$]
?~ q.rep [~ +>.^$]
=* her p.i.q.rep
=* when p.r.q.i.q.rep
=* said r.r.q.i.q.rep
2015-08-20 03:36:40 +03:00
=+ ^- from=(set station:talk)
%- sa ^- (list station:talk)
2015-08-20 01:40:03 +03:00
%+ murn (~(tap by q.q.i.q.rep))
2015-08-20 03:36:40 +03:00
|= [par=partner *]
`(unit station:talk)`?.(?=(%& -.par) ~ `p.par)
2015-08-20 01:40:03 +03:00
?. ?=(%tax -.said)
$(p.rep +(p.rep), q.rep t.q.rep)
2015-08-20 03:36:40 +03:00
=^ mos +>.^$ (process-duty when her from +.said)
2015-08-20 01:40:03 +03:00
=^ mof +>.^$ $(p.rep +(p.rep), q.rep t.q.rep)
[(weld mos mof) +>.^$]
--