Android-cuttlefish cvd tool
Classes | Typedefs | Enumerations | Functions
file_sync_client.cpp File Reference
#include "client/file_sync_client.h"
#include <dirent.h>
#include <inttypes.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <sys/types.h>
#include <time.h>
#include <unistd.h>
#include <utime.h>
#include <chrono>
#include <deque>
#include <functional>
#include <memory>
#include <sstream>
#include <string>
#include <variant>
#include <vector>
#include "sysdeps.h"
#include "adb.h"
#include "adb_client.h"
#include "adb_io.h"
#include "adb_utils.h"
#include "compression_utils.h"
#include "file_sync_protocol.h"
#include "line_printer.h"
#include "sysdeps/errno.h"
#include "sysdeps/stat.h"
#include "client/commandline.h"
#include <android-base/file.h>
#include <android-base/strings.h>
#include <android-base/stringprintf.h>
Include dependency graph for file_sync_client.cpp:

Classes

struct  syncsendbuf
 
struct  copyinfo
 
struct  TransferLedger
 
class  SyncConnection
 

Typedefs

typedef void() sync_ls_cb(unsigned mode, uint64_t size, uint64_t time, const char *name)
 

Enumerations

enum class  TransferDirection { push , pull }
 

Functions

static void ensure_trailing_separators (std::string &local_path, std::string &remote_path)
 
static bool should_pull_file (mode_t mode)
 
static bool should_push_file (mode_t mode)
 
static bool sync_ls (SyncConnection &sc, const std::string &path, const std::function< sync_ls_cb > &func)
 
static bool sync_stat (SyncConnection &sc, const std::string &path, struct stat *st)
 
static bool sync_lstat (SyncConnection &sc, const std::string &path, struct stat *st)
 
static bool sync_stat_fallback (SyncConnection &sc, const std::string &path, struct stat *st)
 
static bool sync_send (SyncConnection &sc, const std::string &lpath, const std::string &rpath, unsigned mtime, mode_t mode, bool sync, CompressionType compression, bool dry_run)
 
static bool sync_recv_v1 (SyncConnection &sc, const char *rpath, const char *lpath, const char *name, uint64_t expected_size)
 
static bool sync_recv_v2 (SyncConnection &sc, const char *rpath, const char *lpath, const char *name, uint64_t expected_size, CompressionType compression)
 
static bool sync_recv (SyncConnection &sc, const char *rpath, const char *lpath, const char *name, uint64_t expected_size, CompressionType compression)
 
bool do_sync_ls (const char *path)
 
static bool IsDotOrDotDot (const char *name)
 
static bool local_build_list (SyncConnection &sc, std::vector< copyinfo > *file_list, std::vector< std::string > *directory_list, const std::string &lpath, const std::string &rpath)
 
static bool is_root_dir (std::string_view path)
 
static bool copy_local_dir_remote (SyncConnection &sc, std::string lpath, std::string rpath, bool check_timestamps, bool list_only, CompressionType compression, bool dry_run)
 
bool do_sync_push (const std::vector< const char * > &srcs, const char *dst, bool sync, CompressionType compression, bool dry_run, bool quiet)
 
static bool remote_build_list (SyncConnection &sc, std::vector< copyinfo > *file_list, const std::string &rpath, const std::string &lpath)
 
static int set_time_and_mode (const std::string &lpath, time_t time, unsigned int mode)
 
static bool copy_remote_dir_local (SyncConnection &sc, std::string rpath, std::string lpath, bool copy_attrs, CompressionType compression)
 
bool do_sync_pull (const std::vector< const char * > &srcs, const char *dst, bool copy_attrs, CompressionType compression, const char *name, bool quiet)
 
bool do_sync_sync (const std::string &lpath, const std::string &rpath, bool list_only, CompressionType compression, bool dry_run, bool quiet)
 

Typedef Documentation

◆ sync_ls_cb

typedef void() sync_ls_cb(unsigned mode, uint64_t size, uint64_t time, const char *name)

Enumeration Type Documentation

◆ TransferDirection

enum class TransferDirection
strong
Enumerator
push 
pull 

Function Documentation

◆ copy_local_dir_remote()

static bool copy_local_dir_remote ( SyncConnection sc,
std::string  lpath,
std::string  rpath,
bool  check_timestamps,
bool  list_only,
CompressionType  compression,
bool  dry_run 
)
static

◆ copy_remote_dir_local()

static bool copy_remote_dir_local ( SyncConnection sc,
std::string  rpath,
std::string  lpath,
bool  copy_attrs,
CompressionType  compression 
)
static

◆ do_sync_ls()

bool do_sync_ls ( const char *  path)

◆ do_sync_pull()

bool do_sync_pull ( const std::vector< const char * > &  srcs,
const char *  dst,
bool  copy_attrs,
CompressionType  compression,
const char *  name,
bool  quiet 
)

◆ do_sync_push()

bool do_sync_push ( const std::vector< const char * > &  srcs,
const char *  dst,
bool  sync,
CompressionType  compression,
bool  dry_run,
bool  quiet 
)

◆ do_sync_sync()

bool do_sync_sync ( const std::string &  lpath,
const std::string &  rpath,
bool  list_only,
CompressionType  compression,
bool  dry_run,
bool  quiet 
)

◆ ensure_trailing_separators()

static void ensure_trailing_separators ( std::string &  local_path,
std::string &  remote_path 
)
static

◆ is_root_dir()

static bool is_root_dir ( std::string_view  path)
static

◆ IsDotOrDotDot()

static bool IsDotOrDotDot ( const char *  name)
static

◆ local_build_list()

static bool local_build_list ( SyncConnection sc,
std::vector< copyinfo > *  file_list,
std::vector< std::string > *  directory_list,
const std::string &  lpath,
const std::string &  rpath 
)
static

◆ remote_build_list()

static bool remote_build_list ( SyncConnection sc,
std::vector< copyinfo > *  file_list,
const std::string &  rpath,
const std::string &  lpath 
)
static

◆ set_time_and_mode()

static int set_time_and_mode ( const std::string &  lpath,
time_t  time,
unsigned int  mode 
)
static

◆ should_pull_file()

static bool should_pull_file ( mode_t  mode)
static

◆ should_push_file()

static bool should_push_file ( mode_t  mode)
static

◆ sync_ls()

static bool sync_ls ( SyncConnection sc,
const std::string &  path,
const std::function< sync_ls_cb > &  func 
)
static

◆ sync_lstat()

static bool sync_lstat ( SyncConnection sc,
const std::string &  path,
struct stat *  st 
)
static

◆ sync_recv()

static bool sync_recv ( SyncConnection sc,
const char *  rpath,
const char *  lpath,
const char *  name,
uint64_t  expected_size,
CompressionType  compression 
)
static

◆ sync_recv_v1()

static bool sync_recv_v1 ( SyncConnection sc,
const char *  rpath,
const char *  lpath,
const char *  name,
uint64_t  expected_size 
)
static

◆ sync_recv_v2()

static bool sync_recv_v2 ( SyncConnection sc,
const char *  rpath,
const char *  lpath,
const char *  name,
uint64_t  expected_size,
CompressionType  compression 
)
static

◆ sync_send()

static bool sync_send ( SyncConnection sc,
const std::string &  lpath,
const std::string &  rpath,
unsigned  mtime,
mode_t  mode,
bool  sync,
CompressionType  compression,
bool  dry_run 
)
static

◆ sync_stat()

static bool sync_stat ( SyncConnection sc,
const std::string &  path,
struct stat *  st 
)
static

◆ sync_stat_fallback()

static bool sync_stat_fallback ( SyncConnection sc,
const std::string &  path,
struct stat *  st 
)
static