Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions include/ts/ts.h
Original file line number Diff line number Diff line change
Expand Up @@ -2485,6 +2485,7 @@ tsapi TSReturnCode TSHttpTxnCacheLookupStatusSet(TSHttpTxn txnp, int cachelookup
tsapi TSReturnCode TSHttpTxnCacheLookupUrlGet(TSHttpTxn txnp, TSMBuffer bufp, TSMLoc obj);
tsapi TSReturnCode TSHttpTxnCacheLookupUrlSet(TSHttpTxn txnp, TSMBuffer bufp, TSMLoc obj);
tsapi TSReturnCode TSHttpTxnPrivateSessionSet(TSHttpTxn txnp, int private_session);
tsapi const char *TSHttpTxnCacheDiskPathGet(TSHttpTxn txnp, int *length);
tsapi int TSHttpTxnBackgroundFillStarted(TSHttpTxn txnp);
tsapi int TSHttpTxnIsWebsocket(TSHttpTxn txnp);

Expand Down
6 changes: 6 additions & 0 deletions iocore/cache/I_Cache.h
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,12 @@ struct CacheVConnection : public VConnection {
return -1;
}

virtual const char *
get_disk_path() const
{
return nullptr;
}

/** Test if the VC can support pread.
@return @c true if @c do_io_pread will work, @c false if not.
*/
Expand Down
10 changes: 10 additions & 0 deletions iocore/cache/P_CacheInternal.h
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,16 @@ struct CacheVC : public CacheVConnection {
return -1;
}

const char *
get_disk_path() const override
{
if (vol && vol->disk) {
return vol->disk->path;
}

return nullptr;
}

bool
is_compressed_in_ram() const override
{
Expand Down
12 changes: 12 additions & 0 deletions proxy/http/HttpCacheSM.h
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,18 @@ class HttpCacheSM : public Continuation
return cache_read_vc ? (cache_read_vc->get_volume_number()) : -1;
}

const char *
get_disk_path()
{
if (cache_read_vc) {
return cache_read_vc->get_disk_path();
} else if (cache_write_vc) {
return cache_write_vc->get_disk_path();
}

return nullptr;
}

inline void
abort_read()
{
Expand Down
29 changes: 29 additions & 0 deletions src/traffic_server/InkAPI.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5489,6 +5489,35 @@ TSHttpTxnIsWebsocket(TSHttpTxn txnp)
return sm->t_state.is_websocket;
}

const char *
TSHttpTxnCacheDiskPathGet(TSHttpTxn txnp, int *length)
{
sdk_assert(sdk_sanity_check_txn(txnp) == TS_SUCCESS);

HttpSM *s = reinterpret_cast<HttpSM *>(txnp);
HttpCacheSM *c_sm = &(s->get_cache_sm());

if (!c_sm) {
if (length != nullptr) {
*length = 0;
}

return nullptr;
}

const char *path = c_sm->get_disk_path();

if (length != nullptr) {
if (path != nullptr) {
*length = strlen(path);
} else {
*length = 0;
}
}

return path;
}

TSReturnCode
TSHttpTxnCacheLookupUrlGet(TSHttpTxn txnp, TSMBuffer bufp, TSMLoc obj)
{
Expand Down