aboutsummaryrefslogtreecommitdiff
path: root/mod/mod-repository-root.hxx
blob: 31fde9bf248730ed99c791d3478f90b9e73d89ab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
// file      : mod/mod-repository-root.hxx -*- C++ -*-
// license   : MIT; see accompanying LICENSE file

#ifndef MOD_MOD_REPOSITORY_ROOT_HXX
#define MOD_MOD_REPOSITORY_ROOT_HXX

#include <libbrep/types.hxx>
#include <libbrep/utility.hxx>

#include <mod/module.hxx>
#include <mod/module-options.hxx>
#include <mod/tenant-service.hxx>

namespace brep
{
  class packages;
  class package_details;
  class package_version_details;
  class repository_details;
  class build_task;
  class build_result;
  class build_force;
  class build_log;
  class builds;
  class build_configs;
  class submit;
  class ci;
  class ci_cancel;
  class ci_github;
  class upload;

  class repository_root: public handler
  {
  public:
    repository_root ();

    // Copy constructible-only type.
    //
    // Create a shallow copy (handling instance) if initialized and a deep
    // copy (context exemplar) otherwise.
    //
    explicit
    repository_root (const repository_root&);

  private:
    virtual bool
    handle (request&, response&);

    virtual const cli::options&
    cli_options () const {return options::repository_root::description ();}

    virtual option_descriptions
    options ();

    virtual void
    init (const name_values&);

    virtual void
    init (cli::scanner&);

    virtual void
    version ();

  private:
    shared_ptr<tenant_service_map> tenant_service_map_;

    shared_ptr<packages> packages_;
    shared_ptr<package_details> package_details_;
    shared_ptr<package_version_details> package_version_details_;
    shared_ptr<repository_details> repository_details_;
    shared_ptr<build_task> build_task_;
    shared_ptr<build_result> build_result_;
    shared_ptr<build_force> build_force_;
    shared_ptr<build_log> build_log_;
    shared_ptr<builds> builds_;
    shared_ptr<build_configs> build_configs_;
    shared_ptr<submit> submit_;
    shared_ptr<ci> ci_;
    shared_ptr<ci_cancel> ci_cancel_;
    shared_ptr<ci_github> ci_github_;
    shared_ptr<upload> upload_;

    shared_ptr<options::repository_root> options_;

    // Sub-handler the request is dispatched to. Initially is NULL. It is set
    // by the first call to handle() to a deep copy of the selected exemplar.
    // The subsequent calls of handle() (that may take place after the retry
    // exception is thrown) will use the existing handler instance.
    //
    unique_ptr<handler> handler_;
  };
}

#endif // MOD_MOD_REPOSITORY_ROOT_HXX