2024-07-01 18:12:34 +03:00
|
|
|
#pragma once
|
|
|
|
#include "fs-sink.hh"
|
|
|
|
|
|
|
|
namespace nix::test {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* A `FileSystemObjectSink` that traces calls, writing to stderr.
|
|
|
|
*/
|
|
|
|
class TracingFileSystemObjectSink : public virtual FileSystemObjectSink
|
|
|
|
{
|
|
|
|
FileSystemObjectSink & sink;
|
|
|
|
public:
|
|
|
|
TracingFileSystemObjectSink(FileSystemObjectSink & sink)
|
|
|
|
: sink(sink)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2024-07-11 13:14:48 +03:00
|
|
|
void createDirectory(const CanonPath & path) override;
|
2024-07-01 18:12:34 +03:00
|
|
|
|
2024-07-11 13:14:48 +03:00
|
|
|
void createRegularFile(const CanonPath & path, std::function<void(CreateRegularFileSink &)> fn) override;
|
2024-07-01 18:12:34 +03:00
|
|
|
|
2024-07-11 13:14:48 +03:00
|
|
|
void createSymlink(const CanonPath & path, const std::string & target) override;
|
2024-07-01 18:12:34 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* A `ExtendedFileSystemObjectSink` that traces calls, writing to stderr.
|
|
|
|
*/
|
|
|
|
class TracingExtendedFileSystemObjectSink : public TracingFileSystemObjectSink, public ExtendedFileSystemObjectSink
|
|
|
|
{
|
|
|
|
ExtendedFileSystemObjectSink & sink;
|
|
|
|
public:
|
|
|
|
TracingExtendedFileSystemObjectSink(ExtendedFileSystemObjectSink & sink)
|
|
|
|
: TracingFileSystemObjectSink(sink)
|
|
|
|
, sink(sink)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2024-07-11 13:14:48 +03:00
|
|
|
void createHardlink(const CanonPath & path, const CanonPath & target) override;
|
2024-07-01 18:12:34 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|