Dobby 3.0
Dobby “Docker based Thingy” is a tool for managing and running OCI containers using crun
Loading...
Searching...
No Matches
AnonymousFile.h
1/*
2* If not stated otherwise in this file or this component's LICENSE file the
3* following copyright and licenses apply:
4*
5* Copyright 2021 Sky UK
6*
7* Licensed under the Apache License, Version 2.0 (the "License");
8* you may not use this file except in compliance with the License.
9* You may obtain a copy of the License at
10*
11* http://www.apache.org/licenses/LICENSE-2.0
12*
13* Unless required by applicable law or agreed to in writing, software
14* distributed under the License is distributed on an "AS IS" BASIS,
15* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16* See the License for the specific language governing permissions and
17* limitations under the License.
18*/
19/*
20 * File: AnonymousFile.h
21 *
22 */
23#ifndef ANONYMOUSFILE_H
24#define ANONYMOUSFILE_H
25
26#include <string>
27
29{
30public:
31 explicit AnonymousFile(int fd = -1);
32
33public:
34 int create();
35 bool copyContentTo(const std::string& destFile);
36
37private:
38 long getFileSize(FILE* fp);
39
40private:
41 int mFd;
42};
43
44#endif // !defined(ANONYMOUSFILE_H)
Definition AnonymousFile.h:29
int create()
Creates a volatile file that lives in RAM.
Definition AnonymousFile.cpp:81
bool copyContentTo(const std::string &destFile)
Copies content of volatile file from RAM to a disk.
Definition AnonymousFile.cpp:111
long getFileSize(FILE *fp)
Calculates file size for provided file pointer.
Definition AnonymousFile.cpp:200