1transfer::copy::queue(n)   Data transfer facilities   transfer::copy::queue(n)
2
3
4
5______________________________________________________________________________
6

NAME

8       transfer::copy::queue - Queued transfers
9

SYNOPSIS

11       package require Tcl  8.4
12
13       package require snit  ?1.0?
14
15       package require struct::queue  ?1.4?
16
17       package require transfer::copy  ?0.1?
18
19       package require transfer::copy::queue  ?0.1?
20
21       transfer::copy::queue object outchannel ?options...?
22
23       object destroy
24
25       object busy
26
27       object pending
28
29       object put request
30
31_________________________________________________________________
32

DESCRIPTION

34       This  package  provides objects which serialize transfer requests for a
35       single channel by means of a fifo queue. Accumulating requests are exe‐
36       cuted  in  order  of  entrance, with the first request reaching an idle
37       object starting the execution in general. New  requests  can  be  added
38       while  the  object is active and are defered until all requests entered
39       before them have been completed successfully.
40
41       When a request causes a transfer error execution stops and all requests
42       coming after it are not served. Currently this means that their comple‐
43       tion callbacks are never triggered at all.
44
45       NOTE: Not triggering the completion callbacks of the unserved  requests
46       after  an error stops the queue object is something I am not fully sure
47       that it makes sense. It forces the user of the queue  to  remember  the
48       callbacks  as  well  and  run them. Because otherwise everything in the
49       system which depends on getting a notification about the  status  of  a
50       request  will hang in the air. I am slowly convincing myself that it is
51       more sensible to trigger the  relevant  completion  callbacks  with  an
52       error message about the queue abort, and 0 bytes transfered.
53
54       All transfer requests are of the form
55
56            {type data options...}
57
58
59       where  type is in {chan, string}, and data specifies the information to
60       transfer.  For chan the data is the handle of  the  channel  containing
61       the  actual  information  to transfer, whereas for string data contains
62       directly the information to transfer.  The options are a list  of  them
63       and  their  values,  and  are the same as are accepted by the low-level
64       copy operations of the package transfer::copy.  Note how just  prepend‐
65       ing  the request with transfer::copy::do and inserting a channel handle
66       in between data and options easily  transforms  it  from  a  pure  data
67       structure into a command whose evaluation will perform the request.
68

API

70       transfer::copy::queue object outchannel ?options...?
71              This  command  creates  a new queue object for the management of
72              the channel outchannel. The fully qualified name of  the  object
73              command is returned as the result of the command.
74
75              The  only  option known is -on-status-change. It is optional and
76              defaults to empty, disabling the reporting  of  status  changes.
77              Otherwise  it  argument is command prefix which is invoked when‐
78              ever the internal status of the object changed. The callback  is
79              invoked with two additional arguments, the result of the methods
80              pending and busy, in this order. This allows any user to  easily
81              know, for example, when the object has processed all outstanding
82              requests.
83
84       object destroy
85              This method destroys the object. Doing so while  the  object  is
86              busy  will  cause  errors  later on, when the currently executed
87              request completes and tries  to  access  the  now  missing  data
88              structures of the destroyed object.
89
90       object busy
91              This  method returns a boolean value telling us if the object is
92              currently serving a request (i.e.  busy,  value  True),  or  not
93              (i.e. idle, value False).
94
95       object pending
96              This  method returns the number of requests currently waiting in
97              the queue for their execution. A request currently served is not
98              counted as waiting.
99
100       object put request
101              This  method enters the transfer request into the object's queue
102              of waiting requests.  If the object is idle it will become busy,
103              immediately  servicing  the request. Otherwise servicing the new
104              request will be defered until all preceding requests  have  been
105              served.
106

USE

108       A  possible  application of this package and class is within a HTTP 1.1
109       server, managing the results waiting for transfer to the client.
110
111       It should be noted that in this application the system  also  needs  an
112       additional  data  structure which keeps track of outstanding results as
113       they may come back in a different order  than  the  requests  from  the
114       client, and releases them to the actual queue in the proper order.
115

BUGS, IDEAS, FEEDBACK

117       This  document,  and the package it describes, will undoubtedly contain
118       bugs and other problems.  Please report such in the  category  transfer
119       of       the       Tcllib       SF       Trackers       [http://source
120       forge.net/tracker/?group_id=12883].  Please also report any  ideas  for
121       enhancements you may have for either package and/or documentation.
122

KEYWORDS

124       channel, copy, queue, transfer
125
127       Copyright (c) 2006 Andreas Kupries <andreas_kupries@users.sourceforge.net>
128
129
130
131
132transfer                              0.1             transfer::copy::queue(n)
Impressum