Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Lightweight Bartering Grid
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## lbg.peer.register.learning.consumption
Class PeerConsumptionDataTracker

    java.lang.Object
      lbg.peer.register.learning.consumption.PeerConsumptionDataTracker

All Implemented Interfaces:
  ConsumptionDataTracker

Direct Known Subclasses:
  JobConsumptionDataTracker

    public class PeerConsumptionDataTracker

extends java.lang.Object
implements ConsumptionDataTracker

A PeerConsumptionDataTracker tracks the data that are known to have been donwloaded by Supplier Peers for recent Consumption Tasks.

The tracked data were required by successfully completed Consumption Tasks.

To each data id is associated the set of Supplier Peers which have downloaded the data.

The tracked data can be searched to locate, and rank Peers that may still have some Resources holding the data in their data cache.

Author:
  Cyril Briquet

Constructor Summary
`PeerConsumptionDataTracker(int capacity)`

Method Summary
`int` | `countTrackedData()` Returns the number of tracked data.
`java.util.Map<java.lang.Long,java.util.Set<java.lang.String>>` | `rankPeers(Task t)` Return data-aware ranking of Supplier Peers, sorted by decreasing Storage Affinity, where input data of target Task may be present.
`java.lang.String` | `toString()`
`void` | `trackData(java.lang.String supplier_peer, Task t)` Tracks target data, i.e.
`java.util.Iterator<java.lang.String>` | `trackedSuppliers(java.lang.String data_id)` Returns an Iterator of the suppliers that presumably store target tracked data, i.e.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### PeerConsumptionDataTracker

    public PeerConsumptionDataTracker(int capacity)
                               throws GridException

Throws:
  `GridException`

Method Detail

### toString

    public java.lang.String toString()

  Overrides:
    `toString` in class `java.lang.Object`

### trackData

    public void trackData(java.lang.String supplier_peer,
                          Task t)
                   throws GridException

  Tracks target data, i.e. stores the fact that target Task data have been completyly downloaded by target Supplier Peer.

  Specified by:
    `trackData` in interface `ConsumptionDataTracker`
  Parameters:
    `supplier_peer` - target Supplier Peer
    `t` - target Task
  Throws:
    `GridException` - if a parameter is illegal

### rankPeers

    public java.util.Map<java.lang.Long,java.util.Set<java.lang.String>> rankPeers(Task t)
                                                                            throws GridException

  Return data-aware ranking of Supplier Peers, sorted by decreasing Storage Affinity, where input data of target Task may be present.

  Note that Peers with no Storage Affinity are not ranked.

  Note that input data of target Task may have been ejected from the data caches of the Suppliers Resources that once held it.

  Specified by:
    `rankPeers` in interface `ConsumptionDataTracker`
  Parameters:
    `t` - target Task
  Returns:
    data-aware ranking of Suppliers, which is a mapping of bytes count to be downloaded to Supplier Peers, sorted by decreasing Storage Affinity (i.e. best first, by increasing bytes count to be downloaded)
  Throws:
    `GridException` - if a parameter is illegal

### countTrackedData

    public int countTrackedData()

  Returns the number of tracked data.

  Specified by:
    `countTrackedData` in interface `ConsumptionDataTracker`
  Returns:
    tracked data count

### trackedSuppliers

    public java.util.Iterator<java.lang.String> trackedSuppliers(java.lang.String data_id)
                                                          throws GridException

  Returns an Iterator of the suppliers that presumably store target tracked data, i.e. tracked suppliers for target track data.

  Specified by:
    `trackedSuppliers` in interface `ConsumptionDataTracker`
  Parameters:
    `data_id` - tracked data id
  Returns:
    tracked Suppliers for target tracked data, or null if data is not tracked
  Throws:
    `GridException`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Lightweight Bartering Grid
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

> Copyright (c) 2005-2008, Cyril Briquet, parts Xavier Dalem.