Skip to content

Expose live upload activity for shared files over EC (speed, active peers, last-active time) #466

Description

@ngosang

Summary

The Web UI Shared Files page can only show the static counters the core already
exposes for a CKnownFile (transferred, requests, accepts, complete sources,
priority). Unlike the Downloads page, there is no way to see a shared file's
live upload activity: whether it is currently being uploaded, how fast, to
how many peers, or when it was last active.

This issue asks the core/EC layer to expose per-file upload activity for shared
files, so clients (Web UI, and later the desktop GUI) can add the corresponding
columns. Requests are grouped by implementation cost.

Motivation

Downloads already surface rich live state over EC (EC_TAG_PARTFILE_SPEED,
source counts, last_seen_complete, last_changed, active time). Shared files
have no equivalent, so a user cannot tell an actively-seeded file from an idle
one, or spot which shares are actually getting upload traffic. The underlying
data mostly already lives in the core objects (CFileStatistic,
m_ClientUploadList, CUpDownClient::GetUploadDatarate()); it is just not
summarized per-file or carried on the KNOWNFILE EC tags.

Current state

  • Known-file EC tags: EC_TAG_KNOWNFILE_*, src/libs/ec/cpp/ECCodes.h:221-242.
    The set carries transferred (session/all), requests (session/all), accepts
    (session/all), AICH master hash, priority, complete-sources (+low/high),
    ON_QUEUE, comment, rating, media — but no upload speed and no
    active-uploader breakdown
    .
  • Serializer: CEC_SharedFile_Tag, src/ECSpecialCoreTags.cpp:234-296 (base
    ctor shared with downloads). CEC_PartFile_Tag adds the download-only
    live-state tags (EC_TAG_PARTFILE_SPEED, source counts, last-seen).
  • Core data that already exists but is not summarized per file:
    CKnownFile::m_ClientUploadList (set of clients uploading-to / queued-on the
    file), CKnownFile::GetQueuedCount(), CUpDownClient::GetUploadDatarate()
    (src/updownclient.h), CFileStatistic (src/KnownFile.h:60-87).
  • Web API mapping: MergeSharedTag() in src/webapi/Refresher.cpp
    FileSnapshot::SharedSide in src/webapi/State.h:199-222.

Requested fields

Tier 1 — data exists in core, needs a new getter + new EC tag

  1. Current upload speed (per file) — sum of GetUploadDatarate() over the
    clients in CKnownFile::m_ClientUploadList. Analogous to
    EC_TAG_PARTFILE_SPEED. Enables a "Speed" column and an is-it-uploading
    indicator.
  2. Peers uploading now — count of clients in m_ClientUploadList whose
    GetUploadState() == US_UPLOADING. Together with (1) this gives an
    upload-status signal ("uploading" vs "idle").
  3. On-queue vs uploading split — today only the combined queue size is
    exposed (EC_TAG_KNOWNFILE_ON_QUEUE). Splitting "uploading now" from "waiting
    on queue" lets clients show uploading / queued the way Downloads show
    transferring / total sources.

Tier 2 — not currently tracked, needs a new persisted field

  1. Last upload activity — timestamp of the last time data was sent for this
    file (or last request served). Note: CKnownFile::GetLastSeen() is
    "last on-disk match", not upload activity, so it is not a substitute.
  2. Completed / shared-since timestamp — when the file finished downloading
    (or was added to shares). Lets clients show how long a file has been
    available.

Already available (no backend work — noted for completeness)

The following are already on the KNOWNFILE EC tags and can be surfaced by
clients without any core change; listed only so they are not duplicated as
requests: queued-client count (ON_QUEUE), share ratio (transferred / size),
and the complete-sources range (COMPLETE_SOURCES_LOW/HIGH).

Notes

  • Tier 1 mirrors what already exists for part files, so it should be a contained
    change (new CKnownFile accessors + tags in CEC_SharedFile_Tag, decoded in
    src/webapi/Refresher.cpp).
  • Tier 2 is heavier (new persisted state) and can be deferred; splitting it into
    a follow-up is fine.
  • A companion idea proposes consuming these same fields in the desktop aMule and
    amulegui shared-files view; it depends on this issue landing first.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions