summary refs log blame commit diff stats
path: root/doc/pydoc/ranger.ext.accumulator.html
blob: 7a1a2304bc6b13830a5e1c1c3a7034a2e64563ce (plain) (tree)


























































                                                                                                                                                                                                                                                  
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><title>Python: module ranger.ext.accumulator</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head><body bgcolor="#f0f0f8">

<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading">
<tr bgcolor="#7799ee">
<td valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial">&nbsp;<br><big><big><strong><a href="ranger.html"><font color="#ffffff">ranger</font></a>.<a href="ranger.ext.html"><font color="#ffffff">ext</font></a>.accumulator</strong></big></big></font></td
><td align=right valign=bottom
><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="file:/home/hut/work/ranger/ranger/ext/accumulator.py">/home/hut/work/ranger/ranger/ext/accumulator.py</a></font></td></tr></table>
    <p></p>
<p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ee77aa">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Classes</strong></big></font></td></tr>
    
<tr><td bgcolor="#ee77aa"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%"><dl>
<dt><font face="helvetica, arial"><a href="builtins.html#object">builtins.object</a>
</font></dt><dd>
<dl>
<dt><font face="helvetica, arial"><a href="ranger.ext.accumulator.html#Accumulator">Accumulator</a>
</font></dt></dl>
</dd>
</dl>
 <p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#000000" face="helvetica, arial"><a name="Accumulator">class <strong>Accumulator</strong></a>(<a href="builtins.html#object">builtins.object</a>)</font></td></tr>
    
<tr><td bgcolor="#ffc8d8"><tt>&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%">Methods defined here:<br>
<dl><dt><a name="Accumulator-__init__"><strong>__init__</strong></a>(self)</dt></dl>

<dl><dt><a name="Accumulator-correct_pointer"><strong>correct_pointer</strong></a>(self)</dt></dl>

<dl><dt><a name="Accumulator-get_list"><strong>get_list</strong></a>(self)</dt><dd><tt>OVERRIDE&nbsp;THIS</tt></dd></dl>

<dl><dt><a name="Accumulator-move"><strong>move</strong></a>(self, relative<font color="#909090">=0</font>, absolute<font color="#909090">=None</font>)</dt></dl>

<dl><dt><a name="Accumulator-move_to_obj"><strong>move_to_obj</strong></a>(self, arg, attr<font color="#909090">=None</font>)</dt></dl>

<dl><dt><a name="Accumulator-pointer_is_synced"><strong>pointer_is_synced</strong></a>(self)</dt></dl>

<dl><dt><a name="Accumulator-sync_index"><strong>sync_index</strong></a>(self, **kw)</dt></dl>

<hr>
Data descriptors defined here:<br>
<dl><dt><strong>__dict__</strong></dt>
<dd><tt>dictionary&nbsp;for&nbsp;instance&nbsp;variables&nbsp;(if&nbsp;defined)</tt></dd>
</dl>
<dl><dt><strong>__weakref__</strong></dt>
<dd><tt>list&nbsp;of&nbsp;weak&nbsp;references&nbsp;to&nbsp;the&nbsp;object&nbsp;(if&nbsp;defined)</tt></dd>
</dl>
</td></tr></table></td></tr></table>
</body></html>
class="w"> = []func(io.Reader){cb} } } } } if !toFetch.Empty() { store.worker.PostAction(&types.FetchFullMessages{Uids: toFetch}, nil) } } func (store *MessageStore) FetchBodyPart( uid uint32, part int, cb func(io.Reader)) { store.worker.PostAction(&types.FetchMessageBodyPart{ Uid: uid, Part: part, }, func(resp types.WorkerMessage) { msg, ok := resp.(*types.MessageBodyPart) if !ok { return } cb(msg.Reader) }) } func merge(to *types.MessageInfo, from *types.MessageInfo) { if from.BodyStructure != nil { to.BodyStructure = from.BodyStructure } if from.Envelope != nil { to.Envelope = from.Envelope } if len(from.Flags) != 0 { to.Flags = from.Flags } if from.Size != 0 { to.Size = from.Size } var zero time.Time if from.InternalDate != zero { to.InternalDate = from.InternalDate } } func (store *MessageStore) Update(msg types.WorkerMessage) { store.Lock() update := false switch msg := msg.(type) { case *types.DirectoryInfo: store.DirInfo = *msg if store.DirInfo.Exists != len(store.Uids) { store.worker.PostAction(&types.FetchDirectoryContents{}, nil) } update = true case *types.DirectoryContents: newMap := make(map[uint32]*types.MessageInfo) for _, uid := range msg.Uids { if msg, ok := store.Messages[uid]; ok { newMap[uid] = msg } else { newMap[uid] = nil } } store.Messages = newMap store.Uids = msg.Uids update = true case *types.MessageInfo: if existing, ok := store.Messages[msg.Uid]; ok && existing != nil { merge(existing, msg) } else { store.Messages[msg.Uid] = msg } if _, ok := store.pendingHeaders[msg.Uid]; msg.Envelope != nil && ok { delete(store.pendingHeaders, msg.Uid) if cbs, ok := store.headerCallbacks[msg.Uid]; ok { for _, cb := range cbs { cb(msg) } } } update = true case *types.FullMessage: if _, ok := store.pendingBodies[msg.Uid]; ok { delete(store.pendingBodies, msg.Uid) if cbs, ok := store.bodyCallbacks[msg.Uid]; ok { for _, cb := range cbs { cb(msg.Reader) } } } case *types.MessagesDeleted: toDelete := make(map[uint32]interface{}) for _, uid := range msg.Uids { toDelete[uid] = nil delete(store.Messages, uid) if _, ok := store.Deleted[uid]; ok { delete(store.Deleted, uid) } } uids := make([]uint32, len(store.Uids)-len(msg.Uids)) j := 0 for i, uid := range store.Uids { if _, deleted := toDelete[uid]; !deleted { uids[j] = store.Uids[i] j += 1 } } store.Uids = uids update = true } store.Unlock() if update { store.update() } } func (store *MessageStore) OnUpdate(fn func(store *MessageStore)) { store.onUpdate = fn } func (store *MessageStore) update() { if store.onUpdate != nil { store.onUpdate(store) } } func (store *MessageStore) Delete(uids []uint32) { store.Lock() var set imap.SeqSet for _, uid := range uids { set.AddNum(uid) store.Deleted[uid] = nil } store.Unlock() store.worker.PostAction(&types.DeleteMessages{Uids: set}, nil) store.update() }