Compare commits
41 Commits
chart
...
1a061f2d1f
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1a061f2d1f | ||
|
|
de0b910e09 | ||
|
|
d865ee2766 | ||
|
|
9d246ad180 | ||
|
|
2797d97537 | ||
|
|
a09a04e1a7 | ||
|
|
3f610619b5 | ||
|
|
c309d97623 | ||
|
|
93903b4938 | ||
|
|
3c1a84011e | ||
|
|
f9bfafa004 | ||
|
|
f26249ab8b | ||
|
|
4ec32bafa7 | ||
|
|
e621fb616a | ||
|
|
aaef5334ce | ||
|
|
be976bd8ed | ||
|
|
5f735b6e9d | ||
|
|
f490dc3555 | ||
|
|
cdf513c2c4 | ||
|
|
eba6fd4f97 | ||
|
|
1582654a9c | ||
|
|
0ac55a0ec1 | ||
|
|
3d58416d9b | ||
|
|
279090889f | ||
|
|
8953e2cd42 | ||
|
|
a48bcf25e4 | ||
|
|
2df71c6571 | ||
|
|
89a1ab3f6e | ||
|
|
021b461b0a | ||
|
|
5c9adcf597 | ||
|
|
92bb274d03 | ||
|
|
95a4acff36 | ||
|
|
50ea0969e6 | ||
|
|
6acbcb6704 | ||
|
|
6c9b9ea30d | ||
|
|
a4374602e1 | ||
|
|
610eb0cfda | ||
|
|
4f798263b1 | ||
|
|
a0dd8e1c42 | ||
|
|
754925c32c | ||
|
|
4956166f76 |
660
LICENSE.md
Normal file
660
LICENSE.md
Normal file
@@ -0,0 +1,660 @@
|
|||||||
|
# GNU AFFERO GENERAL PUBLIC LICENSE
|
||||||
|
|
||||||
|
Version 3, 19 November 2007
|
||||||
|
|
||||||
|
Copyright (C) 2007 Free Software Foundation, Inc.
|
||||||
|
<https://fsf.org/>
|
||||||
|
|
||||||
|
Everyone is permitted to copy and distribute verbatim copies of this
|
||||||
|
license document, but changing it is not allowed.
|
||||||
|
|
||||||
|
## Preamble
|
||||||
|
|
||||||
|
The GNU Affero General Public License is a free, copyleft license for
|
||||||
|
software and other kinds of works, specifically designed to ensure
|
||||||
|
cooperation with the community in the case of network server software.
|
||||||
|
|
||||||
|
The licenses for most software and other practical works are designed
|
||||||
|
to take away your freedom to share and change the works. By contrast,
|
||||||
|
our General Public Licenses are intended to guarantee your freedom to
|
||||||
|
share and change all versions of a program--to make sure it remains
|
||||||
|
free software for all its users.
|
||||||
|
|
||||||
|
When we speak of free software, we are referring to freedom, not
|
||||||
|
price. Our General Public Licenses are designed to make sure that you
|
||||||
|
have the freedom to distribute copies of free software (and charge for
|
||||||
|
them if you wish), that you receive source code or can get it if you
|
||||||
|
want it, that you can change the software or use pieces of it in new
|
||||||
|
free programs, and that you know you can do these things.
|
||||||
|
|
||||||
|
Developers that use our General Public Licenses protect your rights
|
||||||
|
with two steps: (1) assert copyright on the software, and (2) offer
|
||||||
|
you this License which gives you legal permission to copy, distribute
|
||||||
|
and/or modify the software.
|
||||||
|
|
||||||
|
A secondary benefit of defending all users' freedom is that
|
||||||
|
improvements made in alternate versions of the program, if they
|
||||||
|
receive widespread use, become available for other developers to
|
||||||
|
incorporate. Many developers of free software are heartened and
|
||||||
|
encouraged by the resulting cooperation. However, in the case of
|
||||||
|
software used on network servers, this result may fail to come about.
|
||||||
|
The GNU General Public License permits making a modified version and
|
||||||
|
letting the public access it on a server without ever releasing its
|
||||||
|
source code to the public.
|
||||||
|
|
||||||
|
The GNU Affero General Public License is designed specifically to
|
||||||
|
ensure that, in such cases, the modified source code becomes available
|
||||||
|
to the community. It requires the operator of a network server to
|
||||||
|
provide the source code of the modified version running there to the
|
||||||
|
users of that server. Therefore, public use of a modified version, on
|
||||||
|
a publicly accessible server, gives the public access to the source
|
||||||
|
code of the modified version.
|
||||||
|
|
||||||
|
An older license, called the Affero General Public License and
|
||||||
|
published by Affero, was designed to accomplish similar goals. This is
|
||||||
|
a different license, not a version of the Affero GPL, but Affero has
|
||||||
|
released a new version of the Affero GPL which permits relicensing
|
||||||
|
under this license.
|
||||||
|
|
||||||
|
The precise terms and conditions for copying, distribution and
|
||||||
|
modification follow.
|
||||||
|
|
||||||
|
## TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
### 0. Definitions.
|
||||||
|
|
||||||
|
"This License" refers to version 3 of the GNU Affero General Public
|
||||||
|
License.
|
||||||
|
|
||||||
|
"Copyright" also means copyright-like laws that apply to other kinds
|
||||||
|
of works, such as semiconductor masks.
|
||||||
|
|
||||||
|
"The Program" refers to any copyrightable work licensed under this
|
||||||
|
License. Each licensee is addressed as "you". "Licensees" and
|
||||||
|
"recipients" may be individuals or organizations.
|
||||||
|
|
||||||
|
To "modify" a work means to copy from or adapt all or part of the work
|
||||||
|
in a fashion requiring copyright permission, other than the making of
|
||||||
|
an exact copy. The resulting work is called a "modified version" of
|
||||||
|
the earlier work or a work "based on" the earlier work.
|
||||||
|
|
||||||
|
A "covered work" means either the unmodified Program or a work based
|
||||||
|
on the Program.
|
||||||
|
|
||||||
|
To "propagate" a work means to do anything with it that, without
|
||||||
|
permission, would make you directly or secondarily liable for
|
||||||
|
infringement under applicable copyright law, except executing it on a
|
||||||
|
computer or modifying a private copy. Propagation includes copying,
|
||||||
|
distribution (with or without modification), making available to the
|
||||||
|
public, and in some countries other activities as well.
|
||||||
|
|
||||||
|
To "convey" a work means any kind of propagation that enables other
|
||||||
|
parties to make or receive copies. Mere interaction with a user
|
||||||
|
through a computer network, with no transfer of a copy, is not
|
||||||
|
conveying.
|
||||||
|
|
||||||
|
An interactive user interface displays "Appropriate Legal Notices" to
|
||||||
|
the extent that it includes a convenient and prominently visible
|
||||||
|
feature that (1) displays an appropriate copyright notice, and (2)
|
||||||
|
tells the user that there is no warranty for the work (except to the
|
||||||
|
extent that warranties are provided), that licensees may convey the
|
||||||
|
work under this License, and how to view a copy of this License. If
|
||||||
|
the interface presents a list of user commands or options, such as a
|
||||||
|
menu, a prominent item in the list meets this criterion.
|
||||||
|
|
||||||
|
### 1. Source Code.
|
||||||
|
|
||||||
|
The "source code" for a work means the preferred form of the work for
|
||||||
|
making modifications to it. "Object code" means any non-source form of
|
||||||
|
a work.
|
||||||
|
|
||||||
|
A "Standard Interface" means an interface that either is an official
|
||||||
|
standard defined by a recognized standards body, or, in the case of
|
||||||
|
interfaces specified for a particular programming language, one that
|
||||||
|
is widely used among developers working in that language.
|
||||||
|
|
||||||
|
The "System Libraries" of an executable work include anything, other
|
||||||
|
than the work as a whole, that (a) is included in the normal form of
|
||||||
|
packaging a Major Component, but which is not part of that Major
|
||||||
|
Component, and (b) serves only to enable use of the work with that
|
||||||
|
Major Component, or to implement a Standard Interface for which an
|
||||||
|
implementation is available to the public in source code form. A
|
||||||
|
"Major Component", in this context, means a major essential component
|
||||||
|
(kernel, window system, and so on) of the specific operating system
|
||||||
|
(if any) on which the executable work runs, or a compiler used to
|
||||||
|
produce the work, or an object code interpreter used to run it.
|
||||||
|
|
||||||
|
The "Corresponding Source" for a work in object code form means all
|
||||||
|
the source code needed to generate, install, and (for an executable
|
||||||
|
work) run the object code and to modify the work, including scripts to
|
||||||
|
control those activities. However, it does not include the work's
|
||||||
|
System Libraries, or general-purpose tools or generally available free
|
||||||
|
programs which are used unmodified in performing those activities but
|
||||||
|
which are not part of the work. For example, Corresponding Source
|
||||||
|
includes interface definition files associated with source files for
|
||||||
|
the work, and the source code for shared libraries and dynamically
|
||||||
|
linked subprograms that the work is specifically designed to require,
|
||||||
|
such as by intimate data communication or control flow between those
|
||||||
|
subprograms and other parts of the work.
|
||||||
|
|
||||||
|
The Corresponding Source need not include anything that users can
|
||||||
|
regenerate automatically from other parts of the Corresponding Source.
|
||||||
|
|
||||||
|
The Corresponding Source for a work in source code form is that same
|
||||||
|
work.
|
||||||
|
|
||||||
|
### 2. Basic Permissions.
|
||||||
|
|
||||||
|
All rights granted under this License are granted for the term of
|
||||||
|
copyright on the Program, and are irrevocable provided the stated
|
||||||
|
conditions are met. This License explicitly affirms your unlimited
|
||||||
|
permission to run the unmodified Program. The output from running a
|
||||||
|
covered work is covered by this License only if the output, given its
|
||||||
|
content, constitutes a covered work. This License acknowledges your
|
||||||
|
rights of fair use or other equivalent, as provided by copyright law.
|
||||||
|
|
||||||
|
You may make, run and propagate covered works that you do not convey,
|
||||||
|
without conditions so long as your license otherwise remains in force.
|
||||||
|
You may convey covered works to others for the sole purpose of having
|
||||||
|
them make modifications exclusively for you, or provide you with
|
||||||
|
facilities for running those works, provided that you comply with the
|
||||||
|
terms of this License in conveying all material for which you do not
|
||||||
|
control copyright. Those thus making or running the covered works for
|
||||||
|
you must do so exclusively on your behalf, under your direction and
|
||||||
|
control, on terms that prohibit them from making any copies of your
|
||||||
|
copyrighted material outside their relationship with you.
|
||||||
|
|
||||||
|
Conveying under any other circumstances is permitted solely under the
|
||||||
|
conditions stated below. Sublicensing is not allowed; section 10 makes
|
||||||
|
it unnecessary.
|
||||||
|
|
||||||
|
### 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||||
|
|
||||||
|
No covered work shall be deemed part of an effective technological
|
||||||
|
measure under any applicable law fulfilling obligations under article
|
||||||
|
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||||
|
similar laws prohibiting or restricting circumvention of such
|
||||||
|
measures.
|
||||||
|
|
||||||
|
When you convey a covered work, you waive any legal power to forbid
|
||||||
|
circumvention of technological measures to the extent such
|
||||||
|
circumvention is effected by exercising rights under this License with
|
||||||
|
respect to the covered work, and you disclaim any intention to limit
|
||||||
|
operation or modification of the work as a means of enforcing, against
|
||||||
|
the work's users, your or third parties' legal rights to forbid
|
||||||
|
circumvention of technological measures.
|
||||||
|
|
||||||
|
### 4. Conveying Verbatim Copies.
|
||||||
|
|
||||||
|
You may convey verbatim copies of the Program's source code as you
|
||||||
|
receive it, in any medium, provided that you conspicuously and
|
||||||
|
appropriately publish on each copy an appropriate copyright notice;
|
||||||
|
keep intact all notices stating that this License and any
|
||||||
|
non-permissive terms added in accord with section 7 apply to the code;
|
||||||
|
keep intact all notices of the absence of any warranty; and give all
|
||||||
|
recipients a copy of this License along with the Program.
|
||||||
|
|
||||||
|
You may charge any price or no price for each copy that you convey,
|
||||||
|
and you may offer support or warranty protection for a fee.
|
||||||
|
|
||||||
|
### 5. Conveying Modified Source Versions.
|
||||||
|
|
||||||
|
You may convey a work based on the Program, or the modifications to
|
||||||
|
produce it from the Program, in the form of source code under the
|
||||||
|
terms of section 4, provided that you also meet all of these
|
||||||
|
conditions:
|
||||||
|
|
||||||
|
- a) The work must carry prominent notices stating that you modified
|
||||||
|
it, and giving a relevant date.
|
||||||
|
- b) The work must carry prominent notices stating that it is
|
||||||
|
released under this License and any conditions added under
|
||||||
|
section 7. This requirement modifies the requirement in section 4
|
||||||
|
to "keep intact all notices".
|
||||||
|
- c) You must license the entire work, as a whole, under this
|
||||||
|
License to anyone who comes into possession of a copy. This
|
||||||
|
License will therefore apply, along with any applicable section 7
|
||||||
|
additional terms, to the whole of the work, and all its parts,
|
||||||
|
regardless of how they are packaged. This License gives no
|
||||||
|
permission to license the work in any other way, but it does not
|
||||||
|
invalidate such permission if you have separately received it.
|
||||||
|
- d) If the work has interactive user interfaces, each must display
|
||||||
|
Appropriate Legal Notices; however, if the Program has interactive
|
||||||
|
interfaces that do not display Appropriate Legal Notices, your
|
||||||
|
work need not make them do so.
|
||||||
|
|
||||||
|
A compilation of a covered work with other separate and independent
|
||||||
|
works, which are not by their nature extensions of the covered work,
|
||||||
|
and which are not combined with it such as to form a larger program,
|
||||||
|
in or on a volume of a storage or distribution medium, is called an
|
||||||
|
"aggregate" if the compilation and its resulting copyright are not
|
||||||
|
used to limit the access or legal rights of the compilation's users
|
||||||
|
beyond what the individual works permit. Inclusion of a covered work
|
||||||
|
in an aggregate does not cause this License to apply to the other
|
||||||
|
parts of the aggregate.
|
||||||
|
|
||||||
|
### 6. Conveying Non-Source Forms.
|
||||||
|
|
||||||
|
You may convey a covered work in object code form under the terms of
|
||||||
|
sections 4 and 5, provided that you also convey the machine-readable
|
||||||
|
Corresponding Source under the terms of this License, in one of these
|
||||||
|
ways:
|
||||||
|
|
||||||
|
- a) Convey the object code in, or embodied in, a physical product
|
||||||
|
(including a physical distribution medium), accompanied by the
|
||||||
|
Corresponding Source fixed on a durable physical medium
|
||||||
|
customarily used for software interchange.
|
||||||
|
- b) Convey the object code in, or embodied in, a physical product
|
||||||
|
(including a physical distribution medium), accompanied by a
|
||||||
|
written offer, valid for at least three years and valid for as
|
||||||
|
long as you offer spare parts or customer support for that product
|
||||||
|
model, to give anyone who possesses the object code either (1) a
|
||||||
|
copy of the Corresponding Source for all the software in the
|
||||||
|
product that is covered by this License, on a durable physical
|
||||||
|
medium customarily used for software interchange, for a price no
|
||||||
|
more than your reasonable cost of physically performing this
|
||||||
|
conveying of source, or (2) access to copy the Corresponding
|
||||||
|
Source from a network server at no charge.
|
||||||
|
- c) Convey individual copies of the object code with a copy of the
|
||||||
|
written offer to provide the Corresponding Source. This
|
||||||
|
alternative is allowed only occasionally and noncommercially, and
|
||||||
|
only if you received the object code with such an offer, in accord
|
||||||
|
with subsection 6b.
|
||||||
|
- d) Convey the object code by offering access from a designated
|
||||||
|
place (gratis or for a charge), and offer equivalent access to the
|
||||||
|
Corresponding Source in the same way through the same place at no
|
||||||
|
further charge. You need not require recipients to copy the
|
||||||
|
Corresponding Source along with the object code. If the place to
|
||||||
|
copy the object code is a network server, the Corresponding Source
|
||||||
|
may be on a different server (operated by you or a third party)
|
||||||
|
that supports equivalent copying facilities, provided you maintain
|
||||||
|
clear directions next to the object code saying where to find the
|
||||||
|
Corresponding Source. Regardless of what server hosts the
|
||||||
|
Corresponding Source, you remain obligated to ensure that it is
|
||||||
|
available for as long as needed to satisfy these requirements.
|
||||||
|
- e) Convey the object code using peer-to-peer transmission,
|
||||||
|
provided you inform other peers where the object code and
|
||||||
|
Corresponding Source of the work are being offered to the general
|
||||||
|
public at no charge under subsection 6d.
|
||||||
|
|
||||||
|
A separable portion of the object code, whose source code is excluded
|
||||||
|
from the Corresponding Source as a System Library, need not be
|
||||||
|
included in conveying the object code work.
|
||||||
|
|
||||||
|
A "User Product" is either (1) a "consumer product", which means any
|
||||||
|
tangible personal property which is normally used for personal,
|
||||||
|
family, or household purposes, or (2) anything designed or sold for
|
||||||
|
incorporation into a dwelling. In determining whether a product is a
|
||||||
|
consumer product, doubtful cases shall be resolved in favor of
|
||||||
|
coverage. For a particular product received by a particular user,
|
||||||
|
"normally used" refers to a typical or common use of that class of
|
||||||
|
product, regardless of the status of the particular user or of the way
|
||||||
|
in which the particular user actually uses, or expects or is expected
|
||||||
|
to use, the product. A product is a consumer product regardless of
|
||||||
|
whether the product has substantial commercial, industrial or
|
||||||
|
non-consumer uses, unless such uses represent the only significant
|
||||||
|
mode of use of the product.
|
||||||
|
|
||||||
|
"Installation Information" for a User Product means any methods,
|
||||||
|
procedures, authorization keys, or other information required to
|
||||||
|
install and execute modified versions of a covered work in that User
|
||||||
|
Product from a modified version of its Corresponding Source. The
|
||||||
|
information must suffice to ensure that the continued functioning of
|
||||||
|
the modified object code is in no case prevented or interfered with
|
||||||
|
solely because modification has been made.
|
||||||
|
|
||||||
|
If you convey an object code work under this section in, or with, or
|
||||||
|
specifically for use in, a User Product, and the conveying occurs as
|
||||||
|
part of a transaction in which the right of possession and use of the
|
||||||
|
User Product is transferred to the recipient in perpetuity or for a
|
||||||
|
fixed term (regardless of how the transaction is characterized), the
|
||||||
|
Corresponding Source conveyed under this section must be accompanied
|
||||||
|
by the Installation Information. But this requirement does not apply
|
||||||
|
if neither you nor any third party retains the ability to install
|
||||||
|
modified object code on the User Product (for example, the work has
|
||||||
|
been installed in ROM).
|
||||||
|
|
||||||
|
The requirement to provide Installation Information does not include a
|
||||||
|
requirement to continue to provide support service, warranty, or
|
||||||
|
updates for a work that has been modified or installed by the
|
||||||
|
recipient, or for the User Product in which it has been modified or
|
||||||
|
installed. Access to a network may be denied when the modification
|
||||||
|
itself materially and adversely affects the operation of the network
|
||||||
|
or violates the rules and protocols for communication across the
|
||||||
|
network.
|
||||||
|
|
||||||
|
Corresponding Source conveyed, and Installation Information provided,
|
||||||
|
in accord with this section must be in a format that is publicly
|
||||||
|
documented (and with an implementation available to the public in
|
||||||
|
source code form), and must require no special password or key for
|
||||||
|
unpacking, reading or copying.
|
||||||
|
|
||||||
|
### 7. Additional Terms.
|
||||||
|
|
||||||
|
"Additional permissions" are terms that supplement the terms of this
|
||||||
|
License by making exceptions from one or more of its conditions.
|
||||||
|
Additional permissions that are applicable to the entire Program shall
|
||||||
|
be treated as though they were included in this License, to the extent
|
||||||
|
that they are valid under applicable law. If additional permissions
|
||||||
|
apply only to part of the Program, that part may be used separately
|
||||||
|
under those permissions, but the entire Program remains governed by
|
||||||
|
this License without regard to the additional permissions.
|
||||||
|
|
||||||
|
When you convey a copy of a covered work, you may at your option
|
||||||
|
remove any additional permissions from that copy, or from any part of
|
||||||
|
it. (Additional permissions may be written to require their own
|
||||||
|
removal in certain cases when you modify the work.) You may place
|
||||||
|
additional permissions on material, added by you to a covered work,
|
||||||
|
for which you have or can give appropriate copyright permission.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, for material you
|
||||||
|
add to a covered work, you may (if authorized by the copyright holders
|
||||||
|
of that material) supplement the terms of this License with terms:
|
||||||
|
|
||||||
|
- a) Disclaiming warranty or limiting liability differently from the
|
||||||
|
terms of sections 15 and 16 of this License; or
|
||||||
|
- b) Requiring preservation of specified reasonable legal notices or
|
||||||
|
author attributions in that material or in the Appropriate Legal
|
||||||
|
Notices displayed by works containing it; or
|
||||||
|
- c) Prohibiting misrepresentation of the origin of that material,
|
||||||
|
or requiring that modified versions of such material be marked in
|
||||||
|
reasonable ways as different from the original version; or
|
||||||
|
- d) Limiting the use for publicity purposes of names of licensors
|
||||||
|
or authors of the material; or
|
||||||
|
- e) Declining to grant rights under trademark law for use of some
|
||||||
|
trade names, trademarks, or service marks; or
|
||||||
|
- f) Requiring indemnification of licensors and authors of that
|
||||||
|
material by anyone who conveys the material (or modified versions
|
||||||
|
of it) with contractual assumptions of liability to the recipient,
|
||||||
|
for any liability that these contractual assumptions directly
|
||||||
|
impose on those licensors and authors.
|
||||||
|
|
||||||
|
All other non-permissive additional terms are considered "further
|
||||||
|
restrictions" within the meaning of section 10. If the Program as you
|
||||||
|
received it, or any part of it, contains a notice stating that it is
|
||||||
|
governed by this License along with a term that is a further
|
||||||
|
restriction, you may remove that term. If a license document contains
|
||||||
|
a further restriction but permits relicensing or conveying under this
|
||||||
|
License, you may add to a covered work material governed by the terms
|
||||||
|
of that license document, provided that the further restriction does
|
||||||
|
not survive such relicensing or conveying.
|
||||||
|
|
||||||
|
If you add terms to a covered work in accord with this section, you
|
||||||
|
must place, in the relevant source files, a statement of the
|
||||||
|
additional terms that apply to those files, or a notice indicating
|
||||||
|
where to find the applicable terms.
|
||||||
|
|
||||||
|
Additional terms, permissive or non-permissive, may be stated in the
|
||||||
|
form of a separately written license, or stated as exceptions; the
|
||||||
|
above requirements apply either way.
|
||||||
|
|
||||||
|
### 8. Termination.
|
||||||
|
|
||||||
|
You may not propagate or modify a covered work except as expressly
|
||||||
|
provided under this License. Any attempt otherwise to propagate or
|
||||||
|
modify it is void, and will automatically terminate your rights under
|
||||||
|
this License (including any patent licenses granted under the third
|
||||||
|
paragraph of section 11).
|
||||||
|
|
||||||
|
However, if you cease all violation of this License, then your license
|
||||||
|
from a particular copyright holder is reinstated (a) provisionally,
|
||||||
|
unless and until the copyright holder explicitly and finally
|
||||||
|
terminates your license, and (b) permanently, if the copyright holder
|
||||||
|
fails to notify you of the violation by some reasonable means prior to
|
||||||
|
60 days after the cessation.
|
||||||
|
|
||||||
|
Moreover, your license from a particular copyright holder is
|
||||||
|
reinstated permanently if the copyright holder notifies you of the
|
||||||
|
violation by some reasonable means, this is the first time you have
|
||||||
|
received notice of violation of this License (for any work) from that
|
||||||
|
copyright holder, and you cure the violation prior to 30 days after
|
||||||
|
your receipt of the notice.
|
||||||
|
|
||||||
|
Termination of your rights under this section does not terminate the
|
||||||
|
licenses of parties who have received copies or rights from you under
|
||||||
|
this License. If your rights have been terminated and not permanently
|
||||||
|
reinstated, you do not qualify to receive new licenses for the same
|
||||||
|
material under section 10.
|
||||||
|
|
||||||
|
### 9. Acceptance Not Required for Having Copies.
|
||||||
|
|
||||||
|
You are not required to accept this License in order to receive or run
|
||||||
|
a copy of the Program. Ancillary propagation of a covered work
|
||||||
|
occurring solely as a consequence of using peer-to-peer transmission
|
||||||
|
to receive a copy likewise does not require acceptance. However,
|
||||||
|
nothing other than this License grants you permission to propagate or
|
||||||
|
modify any covered work. These actions infringe copyright if you do
|
||||||
|
not accept this License. Therefore, by modifying or propagating a
|
||||||
|
covered work, you indicate your acceptance of this License to do so.
|
||||||
|
|
||||||
|
### 10. Automatic Licensing of Downstream Recipients.
|
||||||
|
|
||||||
|
Each time you convey a covered work, the recipient automatically
|
||||||
|
receives a license from the original licensors, to run, modify and
|
||||||
|
propagate that work, subject to this License. You are not responsible
|
||||||
|
for enforcing compliance by third parties with this License.
|
||||||
|
|
||||||
|
An "entity transaction" is a transaction transferring control of an
|
||||||
|
organization, or substantially all assets of one, or subdividing an
|
||||||
|
organization, or merging organizations. If propagation of a covered
|
||||||
|
work results from an entity transaction, each party to that
|
||||||
|
transaction who receives a copy of the work also receives whatever
|
||||||
|
licenses to the work the party's predecessor in interest had or could
|
||||||
|
give under the previous paragraph, plus a right to possession of the
|
||||||
|
Corresponding Source of the work from the predecessor in interest, if
|
||||||
|
the predecessor has it or can get it with reasonable efforts.
|
||||||
|
|
||||||
|
You may not impose any further restrictions on the exercise of the
|
||||||
|
rights granted or affirmed under this License. For example, you may
|
||||||
|
not impose a license fee, royalty, or other charge for exercise of
|
||||||
|
rights granted under this License, and you may not initiate litigation
|
||||||
|
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||||
|
any patent claim is infringed by making, using, selling, offering for
|
||||||
|
sale, or importing the Program or any portion of it.
|
||||||
|
|
||||||
|
### 11. Patents.
|
||||||
|
|
||||||
|
A "contributor" is a copyright holder who authorizes use under this
|
||||||
|
License of the Program or a work on which the Program is based. The
|
||||||
|
work thus licensed is called the contributor's "contributor version".
|
||||||
|
|
||||||
|
A contributor's "essential patent claims" are all patent claims owned
|
||||||
|
or controlled by the contributor, whether already acquired or
|
||||||
|
hereafter acquired, that would be infringed by some manner, permitted
|
||||||
|
by this License, of making, using, or selling its contributor version,
|
||||||
|
but do not include claims that would be infringed only as a
|
||||||
|
consequence of further modification of the contributor version. For
|
||||||
|
purposes of this definition, "control" includes the right to grant
|
||||||
|
patent sublicenses in a manner consistent with the requirements of
|
||||||
|
this License.
|
||||||
|
|
||||||
|
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||||
|
patent license under the contributor's essential patent claims, to
|
||||||
|
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||||
|
propagate the contents of its contributor version.
|
||||||
|
|
||||||
|
In the following three paragraphs, a "patent license" is any express
|
||||||
|
agreement or commitment, however denominated, not to enforce a patent
|
||||||
|
(such as an express permission to practice a patent or covenant not to
|
||||||
|
sue for patent infringement). To "grant" such a patent license to a
|
||||||
|
party means to make such an agreement or commitment not to enforce a
|
||||||
|
patent against the party.
|
||||||
|
|
||||||
|
If you convey a covered work, knowingly relying on a patent license,
|
||||||
|
and the Corresponding Source of the work is not available for anyone
|
||||||
|
to copy, free of charge and under the terms of this License, through a
|
||||||
|
publicly available network server or other readily accessible means,
|
||||||
|
then you must either (1) cause the Corresponding Source to be so
|
||||||
|
available, or (2) arrange to deprive yourself of the benefit of the
|
||||||
|
patent license for this particular work, or (3) arrange, in a manner
|
||||||
|
consistent with the requirements of this License, to extend the patent
|
||||||
|
license to downstream recipients. "Knowingly relying" means you have
|
||||||
|
actual knowledge that, but for the patent license, your conveying the
|
||||||
|
covered work in a country, or your recipient's use of the covered work
|
||||||
|
in a country, would infringe one or more identifiable patents in that
|
||||||
|
country that you have reason to believe are valid.
|
||||||
|
|
||||||
|
If, pursuant to or in connection with a single transaction or
|
||||||
|
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||||
|
covered work, and grant a patent license to some of the parties
|
||||||
|
receiving the covered work authorizing them to use, propagate, modify
|
||||||
|
or convey a specific copy of the covered work, then the patent license
|
||||||
|
you grant is automatically extended to all recipients of the covered
|
||||||
|
work and works based on it.
|
||||||
|
|
||||||
|
A patent license is "discriminatory" if it does not include within the
|
||||||
|
scope of its coverage, prohibits the exercise of, or is conditioned on
|
||||||
|
the non-exercise of one or more of the rights that are specifically
|
||||||
|
granted under this License. You may not convey a covered work if you
|
||||||
|
are a party to an arrangement with a third party that is in the
|
||||||
|
business of distributing software, under which you make payment to the
|
||||||
|
third party based on the extent of your activity of conveying the
|
||||||
|
work, and under which the third party grants, to any of the parties
|
||||||
|
who would receive the covered work from you, a discriminatory patent
|
||||||
|
license (a) in connection with copies of the covered work conveyed by
|
||||||
|
you (or copies made from those copies), or (b) primarily for and in
|
||||||
|
connection with specific products or compilations that contain the
|
||||||
|
covered work, unless you entered into that arrangement, or that patent
|
||||||
|
license was granted, prior to 28 March 2007.
|
||||||
|
|
||||||
|
Nothing in this License shall be construed as excluding or limiting
|
||||||
|
any implied license or other defenses to infringement that may
|
||||||
|
otherwise be available to you under applicable patent law.
|
||||||
|
|
||||||
|
### 12. No Surrender of Others' Freedom.
|
||||||
|
|
||||||
|
If conditions are imposed on you (whether by court order, agreement or
|
||||||
|
otherwise) that contradict the conditions of this License, they do not
|
||||||
|
excuse you from the conditions of this License. If you cannot convey a
|
||||||
|
covered work so as to satisfy simultaneously your obligations under
|
||||||
|
this License and any other pertinent obligations, then as a
|
||||||
|
consequence you may not convey it at all. For example, if you agree to
|
||||||
|
terms that obligate you to collect a royalty for further conveying
|
||||||
|
from those to whom you convey the Program, the only way you could
|
||||||
|
satisfy both those terms and this License would be to refrain entirely
|
||||||
|
from conveying the Program.
|
||||||
|
|
||||||
|
### 13. Remote Network Interaction; Use with the GNU General Public License.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, if you modify the
|
||||||
|
Program, your modified version must prominently offer all users
|
||||||
|
interacting with it remotely through a computer network (if your
|
||||||
|
version supports such interaction) an opportunity to receive the
|
||||||
|
Corresponding Source of your version by providing access to the
|
||||||
|
Corresponding Source from a network server at no charge, through some
|
||||||
|
standard or customary means of facilitating copying of software. This
|
||||||
|
Corresponding Source shall include the Corresponding Source for any
|
||||||
|
work covered by version 3 of the GNU General Public License that is
|
||||||
|
incorporated pursuant to the following paragraph.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, you have
|
||||||
|
permission to link or combine any covered work with a work licensed
|
||||||
|
under version 3 of the GNU General Public License into a single
|
||||||
|
combined work, and to convey the resulting work. The terms of this
|
||||||
|
License will continue to apply to the part which is the covered work,
|
||||||
|
but the work with which it is combined will remain governed by version
|
||||||
|
3 of the GNU General Public License.
|
||||||
|
|
||||||
|
### 14. Revised Versions of this License.
|
||||||
|
|
||||||
|
The Free Software Foundation may publish revised and/or new versions
|
||||||
|
of the GNU Affero General Public License from time to time. Such new
|
||||||
|
versions will be similar in spirit to the present version, but may
|
||||||
|
differ in detail to address new problems or concerns.
|
||||||
|
|
||||||
|
Each version is given a distinguishing version number. If the Program
|
||||||
|
specifies that a certain numbered version of the GNU Affero General
|
||||||
|
Public License "or any later version" applies to it, you have the
|
||||||
|
option of following the terms and conditions either of that numbered
|
||||||
|
version or of any later version published by the Free Software
|
||||||
|
Foundation. If the Program does not specify a version number of the
|
||||||
|
GNU Affero General Public License, you may choose any version ever
|
||||||
|
published by the Free Software Foundation.
|
||||||
|
|
||||||
|
If the Program specifies that a proxy can decide which future versions
|
||||||
|
of the GNU Affero General Public License can be used, that proxy's
|
||||||
|
public statement of acceptance of a version permanently authorizes you
|
||||||
|
to choose that version for the Program.
|
||||||
|
|
||||||
|
Later license versions may give you additional or different
|
||||||
|
permissions. However, no additional obligations are imposed on any
|
||||||
|
author or copyright holder as a result of your choosing to follow a
|
||||||
|
later version.
|
||||||
|
|
||||||
|
### 15. Disclaimer of Warranty.
|
||||||
|
|
||||||
|
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||||
|
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||||
|
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT
|
||||||
|
WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT
|
||||||
|
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND
|
||||||
|
PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE
|
||||||
|
DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR
|
||||||
|
CORRECTION.
|
||||||
|
|
||||||
|
### 16. Limitation of Liability.
|
||||||
|
|
||||||
|
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||||
|
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR
|
||||||
|
CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||||
|
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES
|
||||||
|
ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT
|
||||||
|
NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR
|
||||||
|
LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM
|
||||||
|
TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER
|
||||||
|
PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||||
|
|
||||||
|
### 17. Interpretation of Sections 15 and 16.
|
||||||
|
|
||||||
|
If the disclaimer of warranty and limitation of liability provided
|
||||||
|
above cannot be given local legal effect according to their terms,
|
||||||
|
reviewing courts shall apply local law that most closely approximates
|
||||||
|
an absolute waiver of all civil liability in connection with the
|
||||||
|
Program, unless a warranty or assumption of liability accompanies a
|
||||||
|
copy of the Program in return for a fee.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
## How to Apply These Terms to Your New Programs
|
||||||
|
|
||||||
|
If you develop a new program, and you want it to be of the greatest
|
||||||
|
possible use to the public, the best way to achieve this is to make it
|
||||||
|
free software which everyone can redistribute and change under these
|
||||||
|
terms.
|
||||||
|
|
||||||
|
To do so, attach the following notices to the program. It is safest to
|
||||||
|
attach them to the start of each source file to most effectively state
|
||||||
|
the exclusion of warranty; and each file should have at least the
|
||||||
|
"copyright" line and a pointer to where the full notice is found.
|
||||||
|
|
||||||
|
<one line to give the program's name and a brief idea of what it does.>
|
||||||
|
Copyright (C) <year> <name of author>
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Affero General Public License as
|
||||||
|
published by the Free Software Foundation, either version 3 of the
|
||||||
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU Affero General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Affero General Public License
|
||||||
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Also add information on how to contact you by electronic and paper
|
||||||
|
mail.
|
||||||
|
|
||||||
|
If your software can interact with users remotely through a computer
|
||||||
|
network, you should also make sure that it provides a way for users to
|
||||||
|
get its source. For example, if your program is a web application, its
|
||||||
|
interface could display a "Source" link that leads users to an archive
|
||||||
|
of the code. There are many ways you could offer source, and different
|
||||||
|
solutions will be better for different programs; see section 13 for
|
||||||
|
the specific requirements.
|
||||||
|
|
||||||
|
You should also get your employer (if you work as a programmer) or
|
||||||
|
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||||
|
necessary. For more information on this, and how to apply and follow
|
||||||
|
the GNU AGPL, see <https://www.gnu.org/licenses/>.
|
||||||
@@ -219,7 +219,7 @@ func (m *MongoDB) UpdateMultiple(set interface{}, filter map[string]interface{},
|
|||||||
f = append(f, bson.E{Key: k, Value: v})
|
f = append(f, bson.E{Key: k, Value: v})
|
||||||
}
|
}
|
||||||
targetDBCollection := CollectionMap[collection_name]
|
targetDBCollection := CollectionMap[collection_name]
|
||||||
MngoCtx, cancel = context.WithTimeout(context.Background(), 10*time.Second)
|
MngoCtx, cancel = context.WithTimeout(context.Background(), 50*time.Second)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
res, err := targetDBCollection.UpdateMany(MngoCtx, f, dbs.InputToBson(doc, true))
|
res, err := targetDBCollection.UpdateMany(MngoCtx, f, dbs.InputToBson(doc, true))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -238,7 +238,7 @@ func (m *MongoDB) UpdateOne(set interface{}, id string, collection_name string)
|
|||||||
bson.Unmarshal(b, &doc)
|
bson.Unmarshal(b, &doc)
|
||||||
filter := bson.M{"_id": id}
|
filter := bson.M{"_id": id}
|
||||||
targetDBCollection := CollectionMap[collection_name]
|
targetDBCollection := CollectionMap[collection_name]
|
||||||
MngoCtx, cancel = context.WithTimeout(context.Background(), 10*time.Second)
|
MngoCtx, cancel = context.WithTimeout(context.Background(), 50*time.Second)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
_, err := targetDBCollection.UpdateOne(MngoCtx, filter, dbs.InputToBson(doc, true))
|
_, err := targetDBCollection.UpdateOne(MngoCtx, filter, dbs.InputToBson(doc, true))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
112
entrypoint.go
112
entrypoint.go
@@ -3,6 +3,7 @@ package oclib
|
|||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"runtime/debug"
|
"runtime/debug"
|
||||||
|
|
||||||
@@ -11,6 +12,8 @@ import (
|
|||||||
"cloud.o-forge.io/core/oc-lib/dbs/mongo"
|
"cloud.o-forge.io/core/oc-lib/dbs/mongo"
|
||||||
"cloud.o-forge.io/core/oc-lib/logs"
|
"cloud.o-forge.io/core/oc-lib/logs"
|
||||||
"cloud.o-forge.io/core/oc-lib/models"
|
"cloud.o-forge.io/core/oc-lib/models"
|
||||||
|
"cloud.o-forge.io/core/oc-lib/models/collaborative_area"
|
||||||
|
"cloud.o-forge.io/core/oc-lib/models/collaborative_area/rules/rule"
|
||||||
"cloud.o-forge.io/core/oc-lib/models/peer"
|
"cloud.o-forge.io/core/oc-lib/models/peer"
|
||||||
"cloud.o-forge.io/core/oc-lib/models/resource_model"
|
"cloud.o-forge.io/core/oc-lib/models/resource_model"
|
||||||
"cloud.o-forge.io/core/oc-lib/models/resources/data"
|
"cloud.o-forge.io/core/oc-lib/models/resources/data"
|
||||||
@@ -22,9 +25,8 @@ import (
|
|||||||
w2 "cloud.o-forge.io/core/oc-lib/models/workflow"
|
w2 "cloud.o-forge.io/core/oc-lib/models/workflow"
|
||||||
"cloud.o-forge.io/core/oc-lib/models/workflow_execution"
|
"cloud.o-forge.io/core/oc-lib/models/workflow_execution"
|
||||||
"cloud.o-forge.io/core/oc-lib/models/workspace"
|
"cloud.o-forge.io/core/oc-lib/models/workspace"
|
||||||
shared_workspace "cloud.o-forge.io/core/oc-lib/models/workspace/shared"
|
|
||||||
"cloud.o-forge.io/core/oc-lib/models/workspace/shared/rules/rule"
|
|
||||||
"cloud.o-forge.io/core/oc-lib/tools"
|
"cloud.o-forge.io/core/oc-lib/tools"
|
||||||
|
"github.com/beego/beego/v2/server/web/context"
|
||||||
"github.com/goraz/onion"
|
"github.com/goraz/onion"
|
||||||
"github.com/rs/zerolog"
|
"github.com/rs/zerolog"
|
||||||
)
|
)
|
||||||
@@ -36,28 +38,28 @@ type LibDataEnum int
|
|||||||
// init accessible constant to retrieve data from the database
|
// init accessible constant to retrieve data from the database
|
||||||
const (
|
const (
|
||||||
INVALID LibDataEnum = iota
|
INVALID LibDataEnum = iota
|
||||||
DATA_RESOURCE = utils.DATA_RESOURCE
|
DATA_RESOURCE = tools.DATA_RESOURCE
|
||||||
PROCESSING_RESOURCE = utils.PROCESSING_RESOURCE
|
PROCESSING_RESOURCE = tools.PROCESSING_RESOURCE
|
||||||
STORAGE_RESOURCE = utils.STORAGE_RESOURCE
|
STORAGE_RESOURCE = tools.STORAGE_RESOURCE
|
||||||
DATACENTER_RESOURCE = utils.DATACENTER_RESOURCE
|
DATACENTER_RESOURCE = tools.DATACENTER_RESOURCE
|
||||||
WORKFLOW_RESOURCE = utils.WORKFLOW_RESOURCE
|
WORKFLOW_RESOURCE = tools.WORKFLOW_RESOURCE
|
||||||
WORKFLOW = utils.WORKFLOW
|
WORKFLOW = tools.WORKFLOW
|
||||||
WORKSPACE = utils.WORKSPACE
|
WORKSPACE = tools.WORKSPACE
|
||||||
WORKFLOW_EXECUTION = utils.WORKFLOW_EXECUTION
|
WORKFLOW_EXECUTION = tools.WORKFLOW_EXECUTION
|
||||||
PEER = utils.PEER
|
PEER = tools.PEER
|
||||||
SHARED_WORKSPACE = utils.SHARED_WORKSPACE
|
SHARED_WORKSPACE = tools.COLLABORATIVE_AREA
|
||||||
RULE = utils.RULE
|
RULE = tools.RULE
|
||||||
BOOKING = utils.BOOKING
|
BOOKING = tools.BOOKING
|
||||||
)
|
)
|
||||||
|
|
||||||
// will turn into standards api hostnames
|
// will turn into standards api hostnames
|
||||||
func (d LibDataEnum) API() string {
|
func (d LibDataEnum) API() string {
|
||||||
return utils.DefaultAPI[d]
|
return tools.DefaultAPI[d]
|
||||||
}
|
}
|
||||||
|
|
||||||
// will turn into standards name
|
// will turn into standards name
|
||||||
func (d LibDataEnum) String() string {
|
func (d LibDataEnum) String() string {
|
||||||
return utils.Str[d]
|
return tools.Str[d]
|
||||||
}
|
}
|
||||||
|
|
||||||
// will turn into enum index
|
// will turn into enum index
|
||||||
@@ -65,6 +67,20 @@ func (d LibDataEnum) EnumIndex() int {
|
|||||||
return int(d)
|
return int(d)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func IsQueryParamsEquals(input *context.BeegoInput, name string, val interface{}) bool {
|
||||||
|
path := strings.Split(input.URI(), "?")
|
||||||
|
if len(path) >= 2 {
|
||||||
|
uri := strings.Split(path[1], "&")
|
||||||
|
for _, val := range uri {
|
||||||
|
kv := strings.Split(val, "=")
|
||||||
|
if kv[0] == name && fmt.Sprintf("%v", val) == kv[1] {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
// model to define the shallow data structure
|
// model to define the shallow data structure
|
||||||
type LibDataShallow struct {
|
type LibDataShallow struct {
|
||||||
Data []utils.ShallowDBObject `bson:"data" json:"data"`
|
Data []utils.ShallowDBObject `bson:"data" json:"data"`
|
||||||
@@ -79,24 +95,6 @@ type LibData struct {
|
|||||||
Err string `bson:"error" json:"error"`
|
Err string `bson:"error" json:"error"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// here is the singleton variable to store the paths that api will use
|
|
||||||
var paths map[LibDataEnum]string = map[LibDataEnum]string{}
|
|
||||||
|
|
||||||
// to get the paths
|
|
||||||
func GetPaths() map[LibDataEnum]string {
|
|
||||||
return paths
|
|
||||||
}
|
|
||||||
|
|
||||||
// to get the path
|
|
||||||
func GetPath(collection LibDataEnum) string {
|
|
||||||
return paths[collection]
|
|
||||||
}
|
|
||||||
|
|
||||||
// to add the path
|
|
||||||
func AddPath(collection LibDataEnum, path string) {
|
|
||||||
paths[collection] = path
|
|
||||||
}
|
|
||||||
|
|
||||||
func Init(appName string) {
|
func Init(appName string) {
|
||||||
config.SetAppName(appName) // set the app name to the logger to define the main log chan
|
config.SetAppName(appName) // set the app name to the logger to define the main log chan
|
||||||
// create a temporary console logger for init
|
// create a temporary console logger for init
|
||||||
@@ -139,17 +137,13 @@ func SetConfig(mongoUrl string, database string, natsUrl string, lokiUrl string,
|
|||||||
Resource model is the model that will define the structure of the resources
|
Resource model is the model that will define the structure of the resources
|
||||||
*/
|
*/
|
||||||
accessor := (&resource_model.ResourceModel{}).GetAccessor(nil)
|
accessor := (&resource_model.ResourceModel{}).GetAccessor(nil)
|
||||||
for _, model := range []string{utils.DATA_RESOURCE.String(), utils.PROCESSING_RESOURCE.String(), utils.STORAGE_RESOURCE.String(), utils.DATACENTER_RESOURCE.String(), utils.WORKFLOW_RESOURCE.String()} {
|
for _, model := range []string{tools.DATA_RESOURCE.String(), tools.PROCESSING_RESOURCE.String(), tools.STORAGE_RESOURCE.String(), tools.DATACENTER_RESOURCE.String(), tools.WORKFLOW_RESOURCE.String()} {
|
||||||
data, code, _ := accessor.Search(nil, model)
|
data, code, _ := accessor.Search(nil, model)
|
||||||
if code == 404 || len(data) == 0 {
|
if code == 404 || len(data) == 0 {
|
||||||
m := map[string]resource_model.Model{}
|
m := map[string]resource_model.Model{}
|
||||||
// TODO Specify the model for each resource
|
// TODO Specify the model for each resource
|
||||||
// for now only processing is specified here (not an elegant way)
|
// for now only processing is specified here (not an elegant way)
|
||||||
if model == utils.PROCESSING_RESOURCE.String() {
|
if model == tools.PROCESSING_RESOURCE.String() {
|
||||||
m["image"] = resource_model.Model{
|
|
||||||
Type: "string",
|
|
||||||
ReadOnly: false,
|
|
||||||
}
|
|
||||||
m["command"] = resource_model.Model{
|
m["command"] = resource_model.Model{
|
||||||
Type: "string",
|
Type: "string",
|
||||||
ReadOnly: false,
|
ReadOnly: false,
|
||||||
@@ -158,14 +152,20 @@ func SetConfig(mongoUrl string, database string, natsUrl string, lokiUrl string,
|
|||||||
Type: "string",
|
Type: "string",
|
||||||
ReadOnly: false,
|
ReadOnly: false,
|
||||||
}
|
}
|
||||||
m["execute"] = resource_model.Model{
|
m["env"] = resource_model.Model{
|
||||||
Type: "map[int]map[string]string",
|
Type: "string",
|
||||||
|
ReadOnly: false,
|
||||||
|
}
|
||||||
|
m["volumes"] = resource_model.Model{
|
||||||
|
Type: "map[string]string",
|
||||||
ReadOnly: false,
|
ReadOnly: false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
accessor.StoreOne(&resource_model.ResourceModel{
|
accessor.StoreOne(&resource_model.ResourceModel{
|
||||||
ResourceType: model,
|
ResourceType: model,
|
||||||
Model: m,
|
Model: map[string]map[string]resource_model.Model{
|
||||||
|
"container": m,
|
||||||
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -394,72 +394,72 @@ func CopyOne(collection LibDataEnum, object map[string]interface{}, c ...*tools.
|
|||||||
// ================ CAST ========================= //
|
// ================ CAST ========================= //
|
||||||
|
|
||||||
func (l *LibData) ToDataResource() *data.DataResource {
|
func (l *LibData) ToDataResource() *data.DataResource {
|
||||||
if l.Data.GetAccessor(nil).GetType() == utils.DATA_RESOURCE.String() {
|
if l.Data.GetAccessor(nil).GetType() == tools.DATA_RESOURCE.String() {
|
||||||
return l.Data.(*data.DataResource)
|
return l.Data.(*data.DataResource)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l *LibData) ToDatacenterResource() *datacenter.DatacenterResource {
|
func (l *LibData) ToDatacenterResource() *datacenter.DatacenterResource {
|
||||||
if l.Data != nil && l.Data.GetAccessor(nil).GetType() == utils.DATACENTER_RESOURCE.String() {
|
if l.Data != nil && l.Data.GetAccessor(nil).GetType() == tools.DATACENTER_RESOURCE.String() {
|
||||||
return l.Data.(*datacenter.DatacenterResource)
|
return l.Data.(*datacenter.DatacenterResource)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
func (l *LibData) ToStorageResource() *storage.StorageResource {
|
func (l *LibData) ToStorageResource() *storage.StorageResource {
|
||||||
if l.Data.GetAccessor(nil).GetType() == utils.STORAGE_RESOURCE.String() {
|
if l.Data.GetAccessor(nil).GetType() == tools.STORAGE_RESOURCE.String() {
|
||||||
return l.Data.(*storage.StorageResource)
|
return l.Data.(*storage.StorageResource)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
func (l *LibData) ToProcessingResource() *processing.ProcessingResource {
|
func (l *LibData) ToProcessingResource() *processing.ProcessingResource {
|
||||||
if l.Data.GetAccessor(nil).GetType() == utils.PROCESSING_RESOURCE.String() {
|
if l.Data.GetAccessor(nil).GetType() == tools.PROCESSING_RESOURCE.String() {
|
||||||
return l.Data.(*processing.ProcessingResource)
|
return l.Data.(*processing.ProcessingResource)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
func (l *LibData) ToWorkflowResource() *w.WorkflowResource {
|
func (l *LibData) ToWorkflowResource() *w.WorkflowResource {
|
||||||
if l.Data.GetAccessor(nil).GetType() == utils.WORKFLOW_RESOURCE.String() {
|
if l.Data.GetAccessor(nil).GetType() == tools.WORKFLOW_RESOURCE.String() {
|
||||||
return l.Data.(*w.WorkflowResource)
|
return l.Data.(*w.WorkflowResource)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
func (l *LibData) ToPeer() *peer.Peer {
|
func (l *LibData) ToPeer() *peer.Peer {
|
||||||
if l.Data.GetAccessor(nil).GetType() == utils.PEER.String() {
|
if l.Data.GetAccessor(nil).GetType() == tools.PEER.String() {
|
||||||
return l.Data.(*peer.Peer)
|
return l.Data.(*peer.Peer)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l *LibData) ToWorkflow() *w2.Workflow {
|
func (l *LibData) ToWorkflow() *w2.Workflow {
|
||||||
if l.Data.GetAccessor(nil).GetType() == utils.WORKFLOW.String() {
|
if l.Data.GetAccessor(nil).GetType() == tools.WORKFLOW.String() {
|
||||||
return l.Data.(*w2.Workflow)
|
return l.Data.(*w2.Workflow)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
func (l *LibData) ToWorkspace() *workspace.Workspace {
|
func (l *LibData) ToWorkspace() *workspace.Workspace {
|
||||||
if l.Data.GetAccessor(nil).GetType() == utils.WORKSPACE.String() {
|
if l.Data.GetAccessor(nil).GetType() == tools.WORKSPACE.String() {
|
||||||
return l.Data.(*workspace.Workspace)
|
return l.Data.(*workspace.Workspace)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l *LibData) ToSharedWorkspace() *shared_workspace.SharedWorkspace {
|
func (l *LibData) ToCollaborativeArea() *collaborative_area.CollaborativeArea {
|
||||||
if l.Data.GetAccessor(nil).GetType() == utils.SHARED_WORKSPACE.String() {
|
if l.Data.GetAccessor(nil).GetType() == tools.COLLABORATIVE_AREA.String() {
|
||||||
return l.Data.(*shared_workspace.SharedWorkspace)
|
return l.Data.(*collaborative_area.CollaborativeArea)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l *LibData) ToRule() *rule.Rule {
|
func (l *LibData) ToRule() *rule.Rule {
|
||||||
if l.Data.GetAccessor(nil).GetType() == utils.SHARED_WORKSPACE.String() {
|
if l.Data.GetAccessor(nil).GetType() == tools.COLLABORATIVE_AREA.String() {
|
||||||
return l.Data.(*rule.Rule)
|
return l.Data.(*rule.Rule)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l *LibData) ToWorkflowExecution() *workflow_execution.WorkflowExecution {
|
func (l *LibData) ToWorkflowExecution() *workflow_execution.WorkflowExecution {
|
||||||
if l.Data.GetAccessor(nil).GetType() == utils.WORKFLOW_EXECUTION.String() {
|
if l.Data.GetAccessor(nil).GetType() == tools.WORKFLOW_EXECUTION.String() {
|
||||||
return l.Data.(*workflow_execution.WorkflowExecution)
|
return l.Data.(*workflow_execution.WorkflowExecution)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
2
go.mod
2
go.mod
@@ -25,6 +25,7 @@ require (
|
|||||||
)
|
)
|
||||||
|
|
||||||
require (
|
require (
|
||||||
|
github.com/beego/beego/v2 v2.3.1 // indirect
|
||||||
github.com/davecgh/go-spew v1.1.1 // indirect
|
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||||
github.com/gabriel-vasile/mimetype v1.4.4 // indirect
|
github.com/gabriel-vasile/mimetype v1.4.4 // indirect
|
||||||
github.com/go-playground/locales v0.14.1 // indirect
|
github.com/go-playground/locales v0.14.1 // indirect
|
||||||
@@ -43,6 +44,7 @@ require (
|
|||||||
golang.org/x/net v0.27.0 // indirect
|
golang.org/x/net v0.27.0 // indirect
|
||||||
golang.org/x/sync v0.7.0 // indirect
|
golang.org/x/sync v0.7.0 // indirect
|
||||||
golang.org/x/text v0.16.0 // indirect
|
golang.org/x/text v0.16.0 // indirect
|
||||||
|
google.golang.org/protobuf v1.34.2 // indirect
|
||||||
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f // indirect
|
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f // indirect
|
||||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||||
)
|
)
|
||||||
|
|||||||
4
go.sum
4
go.sum
@@ -1,4 +1,6 @@
|
|||||||
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
||||||
|
github.com/beego/beego/v2 v2.3.1 h1:7MUKMpJYzOXtCUsTEoXOxsDV/UcHw6CPbaWMlthVNsc=
|
||||||
|
github.com/beego/beego/v2 v2.3.1/go.mod h1:5cqHsOHJIxkq44tBpRvtDe59GuVRVv/9/tyVDxd5ce4=
|
||||||
github.com/coreos/etcd v3.3.17+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE=
|
github.com/coreos/etcd v3.3.17+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE=
|
||||||
github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=
|
github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=
|
||||||
github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc=
|
github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc=
|
||||||
@@ -134,6 +136,8 @@ golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3
|
|||||||
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||||
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
|
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
|
||||||
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||||
|
google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg=
|
||||||
|
google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw=
|
||||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU=
|
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU=
|
||||||
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ func (d *Booking) GetName() string {
|
|||||||
|
|
||||||
func (d *Booking) GetAccessor(caller *tools.HTTPCaller) utils.Accessor {
|
func (d *Booking) GetAccessor(caller *tools.HTTPCaller) utils.Accessor {
|
||||||
data := New() // Create a new instance of the accessor
|
data := New() // Create a new instance of the accessor
|
||||||
data.Init(utils.BOOKING, caller) // Initialize the accessor with the BOOKING model type
|
data.Init(tools.BOOKING, caller) // Initialize the accessor with the BOOKING model type
|
||||||
return data
|
return data
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
package shared_workspace
|
package collaborative_area
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
|
||||||
|
"cloud.o-forge.io/core/oc-lib/models/collaborative_area/rules/rule"
|
||||||
"cloud.o-forge.io/core/oc-lib/models/peer"
|
"cloud.o-forge.io/core/oc-lib/models/peer"
|
||||||
"cloud.o-forge.io/core/oc-lib/models/utils"
|
"cloud.o-forge.io/core/oc-lib/models/utils"
|
||||||
w "cloud.o-forge.io/core/oc-lib/models/workflow"
|
w "cloud.o-forge.io/core/oc-lib/models/workflow"
|
||||||
"cloud.o-forge.io/core/oc-lib/models/workspace"
|
"cloud.o-forge.io/core/oc-lib/models/workspace"
|
||||||
"cloud.o-forge.io/core/oc-lib/models/workspace/shared/rules/rule"
|
|
||||||
"cloud.o-forge.io/core/oc-lib/tools"
|
"cloud.o-forge.io/core/oc-lib/tools"
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
)
|
)
|
||||||
@@ -16,7 +16,7 @@ import (
|
|||||||
// WARNING : it got a shallow object version, this one is the full version
|
// WARNING : it got a shallow object version, this one is the full version
|
||||||
// full version is the one used by API
|
// full version is the one used by API
|
||||||
// other one is a shallow version used by the Lib for import cycle problem purposes
|
// other one is a shallow version used by the Lib for import cycle problem purposes
|
||||||
type SharedWorkspace struct {
|
type CollaborativeArea struct {
|
||||||
utils.AbstractObject // AbstractObject contains the basic fields of an object (id, name)
|
utils.AbstractObject // AbstractObject contains the basic fields of an object (id, name)
|
||||||
IsSent bool `json:"is_sent" bson:"-"` // IsSent is a flag that indicates if the workspace is sent
|
IsSent bool `json:"is_sent" bson:"-"` // IsSent is a flag that indicates if the workspace is sent
|
||||||
CreatorID string `json:"peer_id,omitempty" bson:"peer_id,omitempty" validate:"required"` // CreatorID is the ID of the creator
|
CreatorID string `json:"peer_id,omitempty" bson:"peer_id,omitempty" validate:"required"` // CreatorID is the ID of the creator
|
||||||
@@ -34,27 +34,27 @@ type SharedWorkspace struct {
|
|||||||
SharedPeers []*peer.Peer `json:"shared_peers,omitempty" bson:"-"` // SharedPeers is the shared peers of the workspace
|
SharedPeers []*peer.Peer `json:"shared_peers,omitempty" bson:"-"` // SharedPeers is the shared peers of the workspace
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ao *SharedWorkspace) GetID() string {
|
func (ao *CollaborativeArea) GetID() string {
|
||||||
return ao.UUID
|
return ao.UUID
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *SharedWorkspace) GenerateID() {
|
func (r *CollaborativeArea) GenerateID() {
|
||||||
if r.UUID == "" {
|
if r.UUID == "" {
|
||||||
r.UUID = uuid.New().String()
|
r.UUID = uuid.New().String()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *SharedWorkspace) GetName() string {
|
func (d *CollaborativeArea) GetName() string {
|
||||||
return d.Name
|
return d.Name
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *SharedWorkspace) GetAccessor(caller *tools.HTTPCaller) utils.Accessor {
|
func (d *CollaborativeArea) GetAccessor(caller *tools.HTTPCaller) utils.Accessor {
|
||||||
data := New() // Create a new instance of the accessor
|
data := New() // Create a new instance of the accessor
|
||||||
data.Init(utils.SHARED_WORKSPACE, caller) // Initialize the accessor with the SHARED_WORKSPACE model type
|
data.Init(tools.COLLABORATIVE_AREA, caller) // Initialize the accessor with the SHARED_WORKSPACE model type
|
||||||
return data
|
return data
|
||||||
}
|
}
|
||||||
|
|
||||||
func (dma *SharedWorkspace) Deserialize(j map[string]interface{}) utils.DBObject {
|
func (dma *CollaborativeArea) Deserialize(j map[string]interface{}) utils.DBObject {
|
||||||
b, err := json.Marshal(j)
|
b, err := json.Marshal(j)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil
|
return nil
|
||||||
@@ -63,7 +63,7 @@ func (dma *SharedWorkspace) Deserialize(j map[string]interface{}) utils.DBObject
|
|||||||
return dma
|
return dma
|
||||||
}
|
}
|
||||||
|
|
||||||
func (dma *SharedWorkspace) Serialize() map[string]interface{} {
|
func (dma *CollaborativeArea) Serialize() map[string]interface{} {
|
||||||
var m map[string]interface{}
|
var m map[string]interface{}
|
||||||
b, err := json.Marshal(dma)
|
b, err := json.Marshal(dma)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package shared_workspace
|
package collaborative_area
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
@@ -6,53 +6,53 @@ import (
|
|||||||
|
|
||||||
"cloud.o-forge.io/core/oc-lib/dbs"
|
"cloud.o-forge.io/core/oc-lib/dbs"
|
||||||
"cloud.o-forge.io/core/oc-lib/dbs/mongo"
|
"cloud.o-forge.io/core/oc-lib/dbs/mongo"
|
||||||
|
"cloud.o-forge.io/core/oc-lib/models/collaborative_area/rules/rule"
|
||||||
"cloud.o-forge.io/core/oc-lib/models/peer"
|
"cloud.o-forge.io/core/oc-lib/models/peer"
|
||||||
"cloud.o-forge.io/core/oc-lib/models/utils"
|
"cloud.o-forge.io/core/oc-lib/models/utils"
|
||||||
w "cloud.o-forge.io/core/oc-lib/models/workflow"
|
w "cloud.o-forge.io/core/oc-lib/models/workflow"
|
||||||
"cloud.o-forge.io/core/oc-lib/models/workspace"
|
"cloud.o-forge.io/core/oc-lib/models/workspace"
|
||||||
"cloud.o-forge.io/core/oc-lib/models/workspace/shared/rules/rule"
|
|
||||||
"cloud.o-forge.io/core/oc-lib/static"
|
"cloud.o-forge.io/core/oc-lib/static"
|
||||||
"cloud.o-forge.io/core/oc-lib/tools"
|
"cloud.o-forge.io/core/oc-lib/tools"
|
||||||
)
|
)
|
||||||
|
|
||||||
// SharedWorkspace is a struct that represents a shared workspace
|
// SharedWorkspace is a struct that represents a collaborative area
|
||||||
type sharedWorkspaceMongoAccessor struct {
|
type collaborativeAreaMongoAccessor struct {
|
||||||
utils.AbstractAccessor // AbstractAccessor contains the basic fields of an accessor (model, caller)
|
utils.AbstractAccessor // AbstractAccessor contains the basic fields of an accessor (model, caller)
|
||||||
}
|
}
|
||||||
|
|
||||||
// New creates a new instance of the sharedWorkspaceMongoAccessor
|
// New creates a new instance of the collaborativeAreaMongoAccessor
|
||||||
func New() *sharedWorkspaceMongoAccessor {
|
func New() *collaborativeAreaMongoAccessor {
|
||||||
return &sharedWorkspaceMongoAccessor{}
|
return &collaborativeAreaMongoAccessor{}
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeleteOne deletes a shared workspace from the database, given its ID, it automatically share to peers if the workspace is shared
|
// DeleteOne deletes a collaborative area from the database, given its ID, it automatically share to peers if the workspace is shared
|
||||||
func (wfa *sharedWorkspaceMongoAccessor) DeleteOne(id string) (utils.DBObject, int, error) {
|
func (wfa *collaborativeAreaMongoAccessor) DeleteOne(id string) (utils.DBObject, int, error) {
|
||||||
set, code, _ := wfa.LoadOne(id)
|
set, code, _ := wfa.LoadOne(id)
|
||||||
if code == 200 { // always delete on peers than recreate
|
if code == 200 { // always delete on peers than recreate
|
||||||
wfa.deleteToPeer(set.(*SharedWorkspace))
|
wfa.deleteToPeer(set.(*CollaborativeArea))
|
||||||
}
|
}
|
||||||
wfa.sharedWorkflow(&SharedWorkspace{}, id) // create all shared workflows
|
wfa.sharedWorkflow(&CollaborativeArea{}, id) // create all shared workflows
|
||||||
wfa.sharedWorkspace(&SharedWorkspace{}, id) // create all shared workspaces
|
wfa.sharedWorkspace(&CollaborativeArea{}, id) // create all collaborative areas
|
||||||
return wfa.GenericDeleteOne(id, wfa) // then add on yours
|
return wfa.GenericDeleteOne(id, wfa) // then add on yours
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
sharedWorkspace is a function that shares the shared workspace to the peers
|
sharedWorkspace is a function that shares the collaborative area to the peers
|
||||||
*/
|
*/
|
||||||
func (wfa *sharedWorkspaceMongoAccessor) sharedWorkspace(shared *SharedWorkspace, id string) {
|
func (wfa *collaborativeAreaMongoAccessor) sharedWorkspace(shared *CollaborativeArea, id string) {
|
||||||
eldest, code, _ := wfa.LoadOne(id) // get the eldest
|
eldest, code, _ := wfa.LoadOne(id) // get the eldest
|
||||||
accessor := (&workspace.Workspace{}).GetAccessor(nil)
|
accessor := (&workspace.Workspace{}).GetAccessor(nil)
|
||||||
if code == 200 {
|
if code == 200 {
|
||||||
eld := eldest.(*SharedWorkspace)
|
eld := eldest.(*CollaborativeArea)
|
||||||
if eld.Workspaces != nil { // update all your workspaces in the eldest by replacing shared ref by an empty string
|
if eld.Workspaces != nil { // update all your workspaces in the eldest by replacing shared ref by an empty string
|
||||||
for _, v := range eld.Workspaces {
|
for _, v := range eld.Workspaces {
|
||||||
accessor.UpdateOne(&workspace.Workspace{Shared: ""}, v)
|
accessor.UpdateOne(&workspace.Workspace{Shared: ""}, v)
|
||||||
if wfa.Caller != nil || wfa.Caller.URLS == nil || wfa.Caller.URLS[utils.WORKSPACE.String()] == nil {
|
if wfa.Caller != nil || wfa.Caller.URLS == nil || wfa.Caller.URLS[tools.WORKSPACE] == nil {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
paccess := (&peer.Peer{}) // send to all peers
|
paccess := (&peer.Peer{}) // send to all peers
|
||||||
for _, p := range shared.Peers { // delete the shared workspace on the peer
|
for _, p := range shared.Peers { // delete the collaborative area on the peer
|
||||||
b, err := paccess.LaunchPeerExecution(p, v, utils.WORKSPACE, tools.DELETE, nil, wfa.Caller)
|
b, err := paccess.LaunchPeerExecution(p, v, tools.WORKSPACE, tools.DELETE, nil, wfa.Caller)
|
||||||
if err != nil && b == nil {
|
if err != nil && b == nil {
|
||||||
wfa.Logger.Error().Msg("Could not send to peer " + p + ". Error: " + err.Error())
|
wfa.Logger.Error().Msg("Could not send to peer " + p + ". Error: " + err.Error())
|
||||||
}
|
}
|
||||||
@@ -61,19 +61,19 @@ func (wfa *sharedWorkspaceMongoAccessor) sharedWorkspace(shared *SharedWorkspace
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if shared.Workspaces != nil {
|
if shared.Workspaces != nil {
|
||||||
for _, v := range shared.Workspaces { // update all the shared workspaces
|
for _, v := range shared.Workspaces { // update all the collaborative areas
|
||||||
workspace, code, _ := accessor.UpdateOne(&workspace.Workspace{Shared: shared.UUID}, v) // add the shared ref to workspace
|
workspace, code, _ := accessor.UpdateOne(&workspace.Workspace{Shared: shared.UUID}, v) // add the shared ref to workspace
|
||||||
if wfa.Caller != nil || wfa.Caller.URLS == nil || wfa.Caller.URLS[utils.WORKSPACE.String()] == nil {
|
if wfa.Caller != nil || wfa.Caller.URLS == nil || wfa.Caller.URLS[tools.WORKSPACE] == nil {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
for _, p := range shared.Peers {
|
for _, p := range shared.Peers {
|
||||||
if code != 200 {
|
if code != 200 {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
paccess := (&peer.Peer{}) // send to all peers, add the shared workspace on the peer
|
paccess := (&peer.Peer{}) // send to all peers, add the collaborative area on the peer
|
||||||
s := workspace.Serialize()
|
s := workspace.Serialize()
|
||||||
s["name"] = fmt.Sprintf("%v", s["name"]) + "_" + p
|
s["name"] = fmt.Sprintf("%v", s["name"]) + "_" + p
|
||||||
b, err := paccess.LaunchPeerExecution(p, v, utils.WORKSPACE, tools.POST, s, wfa.Caller)
|
b, err := paccess.LaunchPeerExecution(p, v, tools.WORKSPACE, tools.POST, s, wfa.Caller)
|
||||||
if err != nil && b == nil {
|
if err != nil && b == nil {
|
||||||
wfa.Logger.Error().Msg("Could not send to peer " + p + ". Error: " + err.Error())
|
wfa.Logger.Error().Msg("Could not send to peer " + p + ". Error: " + err.Error())
|
||||||
}
|
}
|
||||||
@@ -81,15 +81,15 @@ func (wfa *sharedWorkspaceMongoAccessor) sharedWorkspace(shared *SharedWorkspace
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// deleting on peers before adding, to avoid conflicts on peers side
|
// deleting on peers before adding, to avoid conflicts on peers side
|
||||||
// because you have no reference to the remote shared workspace
|
// because you have no reference to the remote collaborative area
|
||||||
}
|
}
|
||||||
|
|
||||||
// sharedWorkflow is a function that shares the shared workflow to the peers
|
// sharedWorkflow is a function that shares the shared workflow to the peers
|
||||||
func (wfa *sharedWorkspaceMongoAccessor) sharedWorkflow(shared *SharedWorkspace, id string) {
|
func (wfa *collaborativeAreaMongoAccessor) sharedWorkflow(shared *CollaborativeArea, id string) {
|
||||||
accessor := (&w.Workflow{}).GetAccessor(nil)
|
accessor := (&w.Workflow{}).GetAccessor(nil)
|
||||||
eldest, code, _ := wfa.LoadOne(id) // get the eldest
|
eldest, code, _ := wfa.LoadOne(id) // get the eldest
|
||||||
if code == 200 {
|
if code == 200 {
|
||||||
eld := eldest.(*SharedWorkspace)
|
eld := eldest.(*CollaborativeArea)
|
||||||
if eld.Workflows != nil {
|
if eld.Workflows != nil {
|
||||||
for _, v := range eld.Workflows {
|
for _, v := range eld.Workflows {
|
||||||
data, code, _ := accessor.LoadOne(v)
|
data, code, _ := accessor.LoadOne(v)
|
||||||
@@ -104,12 +104,12 @@ func (wfa *sharedWorkspaceMongoAccessor) sharedWorkflow(shared *SharedWorkspace,
|
|||||||
n := &w.Workflow{}
|
n := &w.Workflow{}
|
||||||
n.Shared = new
|
n.Shared = new
|
||||||
accessor.UpdateOne(n, v)
|
accessor.UpdateOne(n, v)
|
||||||
if wfa.Caller != nil || wfa.Caller.URLS == nil || wfa.Caller.URLS[utils.WORKFLOW.String()] == nil {
|
if wfa.Caller != nil || wfa.Caller.URLS == nil || wfa.Caller.URLS[tools.WORKFLOW] == nil {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
paccess := (&peer.Peer{}) // send to all peers
|
paccess := (&peer.Peer{}) // send to all peers
|
||||||
for _, p := range shared.Peers { // delete the shared workflow on the peer
|
for _, p := range shared.Peers { // delete the shared workflow on the peer
|
||||||
b, err := paccess.LaunchPeerExecution(p, v, utils.WORKFLOW, tools.DELETE, nil, wfa.Caller)
|
b, err := paccess.LaunchPeerExecution(p, v, tools.WORKFLOW, tools.DELETE, nil, wfa.Caller)
|
||||||
if err != nil && b == nil {
|
if err != nil && b == nil {
|
||||||
wfa.Logger.Error().Msg("Could not send to peer " + p + ". Error: " + err.Error())
|
wfa.Logger.Error().Msg("Could not send to peer " + p + ". Error: " + err.Error())
|
||||||
}
|
}
|
||||||
@@ -126,7 +126,7 @@ func (wfa *sharedWorkspaceMongoAccessor) sharedWorkflow(shared *SharedWorkspace,
|
|||||||
if !slices.Contains(s.Shared, id) {
|
if !slices.Contains(s.Shared, id) {
|
||||||
s.Shared = append(s.Shared, id)
|
s.Shared = append(s.Shared, id)
|
||||||
workflow, code, _ := accessor.UpdateOne(s, v)
|
workflow, code, _ := accessor.UpdateOne(s, v)
|
||||||
if wfa.Caller != nil || wfa.Caller.URLS == nil || wfa.Caller.URLS[utils.WORKFLOW.String()] == nil {
|
if wfa.Caller != nil || wfa.Caller.URLS == nil || wfa.Caller.URLS[tools.WORKFLOW] == nil {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
paccess := (&peer.Peer{})
|
paccess := (&peer.Peer{})
|
||||||
@@ -134,7 +134,7 @@ func (wfa *sharedWorkspaceMongoAccessor) sharedWorkflow(shared *SharedWorkspace,
|
|||||||
if code == 200 {
|
if code == 200 {
|
||||||
s := workflow.Serialize() // add the shared workflow on the peer
|
s := workflow.Serialize() // add the shared workflow on the peer
|
||||||
s["name"] = fmt.Sprintf("%v", s["name"]) + "_" + p
|
s["name"] = fmt.Sprintf("%v", s["name"]) + "_" + p
|
||||||
b, err := paccess.LaunchPeerExecution(p, shared.UUID, utils.WORKFLOW, tools.POST, s, wfa.Caller)
|
b, err := paccess.LaunchPeerExecution(p, shared.UUID, tools.WORKFLOW, tools.POST, s, wfa.Caller)
|
||||||
if err != nil && b == nil {
|
if err != nil && b == nil {
|
||||||
wfa.Logger.Error().Msg("Could not send to peer " + p + ". Error: " + err.Error())
|
wfa.Logger.Error().Msg("Could not send to peer " + p + ". Error: " + err.Error())
|
||||||
}
|
}
|
||||||
@@ -148,9 +148,9 @@ func (wfa *sharedWorkspaceMongoAccessor) sharedWorkflow(shared *SharedWorkspace,
|
|||||||
// because you have no reference to the remote shared workflow
|
// because you have no reference to the remote shared workflow
|
||||||
}
|
}
|
||||||
|
|
||||||
// sharedWorkspace is a function that shares the shared workspace to the peers
|
// sharedWorkspace is a function that shares the collaborative area to the peers
|
||||||
func (wfa *sharedWorkspaceMongoAccessor) deleteToPeer(shared *SharedWorkspace) {
|
func (wfa *collaborativeAreaMongoAccessor) deleteToPeer(shared *CollaborativeArea) {
|
||||||
if wfa.Caller == nil || wfa.Caller.URLS == nil || wfa.Caller.URLS[utils.SHARED_WORKSPACE.String()] == nil {
|
if wfa.Caller == nil || wfa.Caller.URLS == nil || wfa.Caller.URLS[tools.COLLABORATIVE_AREA] == nil || wfa.Caller.Disabled {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
paccess := (&peer.Peer{})
|
paccess := (&peer.Peer{})
|
||||||
@@ -158,16 +158,16 @@ func (wfa *sharedWorkspaceMongoAccessor) deleteToPeer(shared *SharedWorkspace) {
|
|||||||
if (&peer.Peer{AbstractObject: utils.AbstractObject{UUID: v}}).IsMySelf() {
|
if (&peer.Peer{AbstractObject: utils.AbstractObject{UUID: v}}).IsMySelf() {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
b, err := paccess.LaunchPeerExecution(v, shared.UUID, utils.SHARED_WORKSPACE, tools.DELETE, nil, wfa.Caller)
|
b, err := paccess.LaunchPeerExecution(v, shared.UUID, tools.COLLABORATIVE_AREA, tools.DELETE, nil, wfa.Caller)
|
||||||
if err != nil && b == nil {
|
if err != nil && b == nil {
|
||||||
wfa.Logger.Error().Msg("Could not send to peer " + v + ". Error: " + err.Error())
|
wfa.Logger.Error().Msg("Could not send to peer " + v + ". Error: " + err.Error())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// sharedWorkspace is a function that shares the shared workspace to the peers
|
// sharedWorkspace is a function that shares the collaborative area to the peers
|
||||||
func (wfa *sharedWorkspaceMongoAccessor) sendToPeer(shared *SharedWorkspace) {
|
func (wfa *collaborativeAreaMongoAccessor) sendToPeer(shared *CollaborativeArea) {
|
||||||
if wfa.Caller == nil || wfa.Caller.URLS == nil || wfa.Caller.URLS[utils.SHARED_WORKSPACE.String()] == nil {
|
if wfa.Caller == nil || wfa.Caller.URLS == nil || wfa.Caller.URLS[tools.COLLABORATIVE_AREA] == nil || wfa.Caller.Disabled {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -177,56 +177,56 @@ func (wfa *sharedWorkspaceMongoAccessor) sendToPeer(shared *SharedWorkspace) {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
shared.IsSent = true
|
shared.IsSent = true
|
||||||
b, err := paccess.LaunchPeerExecution(v, v, utils.SHARED_WORKSPACE, tools.POST, shared.Serialize(), wfa.Caller)
|
b, err := paccess.LaunchPeerExecution(v, v, tools.COLLABORATIVE_AREA, tools.POST, shared.Serialize(), wfa.Caller)
|
||||||
if err != nil && b == nil {
|
if err != nil && b == nil {
|
||||||
wfa.Logger.Error().Msg("Could not send to peer " + v + ". Error: " + err.Error())
|
wfa.Logger.Error().Msg("Could not send to peer " + v + ". Error: " + err.Error())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// UpdateOne updates a shared workspace in the database, given its ID and the new data, it automatically share to peers if the workspace is shared
|
// UpdateOne updates a collaborative area in the database, given its ID and the new data, it automatically share to peers if the workspace is shared
|
||||||
func (wfa *sharedWorkspaceMongoAccessor) UpdateOne(set utils.DBObject, id string) (utils.DBObject, int, error) {
|
func (wfa *collaborativeAreaMongoAccessor) UpdateOne(set utils.DBObject, id string) (utils.DBObject, int, error) {
|
||||||
res, code, err := wfa.GenericUpdateOne(set.(*SharedWorkspace), id, wfa, &SharedWorkspace{})
|
res, code, err := wfa.GenericUpdateOne(set.(*CollaborativeArea), id, wfa, &CollaborativeArea{})
|
||||||
wfa.deleteToPeer(res.(*SharedWorkspace)) // delete the shared workspace on the peer
|
wfa.deleteToPeer(res.(*CollaborativeArea)) // delete the collaborative area on the peer
|
||||||
wfa.sharedWorkflow(res.(*SharedWorkspace), id) // replace all shared workflows
|
wfa.sharedWorkflow(res.(*CollaborativeArea), id) // replace all shared workflows
|
||||||
wfa.sharedWorkspace(res.(*SharedWorkspace), id) // replace all shared workspaces (not shared worspace obj but workspace one)
|
wfa.sharedWorkspace(res.(*CollaborativeArea), id) // replace all collaborative areas (not shared worspace obj but workspace one)
|
||||||
wfa.sendToPeer(res.(*SharedWorkspace)) // send the shared workspace (shared workspace object) to the peers
|
wfa.sendToPeer(res.(*CollaborativeArea)) // send the collaborative area (collaborative area object) to the peers
|
||||||
return res, code, err
|
return res, code, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// StoreOne stores a shared workspace in the database, it automatically share to peers if the workspace is shared
|
// StoreOne stores a collaborative area in the database, it automatically share to peers if the workspace is shared
|
||||||
func (wfa *sharedWorkspaceMongoAccessor) StoreOne(data utils.DBObject) (utils.DBObject, int, error) {
|
func (wfa *collaborativeAreaMongoAccessor) StoreOne(data utils.DBObject) (utils.DBObject, int, error) {
|
||||||
id, _ := static.GetMyLocalJsonPeer() // get the local peer
|
id, _ := static.GetMyLocalJsonPeer() // get the local peer
|
||||||
data.(*SharedWorkspace).CreatorID = id // set the creator id
|
data.(*CollaborativeArea).CreatorID = id // set the creator id
|
||||||
data.(*SharedWorkspace).Peers = append(data.(*SharedWorkspace).Peers, id) // add the creator id to the peers
|
data.(*CollaborativeArea).Peers = append(data.(*CollaborativeArea).Peers, id) // add the creator id to the peers
|
||||||
// then reset the shared fields
|
// then reset the shared fields
|
||||||
if data.(*SharedWorkspace).Workspaces == nil {
|
if data.(*CollaborativeArea).Workspaces == nil {
|
||||||
data.(*SharedWorkspace).Workspaces = []string{}
|
data.(*CollaborativeArea).Workspaces = []string{}
|
||||||
}
|
}
|
||||||
if data.(*SharedWorkspace).Workflows == nil {
|
if data.(*CollaborativeArea).Workflows == nil {
|
||||||
data.(*SharedWorkspace).Workflows = []string{}
|
data.(*CollaborativeArea).Workflows = []string{}
|
||||||
}
|
}
|
||||||
if data.(*SharedWorkspace).Rules == nil {
|
if data.(*CollaborativeArea).Rules == nil {
|
||||||
data.(*SharedWorkspace).Rules = []string{}
|
data.(*CollaborativeArea).Rules = []string{}
|
||||||
}
|
}
|
||||||
|
|
||||||
d, code, err := wfa.GenericStoreOne(data.(*SharedWorkspace), wfa)
|
d, code, err := wfa.GenericStoreOne(data.(*CollaborativeArea), wfa)
|
||||||
|
|
||||||
if code == 200 {
|
if code == 200 {
|
||||||
wfa.sharedWorkflow(d.(*SharedWorkspace), d.GetID()) // create all shared workflows
|
wfa.sharedWorkflow(d.(*CollaborativeArea), d.GetID()) // create all shared workflows
|
||||||
wfa.sharedWorkspace(d.(*SharedWorkspace), d.GetID()) // create all shared workspaces
|
wfa.sharedWorkspace(d.(*CollaborativeArea), d.GetID()) // create all collaborative areas
|
||||||
wfa.sendToPeer(d.(*SharedWorkspace)) // send the shared workspace (shared workspace object) to the peers
|
wfa.sendToPeer(d.(*CollaborativeArea)) // send the collaborative area (collaborative area object) to the peers
|
||||||
}
|
}
|
||||||
return data, code, err
|
return data, code, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// CopyOne copies a shared workspace in the database
|
// CopyOne copies a CollaborativeArea in the database
|
||||||
func (wfa *sharedWorkspaceMongoAccessor) CopyOne(data utils.DBObject) (utils.DBObject, int, error) {
|
func (wfa *collaborativeAreaMongoAccessor) CopyOne(data utils.DBObject) (utils.DBObject, int, error) {
|
||||||
return wfa.StoreOne(data)
|
return wfa.StoreOne(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
// enrich is a function that enriches the shared workspace with the shared objects
|
// enrich is a function that enriches the CollaborativeArea with the shared objects
|
||||||
func (wfa *sharedWorkspaceMongoAccessor) enrich(sharedWorkspace *SharedWorkspace) *SharedWorkspace {
|
func (wfa *collaborativeAreaMongoAccessor) enrich(sharedWorkspace *CollaborativeArea) *CollaborativeArea {
|
||||||
access := (&workspace.Workspace{}).GetAccessor(nil)
|
access := (&workspace.Workspace{}).GetAccessor(nil)
|
||||||
res, code, _ := access.Search(&dbs.Filters{
|
res, code, _ := access.Search(&dbs.Filters{
|
||||||
Or: map[string][]dbs.Filter{
|
Or: map[string][]dbs.Filter{
|
||||||
@@ -274,38 +274,38 @@ func (wfa *sharedWorkspaceMongoAccessor) enrich(sharedWorkspace *SharedWorkspace
|
|||||||
return sharedWorkspace
|
return sharedWorkspace
|
||||||
}
|
}
|
||||||
|
|
||||||
// LoadOne loads a shared workspace from the database, given its ID and enrich it
|
// LoadOne loads a collaborative area from the database, given its ID and enrich it
|
||||||
func (wfa *sharedWorkspaceMongoAccessor) LoadOne(id string) (utils.DBObject, int, error) {
|
func (wfa *collaborativeAreaMongoAccessor) LoadOne(id string) (utils.DBObject, int, error) {
|
||||||
var sharedWorkspace SharedWorkspace
|
var sharedWorkspace CollaborativeArea
|
||||||
res_mongo, code, err := mongo.MONGOService.LoadOne(id, wfa.GetType())
|
res_mongo, code, err := mongo.MONGOService.LoadOne(id, wfa.GetType())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
wfa.Logger.Error().Msg("Could not retrieve " + id + " from db. Error: " + err.Error())
|
wfa.Logger.Error().Msg("Could not retrieve " + id + " from db. Error: " + err.Error())
|
||||||
return nil, code, err
|
return nil, code, err
|
||||||
}
|
}
|
||||||
res_mongo.Decode(&sharedWorkspace)
|
res_mongo.Decode(&sharedWorkspace)
|
||||||
return wfa.enrich(&sharedWorkspace), 200, nil // enrich the shared workspace
|
return wfa.enrich(&sharedWorkspace), 200, nil // enrich the collaborative area
|
||||||
}
|
}
|
||||||
|
|
||||||
// LoadAll loads all the shared workspaces from the database and enrich them
|
// LoadAll loads all the collaborative areas from the database and enrich them
|
||||||
func (wfa sharedWorkspaceMongoAccessor) LoadAll() ([]utils.ShallowDBObject, int, error) {
|
func (wfa collaborativeAreaMongoAccessor) LoadAll() ([]utils.ShallowDBObject, int, error) {
|
||||||
objs := []utils.ShallowDBObject{}
|
objs := []utils.ShallowDBObject{}
|
||||||
res_mongo, code, err := mongo.MONGOService.LoadAll(wfa.GetType())
|
res_mongo, code, err := mongo.MONGOService.LoadAll(wfa.GetType())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
wfa.Logger.Error().Msg("Could not retrieve any from db. Error: " + err.Error())
|
wfa.Logger.Error().Msg("Could not retrieve any from db. Error: " + err.Error())
|
||||||
return nil, code, err
|
return nil, code, err
|
||||||
}
|
}
|
||||||
var results []SharedWorkspace
|
var results []CollaborativeArea
|
||||||
if err = res_mongo.All(mongo.MngoCtx, &results); err != nil {
|
if err = res_mongo.All(mongo.MngoCtx, &results); err != nil {
|
||||||
return nil, 404, err
|
return nil, 404, err
|
||||||
}
|
}
|
||||||
for _, r := range results {
|
for _, r := range results {
|
||||||
objs = append(objs, wfa.enrich(&r)) // enrich the shared workspace
|
objs = append(objs, wfa.enrich(&r)) // enrich the collaborative area
|
||||||
}
|
}
|
||||||
return objs, 200, nil
|
return objs, 200, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Search searches for shared workspaces in the database, given some filters OR a search string
|
// Search searches for collaborative areas in the database, given some filters OR a search string
|
||||||
func (wfa *sharedWorkspaceMongoAccessor) Search(filters *dbs.Filters, search string) ([]utils.ShallowDBObject, int, error) {
|
func (wfa *collaborativeAreaMongoAccessor) Search(filters *dbs.Filters, search string) ([]utils.ShallowDBObject, int, error) {
|
||||||
objs := []utils.ShallowDBObject{}
|
objs := []utils.ShallowDBObject{}
|
||||||
if (filters == nil || len(filters.And) == 0 || len(filters.Or) == 0) && search != "" {
|
if (filters == nil || len(filters.And) == 0 || len(filters.Or) == 0) && search != "" {
|
||||||
filters = &dbs.Filters{
|
filters = &dbs.Filters{
|
||||||
@@ -319,12 +319,12 @@ func (wfa *sharedWorkspaceMongoAccessor) Search(filters *dbs.Filters, search str
|
|||||||
wfa.Logger.Error().Msg("Could not store to db. Error: " + err.Error())
|
wfa.Logger.Error().Msg("Could not store to db. Error: " + err.Error())
|
||||||
return nil, code, err
|
return nil, code, err
|
||||||
}
|
}
|
||||||
var results []SharedWorkspace
|
var results []CollaborativeArea
|
||||||
if err = res_mongo.All(mongo.MngoCtx, &results); err != nil {
|
if err = res_mongo.All(mongo.MngoCtx, &results); err != nil {
|
||||||
return nil, 404, err
|
return nil, 404, err
|
||||||
}
|
}
|
||||||
for _, r := range results {
|
for _, r := range results {
|
||||||
objs = append(objs, wfa.enrich(&r)) // enrich the shared workspace
|
objs = append(objs, wfa.enrich(&r)) // enrich the collaborative area
|
||||||
}
|
}
|
||||||
return objs, 200, nil
|
return objs, 200, nil
|
||||||
}
|
}
|
||||||
@@ -32,7 +32,7 @@ func (d *Rule) GetName() string {
|
|||||||
|
|
||||||
func (d *Rule) GetAccessor(caller *tools.HTTPCaller) utils.Accessor {
|
func (d *Rule) GetAccessor(caller *tools.HTTPCaller) utils.Accessor {
|
||||||
data := New()
|
data := New()
|
||||||
data.Init(utils.RULE, caller)
|
data.Init(tools.RULE, caller)
|
||||||
return data
|
return data
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package shallow_shared_workspace
|
package shallow_collaborative_area
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
@@ -8,7 +8,7 @@ import (
|
|||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
)
|
)
|
||||||
|
|
||||||
type ShallowSharedWorkspace struct {
|
type ShallowCollaborativeArea struct {
|
||||||
utils.AbstractObject
|
utils.AbstractObject
|
||||||
IsSent bool `json:"is_sent" bson:"-"`
|
IsSent bool `json:"is_sent" bson:"-"`
|
||||||
CreatorID string `json:"peer_id,omitempty" bson:"peer_id,omitempty" validate:"required"`
|
CreatorID string `json:"peer_id,omitempty" bson:"peer_id,omitempty" validate:"required"`
|
||||||
@@ -21,27 +21,27 @@ type ShallowSharedWorkspace struct {
|
|||||||
Rules []string `json:"rules,omitempty" bson:"rules,omitempty"`
|
Rules []string `json:"rules,omitempty" bson:"rules,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ao *ShallowSharedWorkspace) GetID() string {
|
func (ao *ShallowCollaborativeArea) GetID() string {
|
||||||
return ao.UUID
|
return ao.UUID
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *ShallowSharedWorkspace) GenerateID() {
|
func (r *ShallowCollaborativeArea) GenerateID() {
|
||||||
if r.UUID == "" {
|
if r.UUID == "" {
|
||||||
r.UUID = uuid.New().String()
|
r.UUID = uuid.New().String()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *ShallowSharedWorkspace) GetName() string {
|
func (d *ShallowCollaborativeArea) GetName() string {
|
||||||
return d.Name
|
return d.Name
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *ShallowSharedWorkspace) GetAccessor(caller *tools.HTTPCaller) utils.Accessor {
|
func (d *ShallowCollaborativeArea) GetAccessor(caller *tools.HTTPCaller) utils.Accessor {
|
||||||
data := New()
|
data := New()
|
||||||
data.Init(utils.SHARED_WORKSPACE, caller)
|
data.Init(tools.COLLABORATIVE_AREA, caller)
|
||||||
return data
|
return data
|
||||||
}
|
}
|
||||||
|
|
||||||
func (dma *ShallowSharedWorkspace) Deserialize(j map[string]interface{}) utils.DBObject {
|
func (dma *ShallowCollaborativeArea) Deserialize(j map[string]interface{}) utils.DBObject {
|
||||||
b, err := json.Marshal(j)
|
b, err := json.Marshal(j)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil
|
return nil
|
||||||
@@ -50,7 +50,7 @@ func (dma *ShallowSharedWorkspace) Deserialize(j map[string]interface{}) utils.D
|
|||||||
return dma
|
return dma
|
||||||
}
|
}
|
||||||
|
|
||||||
func (dma *ShallowSharedWorkspace) Serialize() map[string]interface{} {
|
func (dma *ShallowCollaborativeArea) Serialize() map[string]interface{} {
|
||||||
var m map[string]interface{}
|
var m map[string]interface{}
|
||||||
b, err := json.Marshal(dma)
|
b, err := json.Marshal(dma)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package shallow_shared_workspace
|
package shallow_collaborative_area
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"cloud.o-forge.io/core/oc-lib/dbs"
|
"cloud.o-forge.io/core/oc-lib/dbs"
|
||||||
@@ -19,11 +19,11 @@ func (wfa *shallowSharedWorkspaceMongoAccessor) DeleteOne(id string) (utils.DBOb
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (wfa *shallowSharedWorkspaceMongoAccessor) UpdateOne(set utils.DBObject, id string) (utils.DBObject, int, error) {
|
func (wfa *shallowSharedWorkspaceMongoAccessor) UpdateOne(set utils.DBObject, id string) (utils.DBObject, int, error) {
|
||||||
return wfa.GenericUpdateOne(set.(*ShallowSharedWorkspace), id, wfa, &ShallowSharedWorkspace{})
|
return wfa.GenericUpdateOne(set.(*ShallowCollaborativeArea), id, wfa, &ShallowCollaborativeArea{})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (wfa *shallowSharedWorkspaceMongoAccessor) StoreOne(data utils.DBObject) (utils.DBObject, int, error) {
|
func (wfa *shallowSharedWorkspaceMongoAccessor) StoreOne(data utils.DBObject) (utils.DBObject, int, error) {
|
||||||
return wfa.GenericStoreOne(data.(*ShallowSharedWorkspace), wfa)
|
return wfa.GenericStoreOne(data.(*ShallowCollaborativeArea), wfa)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (wfa *shallowSharedWorkspaceMongoAccessor) CopyOne(data utils.DBObject) (utils.DBObject, int, error) {
|
func (wfa *shallowSharedWorkspaceMongoAccessor) CopyOne(data utils.DBObject) (utils.DBObject, int, error) {
|
||||||
@@ -31,7 +31,7 @@ func (wfa *shallowSharedWorkspaceMongoAccessor) CopyOne(data utils.DBObject) (ut
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (wfa *shallowSharedWorkspaceMongoAccessor) LoadOne(id string) (utils.DBObject, int, error) {
|
func (wfa *shallowSharedWorkspaceMongoAccessor) LoadOne(id string) (utils.DBObject, int, error) {
|
||||||
var sharedWorkspace ShallowSharedWorkspace
|
var sharedWorkspace ShallowCollaborativeArea
|
||||||
res_mongo, code, err := mongo.MONGOService.LoadOne(id, wfa.GetType())
|
res_mongo, code, err := mongo.MONGOService.LoadOne(id, wfa.GetType())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
wfa.Logger.Error().Msg("Could not retrieve " + id + " from db. Error: " + err.Error())
|
wfa.Logger.Error().Msg("Could not retrieve " + id + " from db. Error: " + err.Error())
|
||||||
@@ -48,7 +48,7 @@ func (wfa shallowSharedWorkspaceMongoAccessor) LoadAll() ([]utils.ShallowDBObjec
|
|||||||
wfa.Logger.Error().Msg("Could not retrieve any from db. Error: " + err.Error())
|
wfa.Logger.Error().Msg("Could not retrieve any from db. Error: " + err.Error())
|
||||||
return nil, code, err
|
return nil, code, err
|
||||||
}
|
}
|
||||||
var results []ShallowSharedWorkspace
|
var results []ShallowCollaborativeArea
|
||||||
if err = res_mongo.All(mongo.MngoCtx, &results); err != nil {
|
if err = res_mongo.All(mongo.MngoCtx, &results); err != nil {
|
||||||
return nil, 404, err
|
return nil, 404, err
|
||||||
}
|
}
|
||||||
@@ -72,7 +72,7 @@ func (wfa *shallowSharedWorkspaceMongoAccessor) Search(filters *dbs.Filters, sea
|
|||||||
wfa.Logger.Error().Msg("Could not store to db. Error: " + err.Error())
|
wfa.Logger.Error().Msg("Could not store to db. Error: " + err.Error())
|
||||||
return nil, code, err
|
return nil, code, err
|
||||||
}
|
}
|
||||||
var results []ShallowSharedWorkspace
|
var results []ShallowCollaborativeArea
|
||||||
if err = res_mongo.All(mongo.MngoCtx, &results); err != nil {
|
if err = res_mongo.All(mongo.MngoCtx, &results); err != nil {
|
||||||
return nil, 404, err
|
return nil, 404, err
|
||||||
}
|
}
|
||||||
@@ -2,12 +2,14 @@ package models
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"cloud.o-forge.io/core/oc-lib/logs"
|
"cloud.o-forge.io/core/oc-lib/logs"
|
||||||
|
"cloud.o-forge.io/core/oc-lib/tools"
|
||||||
|
|
||||||
"cloud.o-forge.io/core/oc-lib/models/booking"
|
"cloud.o-forge.io/core/oc-lib/models/booking"
|
||||||
|
"cloud.o-forge.io/core/oc-lib/models/collaborative_area"
|
||||||
|
"cloud.o-forge.io/core/oc-lib/models/collaborative_area/rules/rule"
|
||||||
"cloud.o-forge.io/core/oc-lib/models/peer"
|
"cloud.o-forge.io/core/oc-lib/models/peer"
|
||||||
"cloud.o-forge.io/core/oc-lib/models/resource_model"
|
"cloud.o-forge.io/core/oc-lib/models/resource_model"
|
||||||
d "cloud.o-forge.io/core/oc-lib/models/resources/data"
|
d "cloud.o-forge.io/core/oc-lib/models/resources/data"
|
||||||
dc "cloud.o-forge.io/core/oc-lib/models/resources/datacenter"
|
|
||||||
p "cloud.o-forge.io/core/oc-lib/models/resources/processing"
|
p "cloud.o-forge.io/core/oc-lib/models/resources/processing"
|
||||||
s "cloud.o-forge.io/core/oc-lib/models/resources/storage"
|
s "cloud.o-forge.io/core/oc-lib/models/resources/storage"
|
||||||
w "cloud.o-forge.io/core/oc-lib/models/resources/workflow"
|
w "cloud.o-forge.io/core/oc-lib/models/resources/workflow"
|
||||||
@@ -15,8 +17,6 @@ import (
|
|||||||
w2 "cloud.o-forge.io/core/oc-lib/models/workflow"
|
w2 "cloud.o-forge.io/core/oc-lib/models/workflow"
|
||||||
"cloud.o-forge.io/core/oc-lib/models/workflow_execution"
|
"cloud.o-forge.io/core/oc-lib/models/workflow_execution"
|
||||||
w3 "cloud.o-forge.io/core/oc-lib/models/workspace"
|
w3 "cloud.o-forge.io/core/oc-lib/models/workspace"
|
||||||
shared_workspace "cloud.o-forge.io/core/oc-lib/models/workspace/shared"
|
|
||||||
"cloud.o-forge.io/core/oc-lib/models/workspace/shared/rules/rule"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -24,28 +24,27 @@ This package contains the models used in the application
|
|||||||
It's used to create the models dynamically
|
It's used to create the models dynamically
|
||||||
*/
|
*/
|
||||||
var models = map[string]func() utils.DBObject{
|
var models = map[string]func() utils.DBObject{
|
||||||
utils.WORKFLOW_RESOURCE.String(): func() utils.DBObject { return &w.WorkflowResource{} },
|
tools.WORKFLOW_RESOURCE.String(): func() utils.DBObject { return &w.WorkflowResource{} },
|
||||||
utils.DATA_RESOURCE.String(): func() utils.DBObject { return &d.DataResource{} },
|
tools.DATA_RESOURCE.String(): func() utils.DBObject { return &d.DataResource{} },
|
||||||
utils.DATACENTER_RESOURCE.String(): func() utils.DBObject { return &dc.DatacenterResource{} },
|
tools.STORAGE_RESOURCE.String(): func() utils.DBObject { return &s.StorageResource{} },
|
||||||
utils.STORAGE_RESOURCE.String(): func() utils.DBObject { return &s.StorageResource{} },
|
tools.PROCESSING_RESOURCE.String(): func() utils.DBObject { return &p.ProcessingResource{} },
|
||||||
utils.PROCESSING_RESOURCE.String(): func() utils.DBObject { return &p.ProcessingResource{} },
|
tools.WORKFLOW.String(): func() utils.DBObject { return &w2.Workflow{} },
|
||||||
utils.WORKFLOW.String(): func() utils.DBObject { return &w2.Workflow{} },
|
tools.WORKFLOW_EXECUTION.String(): func() utils.DBObject { return &workflow_execution.WorkflowExecution{} },
|
||||||
utils.WORKFLOW_EXECUTION.String(): func() utils.DBObject { return &workflow_execution.WorkflowExecution{} },
|
tools.WORKSPACE.String(): func() utils.DBObject { return &w3.Workspace{} },
|
||||||
utils.WORKSPACE.String(): func() utils.DBObject { return &w3.Workspace{} },
|
tools.RESOURCE_MODEL.String(): func() utils.DBObject { return &resource_model.ResourceModel{} },
|
||||||
utils.RESOURCE_MODEL.String(): func() utils.DBObject { return &resource_model.ResourceModel{} },
|
tools.PEER.String(): func() utils.DBObject { return &peer.Peer{} },
|
||||||
utils.PEER.String(): func() utils.DBObject { return &peer.Peer{} },
|
tools.COLLABORATIVE_AREA.String(): func() utils.DBObject { return &collaborative_area.CollaborativeArea{} },
|
||||||
utils.SHARED_WORKSPACE.String(): func() utils.DBObject { return &shared_workspace.SharedWorkspace{} },
|
tools.RULE.String(): func() utils.DBObject { return &rule.Rule{} },
|
||||||
utils.RULE.String(): func() utils.DBObject { return &rule.Rule{} },
|
tools.BOOKING.String(): func() utils.DBObject { return &booking.Booking{} },
|
||||||
utils.BOOKING.String(): func() utils.DBObject { return &booking.Booking{} },
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Model returns the model object based on the model type
|
// Model returns the model object based on the model type
|
||||||
func Model(model int) utils.DBObject {
|
func Model(model int) utils.DBObject {
|
||||||
log := logs.GetLogger()
|
log := logs.GetLogger()
|
||||||
if _, ok := models[utils.FromInt(model)]; ok {
|
if _, ok := models[tools.FromInt(model)]; ok {
|
||||||
return models[utils.FromInt(model)]()
|
return models[tools.FromInt(model)]()
|
||||||
}
|
}
|
||||||
log.Error().Msg("Can't find model " + utils.FromInt(model) + ".")
|
log.Error().Msg("Can't find model " + tools.FromInt(model) + ".")
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ func (ao *Peer) IsMySelf() bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// LaunchPeerExecution launches an execution on a peer
|
// LaunchPeerExecution launches an execution on a peer
|
||||||
func (p *Peer) LaunchPeerExecution(peerID string, dataID string, dt utils.DataType, method tools.METHOD, body map[string]interface{}, caller *tools.HTTPCaller) (*PeerExecution, error) {
|
func (p *Peer) LaunchPeerExecution(peerID string, dataID string, dt tools.DataType, method tools.METHOD, body map[string]interface{}, caller *tools.HTTPCaller) (*PeerExecution, error) {
|
||||||
p.UUID = peerID
|
p.UUID = peerID
|
||||||
return cache.LaunchPeerExecution(peerID, dataID, dt, method, body, caller) // Launch the execution on the peer through the cache
|
return cache.LaunchPeerExecution(peerID, dataID, dt, method, body, caller) // Launch the execution on the peer through the cache
|
||||||
}
|
}
|
||||||
@@ -70,7 +70,7 @@ func (d *Peer) GetName() string {
|
|||||||
|
|
||||||
func (d *Peer) GetAccessor(caller *tools.HTTPCaller) utils.Accessor {
|
func (d *Peer) GetAccessor(caller *tools.HTTPCaller) utils.Accessor {
|
||||||
data := New() // Create a new instance of the accessor
|
data := New() // Create a new instance of the accessor
|
||||||
data.Init(utils.PEER, caller) // Initialize the accessor with the PEER model type
|
data.Init(tools.PEER, caller) // Initialize the accessor with the PEER model type
|
||||||
return data
|
return data
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import (
|
|||||||
"regexp"
|
"regexp"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"cloud.o-forge.io/core/oc-lib/models/utils"
|
|
||||||
"cloud.o-forge.io/core/oc-lib/tools"
|
"cloud.o-forge.io/core/oc-lib/tools"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -30,18 +29,17 @@ type PeerCache struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// urlFormat formats the URL of the peer with the data type API function
|
// urlFormat formats the URL of the peer with the data type API function
|
||||||
func (p *PeerCache) urlFormat(url string, dt utils.DataType) string {
|
func (p *PeerCache) urlFormat(url string, dt tools.DataType) string {
|
||||||
// localhost is replaced by the local peer URL
|
// localhost is replaced by the local peer URL
|
||||||
// because localhost must collide on a web request security protocol
|
// because localhost must collide on a web request security protocol
|
||||||
if strings.Contains(url, "localhost") || strings.Contains(url, "127.0.0.1") {
|
if strings.Contains(url, "localhost") || strings.Contains(url, "127.0.0.1") {
|
||||||
url = strings.ReplaceAll(url, "localhost", dt.API())
|
|
||||||
url = strings.ReplaceAll(url, "127.0.0.1", dt.API())
|
|
||||||
r := regexp.MustCompile("(:[0-9]+)")
|
r := regexp.MustCompile("(:[0-9]+)")
|
||||||
t := r.FindString(url)
|
t := r.FindString(url)
|
||||||
if t != "" {
|
if t != "" {
|
||||||
url = strings.Replace(url, t, ":8080", -1)
|
url = strings.Replace(url, t, "", -1)
|
||||||
}
|
}
|
||||||
r.ReplaceAllString(url, ":8080")
|
url = strings.ReplaceAll(url, "localhost", dt.API()+":8080")
|
||||||
|
url = strings.ReplaceAll(url, "127.0.0.1", dt.API()+":8080")
|
||||||
}
|
}
|
||||||
return url
|
return url
|
||||||
}
|
}
|
||||||
@@ -54,7 +52,7 @@ func (p *PeerCache) checkPeerStatus(peerID string, appName string, caller *tools
|
|||||||
if code != 200 { // no peer no party
|
if code != 200 { // no peer no party
|
||||||
return nil, false
|
return nil, false
|
||||||
}
|
}
|
||||||
methods := caller.URLS[utils.PEER.String()] // Get the methods url of the peer
|
methods := caller.URLS[tools.PEER] // Get the methods url of the peer
|
||||||
if methods == nil {
|
if methods == nil {
|
||||||
return res.(*Peer), false
|
return res.(*Peer), false
|
||||||
}
|
}
|
||||||
@@ -62,7 +60,7 @@ func (p *PeerCache) checkPeerStatus(peerID string, appName string, caller *tools
|
|||||||
if meth == "" {
|
if meth == "" {
|
||||||
return res.(*Peer), false
|
return res.(*Peer), false
|
||||||
}
|
}
|
||||||
url := p.urlFormat(res.(*Peer).Url+meth, utils.PEER) // Format the URL
|
url := p.urlFormat(res.(*Peer).Url+meth, tools.PEER) // Format the URL
|
||||||
state, services := api.CheckRemotePeer(url) // Check the status of the peer
|
state, services := api.CheckRemotePeer(url) // Check the status of the peer
|
||||||
res.(*Peer).Services = services // Update the services states of the peer
|
res.(*Peer).Services = services // Update the services states of the peer
|
||||||
access.UpdateOne(res, peerID) // Update the peer in the db
|
access.UpdateOne(res, peerID) // Update the peer in the db
|
||||||
@@ -71,8 +69,8 @@ func (p *PeerCache) checkPeerStatus(peerID string, appName string, caller *tools
|
|||||||
|
|
||||||
// LaunchPeerExecution launches an execution on a peer
|
// LaunchPeerExecution launches an execution on a peer
|
||||||
func (p *PeerCache) LaunchPeerExecution(peerID string, dataID string,
|
func (p *PeerCache) LaunchPeerExecution(peerID string, dataID string,
|
||||||
dt utils.DataType, method tools.METHOD, body map[string]interface{}, caller *tools.HTTPCaller) (*PeerExecution, error) {
|
dt tools.DataType, method tools.METHOD, body map[string]interface{}, caller *tools.HTTPCaller) (*PeerExecution, error) {
|
||||||
methods := caller.URLS[dt.String()] // Get the methods url of the data type
|
methods := caller.URLS[dt] // Get the methods url of the data type
|
||||||
if _, ok := methods[method]; !ok {
|
if _, ok := methods[method]; !ok {
|
||||||
return nil, errors.New("no path found")
|
return nil, errors.New("no path found")
|
||||||
}
|
}
|
||||||
@@ -88,7 +86,7 @@ func (p *PeerCache) LaunchPeerExecution(peerID string, dataID string,
|
|||||||
// If the peer is not reachable, add the execution to the failed executions list
|
// If the peer is not reachable, add the execution to the failed executions list
|
||||||
pexec := &PeerExecution{
|
pexec := &PeerExecution{
|
||||||
Method: method.String(),
|
Method: method.String(),
|
||||||
Url: p.urlFormat((mypeer.Url)+meth, dt),
|
Url: p.urlFormat((mypeer.Url)+"/"+dt.API()+meth, dt),
|
||||||
Body: body,
|
Body: body,
|
||||||
DataType: dt.EnumIndex(),
|
DataType: dt.EnumIndex(),
|
||||||
DataID: dataID,
|
DataID: dataID,
|
||||||
@@ -98,11 +96,11 @@ func (p *PeerCache) LaunchPeerExecution(peerID string, dataID string,
|
|||||||
return nil, errors.New("peer is not reachable")
|
return nil, errors.New("peer is not reachable")
|
||||||
} else {
|
} else {
|
||||||
// If the peer is reachable, launch the execution
|
// If the peer is reachable, launch the execution
|
||||||
url = p.urlFormat((mypeer.Url)+meth, dt) // Format the URL
|
url = p.urlFormat((mypeer.Url)+"/"+dt.API()+meth, dt) // Format the URL
|
||||||
tmp := mypeer.FailedExecution // Get the failed executions list
|
tmp := mypeer.FailedExecution // Get the failed executions list
|
||||||
mypeer.FailedExecution = []PeerExecution{} // Reset the failed executions list
|
mypeer.FailedExecution = []PeerExecution{} // Reset the failed executions list
|
||||||
mypeer.GetAccessor(nil).UpdateOne(mypeer, peerID) // Update the peer in the db
|
mypeer.GetAccessor(nil).UpdateOne(mypeer, peerID) // Update the peer in the db
|
||||||
for _, v := range tmp { // Retry the failed executions
|
for _, v := range tmp { // Retry the failed executions
|
||||||
go p.exec(v.Url, tools.ToMethod(v.Method), v.Body, caller)
|
go p.exec(v.Url, tools.ToMethod(v.Method), v.Body, caller)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -127,9 +125,8 @@ func (p *PeerCache) exec(url string, method tools.METHOD, body map[string]interf
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
if e, ok := m["error"]; ok && e != "<nil>" { // Check if there is an error in the response
|
||||||
if e, ok := m["error"]; !ok && e != "" { // Check if there is an error in the response
|
|
||||||
return errors.New(fmt.Sprintf("%v", m["error"]))
|
return errors.New(fmt.Sprintf("%v", m["error"]))
|
||||||
}
|
}
|
||||||
return err
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,30 +26,17 @@ type AbstractResource struct {
|
|||||||
ResourceModel *ResourceModel `json:"resource_model,omitempty" bson:"resource_model,omitempty"` // ResourceModel is the model of the resource
|
ResourceModel *ResourceModel `json:"resource_model,omitempty" bson:"resource_model,omitempty"` // ResourceModel is the model of the resource
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* GetModelValue returns the value of the model key
|
|
||||||
*/
|
|
||||||
func (abs *AbstractResource) GetModelValue(key string) interface{} {
|
|
||||||
if abs.ResourceModel == nil || abs.ResourceModel.Model == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
if _, ok := abs.ResourceModel.Model[key]; !ok {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
return abs.ResourceModel.Model[key].Value
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* GetModelType returns the type of the model key
|
* GetModelType returns the type of the model key
|
||||||
*/
|
*/
|
||||||
func (abs *AbstractResource) GetModelType(key string) interface{} {
|
func (abs *AbstractResource) GetModelType(cat string, key string) interface{} {
|
||||||
if abs.ResourceModel == nil || abs.ResourceModel.Model == nil {
|
if abs.ResourceModel == nil || abs.ResourceModel.Model == nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
if _, ok := abs.ResourceModel.Model[key]; !ok {
|
if _, ok := abs.ResourceModel.Model[key]; !ok {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
return abs.ResourceModel.Model[key].Type
|
return abs.ResourceModel.Model[cat][key].Type
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -66,20 +53,19 @@ func (abs *AbstractResource) GetModelKeys() []string {
|
|||||||
/*
|
/*
|
||||||
* GetModelReadOnly returns the readonly of the model key
|
* GetModelReadOnly returns the readonly of the model key
|
||||||
*/
|
*/
|
||||||
func (abs *AbstractResource) GetModelReadOnly(key string) interface{} {
|
func (abs *AbstractResource) GetModelReadOnly(cat string, key string) interface{} {
|
||||||
if abs.ResourceModel == nil || abs.ResourceModel.Model == nil {
|
if abs.ResourceModel == nil || abs.ResourceModel.Model == nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
if _, ok := abs.ResourceModel.Model[key]; !ok {
|
if _, ok := abs.ResourceModel.Model[key]; !ok {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
return abs.ResourceModel.Model[key].ReadOnly
|
return abs.ResourceModel.Model[cat][key].ReadOnly
|
||||||
}
|
}
|
||||||
|
|
||||||
type Model struct {
|
type Model struct {
|
||||||
Type string `json:"type,omitempty" bson:"type,omitempty"` // Type is the type of the model
|
Type string `json:"type,omitempty" bson:"type,omitempty"` // Type is the type of the model
|
||||||
Value interface{} `json:"value,omitempty" bson:"value,omitempty"` // Value is the value of the model
|
ReadOnly bool `json:"readonly,omitempty" bson:"readonly,omitempty"` // ReadOnly is the readonly of the model
|
||||||
ReadOnly bool `json:"readonly,omitempty" bson:"readonly,omitempty"` // ReadOnly is the readonly of the model
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -88,15 +74,17 @@ type Model struct {
|
|||||||
* Warning: This struct is not user available, it is only used by the system
|
* Warning: This struct is not user available, it is only used by the system
|
||||||
*/
|
*/
|
||||||
type ResourceModel struct {
|
type ResourceModel struct {
|
||||||
UUID string `json:"id,omitempty" bson:"id,omitempty" validate:"required"`
|
UUID string `json:"id,omitempty" bson:"id,omitempty" validate:"required"`
|
||||||
ResourceType string `json:"resource_type,omitempty" bson:"resource_type,omitempty" validate:"required"`
|
ResourceType string `json:"resource_type,omitempty" bson:"resource_type,omitempty" validate:"required"`
|
||||||
Model map[string]Model `json:"model,omitempty" bson:"model,omitempty"`
|
Model map[string]map[string]Model `json:"model,omitempty" bson:"model,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ao *ResourceModel) GetID() string {
|
func (ao *ResourceModel) GetID() string {
|
||||||
return ao.UUID
|
return ao.UUID
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (ao *ResourceModel) UpToDate() {}
|
||||||
|
|
||||||
func (r *ResourceModel) GenerateID() {
|
func (r *ResourceModel) GenerateID() {
|
||||||
r.UUID = uuid.New().String()
|
r.UUID = uuid.New().String()
|
||||||
}
|
}
|
||||||
@@ -107,7 +95,7 @@ func (d *ResourceModel) GetName() string {
|
|||||||
|
|
||||||
func (d *ResourceModel) GetAccessor(caller *tools.HTTPCaller) utils.Accessor {
|
func (d *ResourceModel) GetAccessor(caller *tools.HTTPCaller) utils.Accessor {
|
||||||
data := &ResourceModelMongoAccessor{}
|
data := &ResourceModelMongoAccessor{}
|
||||||
data.Init(utils.RESOURCE_MODEL, caller)
|
data.Init(tools.RESOURCE_MODEL, caller)
|
||||||
return data
|
return data
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -40,6 +40,6 @@ func (dma *DataResource) Serialize() map[string]interface{} {
|
|||||||
|
|
||||||
func (d *DataResource) GetAccessor(caller *tools.HTTPCaller) utils.Accessor {
|
func (d *DataResource) GetAccessor(caller *tools.HTTPCaller) utils.Accessor {
|
||||||
data := New() // Create a new instance of the accessor
|
data := New() // Create a new instance of the accessor
|
||||||
data.Init(utils.DATA_RESOURCE, caller) // Initialize the accessor with the DATA_RESOURCE model type
|
data.Init(tools.DATA_RESOURCE, caller) // Initialize the accessor with the DATA_RESOURCE model type
|
||||||
return data
|
return data
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ func (dma *DatacenterResource) Serialize() map[string]interface{} {
|
|||||||
|
|
||||||
func (d *DatacenterResource) GetAccessor(caller *tools.HTTPCaller) utils.Accessor {
|
func (d *DatacenterResource) GetAccessor(caller *tools.HTTPCaller) utils.Accessor {
|
||||||
data := New()
|
data := New()
|
||||||
data.Init(utils.DATACENTER_RESOURCE, caller)
|
data.Init(tools.DATACENTER_RESOURCE, caller)
|
||||||
return data
|
return data
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,20 @@ import (
|
|||||||
"cloud.o-forge.io/core/oc-lib/tools"
|
"cloud.o-forge.io/core/oc-lib/tools"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
type Container struct {
|
||||||
|
Image string `json:"image,omitempty" bson:"image,omitempty"` // Image is the container image
|
||||||
|
Command string `json:"command,omitempty" bson:"command,omitempty"` // Command is the container command
|
||||||
|
Args string `json:"args,omitempty" bson:"args,omitempty"` // Args is the container arguments
|
||||||
|
Env map[string]string `json:"env,omitempty" bson:"env,omitempty"` // Env is the container environment variables
|
||||||
|
Volumes map[string]string `json:"volumes,omitempty" bson:"volumes,omitempty"` // Volumes is the container volumes
|
||||||
|
}
|
||||||
|
|
||||||
|
type Expose struct {
|
||||||
|
Port int `json:"port,omitempty" bson:"port,omitempty"` // Port is the port
|
||||||
|
Reverse string `json:"reverse,omitempty" bson:"reverse,omitempty"` // Reverse is the reverse
|
||||||
|
PAT int `json:"pat,omitempty" bson:"pat,omitempty"` // PAT is the PAT
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ProcessingResource is a struct that represents a processing resource
|
* ProcessingResource is a struct that represents a processing resource
|
||||||
* it defines the resource processing
|
* it defines the resource processing
|
||||||
@@ -22,6 +36,8 @@ type ProcessingResource struct {
|
|||||||
Parallel bool `bson:"parallel,omitempty" json:"parallel,omitempty"` // Parallel is a flag that indicates if the processing is parallel
|
Parallel bool `bson:"parallel,omitempty" json:"parallel,omitempty"` // Parallel is a flag that indicates if the processing is parallel
|
||||||
ScalingModel uint `bson:"scaling_model,omitempty" json:"scaling_model,omitempty"` // ScalingModel is the scaling model
|
ScalingModel uint `bson:"scaling_model,omitempty" json:"scaling_model,omitempty"` // ScalingModel is the scaling model
|
||||||
DiskIO string `bson:"disk_io,omitempty" json:"disk_io,omitempty"` // DiskIO is the disk IO
|
DiskIO string `bson:"disk_io,omitempty" json:"disk_io,omitempty"` // DiskIO is the disk IO
|
||||||
|
Container *Container `bson:"container,omitempty" json:"container,omitempty"` // Container is the container
|
||||||
|
Expose []Expose `bson:"expose,omitempty" json:"expose,omitempty"` // Expose is the execution
|
||||||
}
|
}
|
||||||
|
|
||||||
func (dma *ProcessingResource) Deserialize(j map[string]interface{}) utils.DBObject {
|
func (dma *ProcessingResource) Deserialize(j map[string]interface{}) utils.DBObject {
|
||||||
@@ -45,6 +61,6 @@ func (dma *ProcessingResource) Serialize() map[string]interface{} {
|
|||||||
|
|
||||||
func (d *ProcessingResource) GetAccessor(caller *tools.HTTPCaller) utils.Accessor {
|
func (d *ProcessingResource) GetAccessor(caller *tools.HTTPCaller) utils.Accessor {
|
||||||
data := New() // Create a new instance of the accessor
|
data := New() // Create a new instance of the accessor
|
||||||
data.Init(utils.PROCESSING_RESOURCE, caller) // Initialize the accessor with the PROCESSING_RESOURCE model type
|
data.Init(tools.PROCESSING_RESOURCE, caller) // Initialize the accessor with the PROCESSING_RESOURCE model type
|
||||||
return data
|
return data
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,26 @@ import (
|
|||||||
"cloud.o-forge.io/core/oc-lib/tools"
|
"cloud.o-forge.io/core/oc-lib/tools"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
type StorageType int
|
||||||
|
|
||||||
|
// StorageType - Enum that defines the type of storage
|
||||||
|
const (
|
||||||
|
GB StorageType = iota
|
||||||
|
MB
|
||||||
|
KB
|
||||||
|
)
|
||||||
|
|
||||||
|
var argoType = [...]string{
|
||||||
|
"Gi",
|
||||||
|
"Mi",
|
||||||
|
"Ki",
|
||||||
|
}
|
||||||
|
|
||||||
|
// New creates a new instance of the StorageResource struct
|
||||||
|
func (dma StorageType) ToArgo() string {
|
||||||
|
return argoType[dma]
|
||||||
|
}
|
||||||
|
|
||||||
type URL struct {
|
type URL struct {
|
||||||
Protocol string `bson:"protocol,omitempty" json:"protocol,omitempty"` // Protocol is the protocol of the URL
|
Protocol string `bson:"protocol,omitempty" json:"protocol,omitempty"` // Protocol is the protocol of the URL
|
||||||
Path string `bson:"path,omitempty" json:"path,omitempty"` // Path is the path of the URL
|
Path string `bson:"path,omitempty" json:"path,omitempty"` // Path is the path of the URL
|
||||||
@@ -18,15 +38,16 @@ type URL struct {
|
|||||||
* it defines the resource storage
|
* it defines the resource storage
|
||||||
*/
|
*/
|
||||||
type StorageResource struct {
|
type StorageResource struct {
|
||||||
resource_model.AbstractResource // AbstractResource contains the basic fields of an object (id, name)
|
resource_model.AbstractResource // AbstractResource contains the basic fields of an object (id, name)
|
||||||
Acronym string `bson:"acronym,omitempty" json:"acronym,omitempty"` // Acronym is the acronym of the storage
|
Acronym string `bson:"acronym,omitempty" json:"acronym,omitempty"` // Acronym is the acronym of the storage
|
||||||
Type string `bson:"type,omitempty" json:"type,omitempty"` // Type is the type of the storage
|
Type string `bson:"type,omitempty" json:"type,omitempty"` // Type is the type of the storage
|
||||||
Size uint `bson:"size,omitempty" json:"size,omitempty"` // Size is the size of the storage
|
SizeType StorageType `bson:"size_type" json:"size_type" default:"0"` // SizeType is the type of the storage size
|
||||||
Url *URL `bson:"url,omitempty" json:"url,omitempty"` // Will allow to select between several protocols
|
Size uint `bson:"size,omitempty" json:"size,omitempty"` // Size is the size of the storage
|
||||||
|
Url *URL `bson:"url,omitempty" json:"url,omitempty"` // Will allow to select between several protocols
|
||||||
Encryption bool `bson:"encryption,omitempty" json:"encryption,omitempty"` // Encryption is a flag that indicates if the storage is encrypted
|
Local bool `bson:"local" json:"local"` // Local is a flag that indicates if the storage is local
|
||||||
Redundancy string `bson:"redundancy,omitempty" json:"redundancy,omitempty"` // Redundancy is the redundancy of the storage
|
Encryption bool `bson:"encryption,omitempty" json:"encryption,omitempty"` // Encryption is a flag that indicates if the storage is encrypted
|
||||||
Throughput string `bson:"throughput,omitempty" json:"throughput,omitempty"` // Throughput is the throughput of the storage
|
Redundancy string `bson:"redundancy,omitempty" json:"redundancy,omitempty"` // Redundancy is the redundancy of the storage
|
||||||
|
Throughput string `bson:"throughput,omitempty" json:"throughput,omitempty"` // Throughput is the throughput of the storage
|
||||||
}
|
}
|
||||||
|
|
||||||
func (dma *StorageResource) Deserialize(j map[string]interface{}) utils.DBObject {
|
func (dma *StorageResource) Deserialize(j map[string]interface{}) utils.DBObject {
|
||||||
@@ -50,6 +71,6 @@ func (dma *StorageResource) Serialize() map[string]interface{} {
|
|||||||
|
|
||||||
func (d *StorageResource) GetAccessor(caller *tools.HTTPCaller) utils.Accessor {
|
func (d *StorageResource) GetAccessor(caller *tools.HTTPCaller) utils.Accessor {
|
||||||
data := New() // Create a new instance of the accessor
|
data := New() // Create a new instance of the accessor
|
||||||
data.Init(utils.STORAGE_RESOURCE, caller) // Initialize the accessor with the STORAGE_RESOURCE model type
|
data.Init(tools.STORAGE_RESOURCE, caller) // Initialize the accessor with the STORAGE_RESOURCE model type
|
||||||
return data
|
return data
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ type WorkflowResource struct {
|
|||||||
|
|
||||||
func (d *WorkflowResource) GetAccessor(caller *tools.HTTPCaller) utils.Accessor {
|
func (d *WorkflowResource) GetAccessor(caller *tools.HTTPCaller) utils.Accessor {
|
||||||
data := New() // Create a new instance of the accessor
|
data := New() // Create a new instance of the accessor
|
||||||
data.Init(utils.WORKFLOW_RESOURCE, caller) // Initialize the accessor with the WORKFLOW_RESOURCE model type
|
data.Init(tools.WORKFLOW_RESOURCE, caller) // Initialize the accessor with the WORKFLOW_RESOURCE model type
|
||||||
return data
|
return data
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,10 +3,12 @@ package utils
|
|||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
|
"time"
|
||||||
|
|
||||||
"cloud.o-forge.io/core/oc-lib/dbs"
|
"cloud.o-forge.io/core/oc-lib/dbs"
|
||||||
"cloud.o-forge.io/core/oc-lib/dbs/mongo"
|
"cloud.o-forge.io/core/oc-lib/dbs/mongo"
|
||||||
"cloud.o-forge.io/core/oc-lib/logs"
|
"cloud.o-forge.io/core/oc-lib/logs"
|
||||||
|
"cloud.o-forge.io/core/oc-lib/static"
|
||||||
"cloud.o-forge.io/core/oc-lib/tools"
|
"cloud.o-forge.io/core/oc-lib/tools"
|
||||||
"github.com/go-playground/validator/v10"
|
"github.com/go-playground/validator/v10"
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
@@ -22,8 +24,10 @@ var validate = validator.New(validator.WithRequiredStructEnabled())
|
|||||||
* every data in base root model should inherit from this struct (only exception is the ResourceModel)
|
* every data in base root model should inherit from this struct (only exception is the ResourceModel)
|
||||||
*/
|
*/
|
||||||
type AbstractObject struct {
|
type AbstractObject struct {
|
||||||
UUID string `json:"id,omitempty" bson:"id,omitempty" validate:"required"`
|
UUID string `json:"id,omitempty" bson:"id,omitempty" validate:"required"`
|
||||||
Name string `json:"name,omitempty" bson:"name,omitempty" validate:"required"`
|
Name string `json:"name,omitempty" bson:"name,omitempty" validate:"required"`
|
||||||
|
UpdateDate time.Time `json:"update_date" bson:"update_date"`
|
||||||
|
LastPeerWriter string `json:"last_peer_writer" bson:"last_peer_writer"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetID returns the id of the object (abstract)
|
// GetID returns the id of the object (abstract)
|
||||||
@@ -36,6 +40,11 @@ func (ao *AbstractObject) GetName() string {
|
|||||||
return ao.Name
|
return ao.Name
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (ao *AbstractObject) UpToDate() {
|
||||||
|
ao.UpdateDate = time.Now()
|
||||||
|
ao.LastPeerWriter, _ = static.GetMyLocalJsonPeer()
|
||||||
|
}
|
||||||
|
|
||||||
// GetAccessor returns the accessor of the object (abstract)
|
// GetAccessor returns the accessor of the object (abstract)
|
||||||
func (dma *AbstractObject) GetAccessor(caller *tools.HTTPCaller) Accessor {
|
func (dma *AbstractObject) GetAccessor(caller *tools.HTTPCaller) Accessor {
|
||||||
return nil
|
return nil
|
||||||
@@ -81,7 +90,7 @@ func (dma *AbstractAccessor) GetCaller() *tools.HTTPCaller {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Init initializes the accessor with the data type and the http caller
|
// Init initializes the accessor with the data type and the http caller
|
||||||
func (dma *AbstractAccessor) Init(t DataType, caller *tools.HTTPCaller) {
|
func (dma *AbstractAccessor) Init(t tools.DataType, caller *tools.HTTPCaller) {
|
||||||
dma.Logger = logs.CreateLogger(t.String()) // Create a logger with the data type
|
dma.Logger = logs.CreateLogger(t.String()) // Create a logger with the data type
|
||||||
dma.Caller = caller // Set the caller
|
dma.Caller = caller // Set the caller
|
||||||
dma.Type = t.String() // Set the data type
|
dma.Type = t.String() // Set the data type
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ type DBObject interface {
|
|||||||
GenerateID()
|
GenerateID()
|
||||||
GetID() string
|
GetID() string
|
||||||
GetName() string
|
GetName() string
|
||||||
|
UpToDate()
|
||||||
Deserialize(j map[string]interface{}) DBObject
|
Deserialize(j map[string]interface{}) DBObject
|
||||||
Serialize() map[string]interface{}
|
Serialize() map[string]interface{}
|
||||||
GetAccessor(caller *tools.HTTPCaller) Accessor
|
GetAccessor(caller *tools.HTTPCaller) Accessor
|
||||||
@@ -26,7 +27,7 @@ type DBObject interface {
|
|||||||
|
|
||||||
// Accessor is an interface that defines the basic methods for an Accessor
|
// Accessor is an interface that defines the basic methods for an Accessor
|
||||||
type Accessor interface {
|
type Accessor interface {
|
||||||
Init(t DataType, caller *tools.HTTPCaller)
|
Init(t tools.DataType, caller *tools.HTTPCaller)
|
||||||
GetType() string
|
GetType() string
|
||||||
GetCaller() *tools.HTTPCaller
|
GetCaller() *tools.HTTPCaller
|
||||||
Search(filters *dbs.Filters, search string) ([]ShallowDBObject, int, error)
|
Search(filters *dbs.Filters, search string) ([]ShallowDBObject, int, error)
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ func (wfa *Workflow) CheckBooking(caller *tools.HTTPCaller) (bool, error) {
|
|||||||
if peerID == "" {
|
if peerID == "" {
|
||||||
return false, errors.New("no peer id")
|
return false, errors.New("no peer id")
|
||||||
} // no peer id no booking, we need to know where to book
|
} // no peer id no booking, we need to know where to book
|
||||||
_, err := (&peer.Peer{}).LaunchPeerExecution(peerID, dc_id, utils.BOOKING, tools.GET, nil, caller)
|
_, err := (&peer.Peer{}).LaunchPeerExecution(peerID, dc_id, tools.BOOKING, tools.GET, nil, caller)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
@@ -84,7 +84,7 @@ func (d *Workflow) GetName() string {
|
|||||||
|
|
||||||
func (d *Workflow) GetAccessor(caller *tools.HTTPCaller) utils.Accessor {
|
func (d *Workflow) GetAccessor(caller *tools.HTTPCaller) utils.Accessor {
|
||||||
data := New() // Create a new instance of the accessor
|
data := New() // Create a new instance of the accessor
|
||||||
data.Init(utils.WORKFLOW, caller) // Initialize the accessor with the WORKFLOW model type
|
data.Init(tools.WORKFLOW, caller) // Initialize the accessor with the WORKFLOW model type
|
||||||
return data
|
return data
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
34
models/workflow/workflow_history_mongo_accessor.go
Normal file
34
models/workflow/workflow_history_mongo_accessor.go
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
package workflow
|
||||||
|
|
||||||
|
import (
|
||||||
|
"cloud.o-forge.io/core/oc-lib/models/utils"
|
||||||
|
"cloud.o-forge.io/core/oc-lib/tools"
|
||||||
|
"github.com/google/uuid"
|
||||||
|
)
|
||||||
|
|
||||||
|
type WorkflowHistory struct{ Workflow }
|
||||||
|
|
||||||
|
func (d *WorkflowHistory) GetAccessor(caller *tools.HTTPCaller) utils.Accessor {
|
||||||
|
data := New() // Create a new instance of the accessor
|
||||||
|
data.Init(tools.WORKSPACE_HISTORY, caller) // Initialize the accessor with the WORKSPACE model type
|
||||||
|
return data
|
||||||
|
}
|
||||||
|
func (r *WorkflowHistory) GenerateID() {
|
||||||
|
r.UUID = uuid.New().String()
|
||||||
|
}
|
||||||
|
|
||||||
|
// Workspace is a struct that represents a workspace
|
||||||
|
type workflowHistoryMongoAccessor struct {
|
||||||
|
workflowMongoAccessor // AbstractAccessor contains the basic fields of an accessor (model, caller)
|
||||||
|
}
|
||||||
|
|
||||||
|
// New creates a new instance of the workspaceMongoAccessor
|
||||||
|
func NewHistory() *workflowHistoryMongoAccessor {
|
||||||
|
return &workflowHistoryMongoAccessor{}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *workflowHistoryMongoAccessor) MapFromWorkflow(w *Workflow) *WorkflowHistory {
|
||||||
|
wh := &WorkflowHistory{Workflow: *w}
|
||||||
|
wh.GenerateID()
|
||||||
|
return wh
|
||||||
|
}
|
||||||
@@ -2,17 +2,18 @@ package workflow
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
|
"fmt"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"cloud.o-forge.io/core/oc-lib/dbs"
|
"cloud.o-forge.io/core/oc-lib/dbs"
|
||||||
"cloud.o-forge.io/core/oc-lib/dbs/mongo"
|
"cloud.o-forge.io/core/oc-lib/dbs/mongo"
|
||||||
|
"cloud.o-forge.io/core/oc-lib/models/collaborative_area/shallow_collaborative_area"
|
||||||
"cloud.o-forge.io/core/oc-lib/models/peer"
|
"cloud.o-forge.io/core/oc-lib/models/peer"
|
||||||
"cloud.o-forge.io/core/oc-lib/models/resources"
|
"cloud.o-forge.io/core/oc-lib/models/resources"
|
||||||
"cloud.o-forge.io/core/oc-lib/models/resources/datacenter"
|
"cloud.o-forge.io/core/oc-lib/models/resources/datacenter"
|
||||||
"cloud.o-forge.io/core/oc-lib/models/utils"
|
"cloud.o-forge.io/core/oc-lib/models/utils"
|
||||||
"cloud.o-forge.io/core/oc-lib/models/workflow_execution"
|
"cloud.o-forge.io/core/oc-lib/models/workflow_execution"
|
||||||
"cloud.o-forge.io/core/oc-lib/models/workspace"
|
"cloud.o-forge.io/core/oc-lib/models/workspace"
|
||||||
"cloud.o-forge.io/core/oc-lib/models/workspace/shared/shallow_shared_workspace"
|
|
||||||
"cloud.o-forge.io/core/oc-lib/tools"
|
"cloud.o-forge.io/core/oc-lib/tools"
|
||||||
cron "github.com/robfig/cron/v3"
|
cron "github.com/robfig/cron/v3"
|
||||||
)
|
)
|
||||||
@@ -95,9 +96,9 @@ func (wfa *workflowMongoAccessor) DeleteOne(id string) (utils.DBObject, int, err
|
|||||||
}, true) // delete the executions
|
}, true) // delete the executions
|
||||||
res, code, err := wfa.GenericDeleteOne(id, wfa)
|
res, code, err := wfa.GenericDeleteOne(id, wfa)
|
||||||
if res != nil && code == 200 {
|
if res != nil && code == 200 {
|
||||||
wfa.execute(res.(*Workflow), false) // up to date the workspace for the workflow
|
wfa.execute(res.(*Workflow), true, false) // up to date the workspace for the workflow
|
||||||
|
wfa.share(res.(*Workflow), true, wfa.Caller)
|
||||||
}
|
}
|
||||||
wfa.share(res.(*Workflow), true, wfa.Caller) // send the deletion to the peers where workflow is shared
|
|
||||||
return res, code, err
|
return res, code, err
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -107,10 +108,10 @@ func (wfa *workflowMongoAccessor) DeleteOne(id string) (utils.DBObject, int, err
|
|||||||
* it returns an error if the booking fails
|
* it returns an error if the booking fails
|
||||||
*/
|
*/
|
||||||
func (wfa *workflowMongoAccessor) book(id string, realData *Workflow, execs []*workflow_execution.WorkflowExecution) error {
|
func (wfa *workflowMongoAccessor) book(id string, realData *Workflow, execs []*workflow_execution.WorkflowExecution) error {
|
||||||
if wfa.Caller == nil || wfa.Caller.URLS == nil || wfa.Caller.URLS[utils.BOOKING.String()] == nil {
|
if wfa.Caller == nil || wfa.Caller.URLS == nil || wfa.Caller.URLS[tools.BOOKING] == nil {
|
||||||
return errors.New("no caller defined")
|
return errors.New("no caller defined")
|
||||||
}
|
}
|
||||||
methods := wfa.Caller.URLS[utils.BOOKING.String()]
|
methods := wfa.Caller.URLS[tools.BOOKING]
|
||||||
if _, ok := methods[tools.POST]; !ok {
|
if _, ok := methods[tools.POST]; !ok {
|
||||||
return errors.New("no path found")
|
return errors.New("no path found")
|
||||||
}
|
}
|
||||||
@@ -137,13 +138,14 @@ func (wfa *workflowMongoAccessor) book(id string, realData *Workflow, execs []*w
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
// BOOKING ON PEER
|
// BOOKING ON PEER
|
||||||
_, err := (&peer.Peer{}).LaunchPeerExecution(peerID, "", utils.BOOKING, tools.POST,
|
_, err := (&peer.Peer{}).LaunchPeerExecution(peerID, "", tools.BOOKING, tools.POST,
|
||||||
(&workflow_execution.WorkflowExecutions{ // it's the standard model for booking see OC-PEER
|
(&workflow_execution.WorkflowExecutions{ // it's the standard model for booking see OC-PEER
|
||||||
WorkflowID: id, // set the workflow id "WHO"
|
WorkflowID: id, // set the workflow id "WHO"
|
||||||
ResourceID: dc_id, // set the datacenter id "WHERE"
|
ResourceID: dc_id, // set the datacenter id "WHERE"
|
||||||
Executions: execs, // set the executions to book "WHAT"
|
Executions: execs, // set the executions to book "WHAT"
|
||||||
}).Serialize(), wfa.Caller)
|
}).Serialize(), wfa.Caller)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
fmt.Println("BOOKING", err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -156,26 +158,28 @@ func (wfa *workflowMongoAccessor) book(id string, realData *Workflow, execs []*w
|
|||||||
* share is a function that shares a workflow to the peers if the workflow is shared
|
* share is a function that shares a workflow to the peers if the workflow is shared
|
||||||
*/
|
*/
|
||||||
func (wfa *workflowMongoAccessor) share(realData *Workflow, delete bool, caller *tools.HTTPCaller) {
|
func (wfa *workflowMongoAccessor) share(realData *Workflow, delete bool, caller *tools.HTTPCaller) {
|
||||||
if realData.Shared == nil || len(realData.Shared) == 0 { // no shared no sharing
|
if realData.Shared == nil || len(realData.Shared) == 0 || caller.Disabled { // no shared no sharing
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
for _, sharedID := range realData.Shared { // loop through the shared ids
|
for _, sharedID := range realData.Shared { // loop through the shared ids
|
||||||
access := (&shallow_shared_workspace.ShallowSharedWorkspace{}).GetAccessor(nil)
|
access := (&shallow_collaborative_area.ShallowCollaborativeArea{}).GetAccessor(nil)
|
||||||
res, code, _ := access.LoadOne(sharedID)
|
res, code, _ := access.LoadOne(sharedID)
|
||||||
if code != 200 {
|
if code != 200 {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
var err error
|
var err error
|
||||||
paccess := &peer.Peer{}
|
paccess := &peer.Peer{}
|
||||||
for _, p := range res.(*shallow_shared_workspace.ShallowSharedWorkspace).Peers {
|
for _, p := range res.(*shallow_collaborative_area.ShallowCollaborativeArea).Peers {
|
||||||
paccess.UUID = p
|
paccess.UUID = p
|
||||||
if paccess.IsMySelf() { // if the peer is the current peer, never share because it will create a loop
|
if paccess.IsMySelf() { // if the peer is the current peer, never share because it will create a loop
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if delete { // if the workflow is deleted, share the deletion
|
if delete { // if the workflow is deleted, share the deletion
|
||||||
_, err = paccess.LaunchPeerExecution(p, res.GetID(), utils.WORKFLOW, tools.DELETE, map[string]interface{}{}, caller)
|
history := NewHistory()
|
||||||
|
history.StoreOne(history.MapFromWorkflow(res.(*Workflow)))
|
||||||
|
_, err = paccess.LaunchPeerExecution(p, res.GetID(), tools.WORKFLOW, tools.DELETE, map[string]interface{}{}, caller)
|
||||||
} else { // if the workflow is updated, share the update
|
} else { // if the workflow is updated, share the update
|
||||||
_, err = paccess.LaunchPeerExecution(p, res.GetID(), utils.WORKFLOW, tools.PUT, res.Serialize(), caller)
|
_, err = paccess.LaunchPeerExecution(p, res.GetID(), tools.WORKFLOW, tools.PUT, res.Serialize(), caller)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -194,10 +198,13 @@ func (wfa *workflowMongoAccessor) execution(id string, realData *Workflow, delet
|
|||||||
mongo.MONGOService.DeleteMultiple(map[string]interface{}{
|
mongo.MONGOService.DeleteMultiple(map[string]interface{}{
|
||||||
"state": 1, // only delete the scheduled executions only scheduled if executions are in progress or ended, they should not be deleted for registration
|
"state": 1, // only delete the scheduled executions only scheduled if executions are in progress or ended, they should not be deleted for registration
|
||||||
"workflow_id": id,
|
"workflow_id": id,
|
||||||
}, utils.WORKFLOW_EXECUTION.String())
|
}, tools.WORKFLOW_EXECUTION.String())
|
||||||
err := wfa.book(id, realData, []*workflow_execution.WorkflowExecution{}) // delete the booking of the workflow on the peers
|
err := wfa.book(id, realData, []*workflow_execution.WorkflowExecution{}) // delete the booking of the workflow on the peers
|
||||||
nats.SetNATSPub(utils.WORKFLOW.String(), tools.REMOVE, realData) // send the deletion to the nats
|
nats.SetNATSPub(tools.WORKFLOW.String(), tools.REMOVE, realData) // send the deletion to the nats
|
||||||
return 200, err
|
if err != nil {
|
||||||
|
return 409, err
|
||||||
|
}
|
||||||
|
return 200, nil
|
||||||
}
|
}
|
||||||
accessor := (&workflow_execution.WorkflowExecution{}).GetAccessor(nil)
|
accessor := (&workflow_execution.WorkflowExecution{}).GetAccessor(nil)
|
||||||
execs, err := wfa.getExecutions(id, realData) // get the executions of the workflow
|
execs, err := wfa.getExecutions(id, realData) // get the executions of the workflow
|
||||||
@@ -208,13 +215,8 @@ func (wfa *workflowMongoAccessor) execution(id string, realData *Workflow, delet
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return 409, err // if the booking fails, return an error for integrity between peers
|
return 409, err // if the booking fails, return an error for integrity between peers
|
||||||
}
|
}
|
||||||
|
|
||||||
if delete { // if delete is set to true, delete the executions
|
if delete { // if delete is set to true, delete the executions
|
||||||
mongo.MONGOService.DeleteMultiple(map[string]interface{}{
|
|
||||||
"workflow_id": id,
|
|
||||||
"state": 1,
|
|
||||||
}, utils.WORKFLOW_EXECUTION.String())
|
|
||||||
wfa.book(id, realData, []*workflow_execution.WorkflowExecution{})
|
|
||||||
nats.SetNATSPub(utils.WORKFLOW.String(), tools.REMOVE, realData)
|
|
||||||
return 200, nil
|
return 200, nil
|
||||||
}
|
}
|
||||||
if len(execs) > 0 { // if the executions are set, store them
|
if len(execs) > 0 { // if the executions are set, store them
|
||||||
@@ -224,7 +226,7 @@ func (wfa *workflowMongoAccessor) execution(id string, realData *Workflow, delet
|
|||||||
return code, err
|
return code, err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
nats.SetNATSPub(utils.WORKFLOW.String(), tools.CREATE, realData) // send the creation to the nats
|
nats.SetNATSPub(tools.WORKFLOW.String(), tools.CREATE, realData) // send the creation to the nats
|
||||||
} else {
|
} else {
|
||||||
return 422, err
|
return 422, err
|
||||||
}
|
}
|
||||||
@@ -244,19 +246,19 @@ func (wfa *workflowMongoAccessor) UpdateOne(set utils.DBObject, id string) (util
|
|||||||
return nil, code, err
|
return nil, code, err
|
||||||
}
|
}
|
||||||
if !avoid { // if the schedule is not avoided, update the executions
|
if !avoid { // if the schedule is not avoided, update the executions
|
||||||
if code, err := wfa.execution(id, res.(*Workflow), true); err != nil {
|
if code, err := wfa.execution(id, res.(*Workflow), false); code != 200 {
|
||||||
return nil, code, err
|
return nil, code, errors.New("could not update the executions : " + err.Error())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
wfa.execute(res.(*Workflow), false) // update the workspace for the workflow
|
wfa.execute(res.(*Workflow), false, false) // update the workspace for the workflow
|
||||||
wfa.share(res.(*Workflow), false, wfa.Caller) // share the update to the peers
|
wfa.share(res.(*Workflow), false, wfa.Caller) // share the update to the peers
|
||||||
return res, code, err
|
return res, code, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// StoreOne stores a workflow in the database
|
// StoreOne stores a workflow in the database
|
||||||
func (wfa *workflowMongoAccessor) StoreOne(data utils.DBObject) (utils.DBObject, int, error) {
|
func (wfa *workflowMongoAccessor) StoreOne(data utils.DBObject) (utils.DBObject, int, error) {
|
||||||
res, code, err := wfa.GenericStoreOne(data, wfa)
|
res, code, err := wfa.GenericStoreOne(data, wfa)
|
||||||
if err != nil {
|
if err != nil || code != 200 {
|
||||||
return nil, code, err
|
return nil, code, err
|
||||||
}
|
}
|
||||||
wfa.share(res.(*Workflow), false, wfa.Caller) // share the creation to the peers
|
wfa.share(res.(*Workflow), false, wfa.Caller) // share the creation to the peers
|
||||||
@@ -264,8 +266,8 @@ func (wfa *workflowMongoAccessor) StoreOne(data utils.DBObject) (utils.DBObject,
|
|||||||
if code, err := wfa.execution(res.GetID(), res.(*Workflow), false); err != nil {
|
if code, err := wfa.execution(res.GetID(), res.(*Workflow), false); err != nil {
|
||||||
return nil, code, err
|
return nil, code, err
|
||||||
}
|
}
|
||||||
wfa.execute(res.(*Workflow), false) // store the workspace for the workflow
|
wfa.execute(res.(*Workflow), false, false) // store the workspace for the workflow
|
||||||
return res, code, err
|
return res, code, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// CopyOne copies a workflow in the database
|
// CopyOne copies a workflow in the database
|
||||||
@@ -275,7 +277,7 @@ func (wfa *workflowMongoAccessor) CopyOne(data utils.DBObject) (utils.DBObject,
|
|||||||
|
|
||||||
// execute is a function that executes a workflow
|
// execute is a function that executes a workflow
|
||||||
// it stores the workflow resources in a specific workspace to never have a conflict in UI and logic
|
// it stores the workflow resources in a specific workspace to never have a conflict in UI and logic
|
||||||
func (wfa *workflowMongoAccessor) execute(workflow *Workflow, delete bool) {
|
func (wfa *workflowMongoAccessor) execute(workflow *Workflow, delete bool, active bool) {
|
||||||
|
|
||||||
accessor := (&workspace.Workspace{}).GetAccessor(nil)
|
accessor := (&workspace.Workspace{}).GetAccessor(nil)
|
||||||
filters := &dbs.Filters{
|
filters := &dbs.Filters{
|
||||||
@@ -292,7 +294,7 @@ func (wfa *workflowMongoAccessor) execute(workflow *Workflow, delete bool) {
|
|||||||
}
|
}
|
||||||
if err == nil && len(resource) > 0 { // if the workspace already exists, update it
|
if err == nil && len(resource) > 0 { // if the workspace already exists, update it
|
||||||
accessor.UpdateOne(&workspace.Workspace{
|
accessor.UpdateOne(&workspace.Workspace{
|
||||||
Active: true,
|
Active: active,
|
||||||
ResourceSet: resources.ResourceSet{
|
ResourceSet: resources.ResourceSet{
|
||||||
Datas: workflow.Datas,
|
Datas: workflow.Datas,
|
||||||
Processings: workflow.Processings,
|
Processings: workflow.Processings,
|
||||||
@@ -303,7 +305,7 @@ func (wfa *workflowMongoAccessor) execute(workflow *Workflow, delete bool) {
|
|||||||
}, resource[0].GetID())
|
}, resource[0].GetID())
|
||||||
} else { // if the workspace does not exist, create it
|
} else { // if the workspace does not exist, create it
|
||||||
accessor.StoreOne(&workspace.Workspace{
|
accessor.StoreOne(&workspace.Workspace{
|
||||||
Active: true,
|
Active: active,
|
||||||
AbstractObject: utils.AbstractObject{Name: workflow.Name + "_workspace"},
|
AbstractObject: utils.AbstractObject{Name: workflow.Name + "_workspace"},
|
||||||
ResourceSet: resources.ResourceSet{
|
ResourceSet: resources.ResourceSet{
|
||||||
Datas: workflow.Datas,
|
Datas: workflow.Datas,
|
||||||
@@ -325,7 +327,7 @@ func (wfa *workflowMongoAccessor) LoadOne(id string) (utils.DBObject, int, error
|
|||||||
return nil, code, err
|
return nil, code, err
|
||||||
}
|
}
|
||||||
res_mongo.Decode(&workflow)
|
res_mongo.Decode(&workflow)
|
||||||
wfa.execute(&workflow, false) // if no workspace is attached to the workflow, create it
|
wfa.execute(&workflow, false, true) // if no workspace is attached to the workflow, create it
|
||||||
|
|
||||||
return &workflow, 200, nil
|
return &workflow, 200, nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -85,6 +85,10 @@ type WorkflowExecution struct {
|
|||||||
WorkflowID string `json:"workflow_id" bson:"workflow_id,omitempty"` // WorkflowID is the ID of the workflow
|
WorkflowID string `json:"workflow_id" bson:"workflow_id,omitempty"` // WorkflowID is the ID of the workflow
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (wfa *WorkflowExecution) Equals(we *WorkflowExecution) bool {
|
||||||
|
return wfa.ExecDate.Equal(*we.ExecDate) && wfa.WorkflowID == we.WorkflowID
|
||||||
|
}
|
||||||
|
|
||||||
// tool to transform the argo status to a state
|
// tool to transform the argo status to a state
|
||||||
func (wfa *WorkflowExecution) ArgoStatusToState(status string) *WorkflowExecution {
|
func (wfa *WorkflowExecution) ArgoStatusToState(status string) *WorkflowExecution {
|
||||||
status = strings.ToLower(status)
|
status = strings.ToLower(status)
|
||||||
@@ -115,7 +119,7 @@ func (d *WorkflowExecution) GetName() string {
|
|||||||
|
|
||||||
func (d *WorkflowExecution) GetAccessor(caller *tools.HTTPCaller) utils.Accessor {
|
func (d *WorkflowExecution) GetAccessor(caller *tools.HTTPCaller) utils.Accessor {
|
||||||
data := New() // Create a new instance of the accessor
|
data := New() // Create a new instance of the accessor
|
||||||
data.Init(utils.WORKFLOW_EXECUTION, caller) // Initialize the accessor with the WORKFLOW_EXECUTION model type
|
data.Init(tools.WORKFLOW_EXECUTION, caller) // Initialize the accessor with the WORKFLOW_EXECUTION model type
|
||||||
return data
|
return data
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ func (d *Workspace) GetName() string {
|
|||||||
|
|
||||||
func (d *Workspace) GetAccessor(caller *tools.HTTPCaller) utils.Accessor {
|
func (d *Workspace) GetAccessor(caller *tools.HTTPCaller) utils.Accessor {
|
||||||
data := New() // Create a new instance of the accessor
|
data := New() // Create a new instance of the accessor
|
||||||
data.Init(utils.WORKSPACE, caller) // Initialize the accessor with the WORKSPACE model type
|
data.Init(tools.WORKSPACE, caller) // Initialize the accessor with the WORKSPACE model type
|
||||||
return data
|
return data
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
34
models/workspace/workspace_history_mongo_accessor.go
Normal file
34
models/workspace/workspace_history_mongo_accessor.go
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
package workspace
|
||||||
|
|
||||||
|
import (
|
||||||
|
"cloud.o-forge.io/core/oc-lib/models/utils"
|
||||||
|
"cloud.o-forge.io/core/oc-lib/tools"
|
||||||
|
"github.com/google/uuid"
|
||||||
|
)
|
||||||
|
|
||||||
|
type WorkspaceHistory struct{ Workspace }
|
||||||
|
|
||||||
|
func (d *WorkspaceHistory) GetAccessor(caller *tools.HTTPCaller) utils.Accessor {
|
||||||
|
data := New() // Create a new instance of the accessor
|
||||||
|
data.Init(tools.WORKSPACE_HISTORY, caller) // Initialize the accessor with the WORKSPACE model type
|
||||||
|
return data
|
||||||
|
}
|
||||||
|
func (r *WorkspaceHistory) GenerateID() {
|
||||||
|
r.UUID = uuid.New().String()
|
||||||
|
}
|
||||||
|
|
||||||
|
// Workspace is a struct that represents a workspace
|
||||||
|
type workspaceHistoryMongoAccessor struct {
|
||||||
|
workspaceMongoAccessor // AbstractAccessor contains the basic fields of an accessor (model, caller)
|
||||||
|
}
|
||||||
|
|
||||||
|
// New creates a new instance of the workspaceMongoAccessor
|
||||||
|
func NewHistory() *workspaceHistoryMongoAccessor {
|
||||||
|
return &workspaceHistoryMongoAccessor{}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *workspaceHistoryMongoAccessor) MapFromWorkspace(w *Workspace) *WorkspaceHistory {
|
||||||
|
wh := &WorkspaceHistory{Workspace: *w}
|
||||||
|
wh.GenerateID()
|
||||||
|
return wh
|
||||||
|
}
|
||||||
@@ -5,6 +5,7 @@ import (
|
|||||||
|
|
||||||
"cloud.o-forge.io/core/oc-lib/dbs"
|
"cloud.o-forge.io/core/oc-lib/dbs"
|
||||||
"cloud.o-forge.io/core/oc-lib/dbs/mongo"
|
"cloud.o-forge.io/core/oc-lib/dbs/mongo"
|
||||||
|
"cloud.o-forge.io/core/oc-lib/models/collaborative_area/shallow_collaborative_area"
|
||||||
"cloud.o-forge.io/core/oc-lib/models/peer"
|
"cloud.o-forge.io/core/oc-lib/models/peer"
|
||||||
"cloud.o-forge.io/core/oc-lib/models/resources/data"
|
"cloud.o-forge.io/core/oc-lib/models/resources/data"
|
||||||
"cloud.o-forge.io/core/oc-lib/models/resources/datacenter"
|
"cloud.o-forge.io/core/oc-lib/models/resources/datacenter"
|
||||||
@@ -12,7 +13,6 @@ import (
|
|||||||
"cloud.o-forge.io/core/oc-lib/models/resources/storage"
|
"cloud.o-forge.io/core/oc-lib/models/resources/storage"
|
||||||
w "cloud.o-forge.io/core/oc-lib/models/resources/workflow"
|
w "cloud.o-forge.io/core/oc-lib/models/resources/workflow"
|
||||||
"cloud.o-forge.io/core/oc-lib/models/utils"
|
"cloud.o-forge.io/core/oc-lib/models/utils"
|
||||||
"cloud.o-forge.io/core/oc-lib/models/workspace/shared/shallow_shared_workspace"
|
|
||||||
"cloud.o-forge.io/core/oc-lib/tools"
|
"cloud.o-forge.io/core/oc-lib/tools"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -30,7 +30,9 @@ func New() *workspaceMongoAccessor {
|
|||||||
// it checks if a workspace with the same name already exists
|
// it checks if a workspace with the same name already exists
|
||||||
func (wfa *workspaceMongoAccessor) DeleteOne(id string) (utils.DBObject, int, error) {
|
func (wfa *workspaceMongoAccessor) DeleteOne(id string) (utils.DBObject, int, error) {
|
||||||
res, code, err := wfa.GenericDeleteOne(id, wfa)
|
res, code, err := wfa.GenericDeleteOne(id, wfa)
|
||||||
wfa.share(res.(*Workspace), true, wfa.Caller) // Share the deletion to the peers
|
if code == 200 && res != nil {
|
||||||
|
wfa.share(res.(*Workspace), tools.DELETE, wfa.Caller) // Share the deletion to the peers
|
||||||
|
}
|
||||||
return res, code, err
|
return res, code, err
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -54,7 +56,9 @@ func (wfa *workspaceMongoAccessor) UpdateOne(set utils.DBObject, id string) (uti
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
res, code, err := wfa.GenericUpdateOne(set, id, wfa, &Workspace{})
|
res, code, err := wfa.GenericUpdateOne(set, id, wfa, &Workspace{})
|
||||||
wfa.share(res.(*Workspace), false, wfa.Caller)
|
if code == 200 && res != nil {
|
||||||
|
wfa.share(res.(*Workspace), tools.PUT, wfa.Caller)
|
||||||
|
}
|
||||||
return res, code, err
|
return res, code, err
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -200,26 +204,28 @@ func (wfa *workspaceMongoAccessor) Search(filters *dbs.Filters, search string) (
|
|||||||
/*
|
/*
|
||||||
This function is used to share the workspace with the peers
|
This function is used to share the workspace with the peers
|
||||||
*/
|
*/
|
||||||
func (wfa *workspaceMongoAccessor) share(realData *Workspace, delete bool, caller *tools.HTTPCaller) {
|
func (wfa *workspaceMongoAccessor) share(realData *Workspace, method tools.METHOD, caller *tools.HTTPCaller) {
|
||||||
if realData.Shared == "" {
|
if realData.Shared == "" || caller.Disabled {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
access := (&shallow_shared_workspace.ShallowSharedWorkspace{}).GetAccessor(nil)
|
access := (&shallow_collaborative_area.ShallowCollaborativeArea{}).GetAccessor(nil)
|
||||||
res, code, _ := access.LoadOne(realData.Shared)
|
res, code, _ := access.LoadOne(realData.Shared)
|
||||||
if code != 200 {
|
if code != 200 {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
var err error
|
var err error
|
||||||
paccess := &peer.Peer{}
|
paccess := &peer.Peer{}
|
||||||
for _, p := range res.(*shallow_shared_workspace.ShallowSharedWorkspace).Peers {
|
for _, p := range res.(*shallow_collaborative_area.ShallowCollaborativeArea).Peers {
|
||||||
paccess.UUID = p
|
paccess.UUID = p
|
||||||
if paccess.IsMySelf() { // If the peer is the current peer, never share because it will create a loop
|
if paccess.IsMySelf() { // If the peer is the current peer, never share because it will create a loop
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if delete { // If the workspace is deleted, share the deletion
|
if method == tools.DELETE { // If the workspace is deleted, share the deletion
|
||||||
_, err = paccess.LaunchPeerExecution(p, res.GetID(), utils.WORKSPACE, tools.DELETE, map[string]interface{}{}, caller)
|
history := NewHistory()
|
||||||
|
history.StoreOne(history.MapFromWorkspace(res.(*Workspace)))
|
||||||
|
_, err = paccess.LaunchPeerExecution(p, res.GetID(), tools.WORKSPACE, tools.DELETE, map[string]interface{}{}, caller)
|
||||||
} else { // If the workspace is updated, share the update
|
} else { // If the workspace is updated, share the update
|
||||||
_, err = paccess.LaunchPeerExecution(p, res.GetID(), utils.WORKSPACE, tools.PUT, res.Serialize(), caller)
|
_, err = paccess.LaunchPeerExecution(p, res.GetID(), tools.WORKSPACE, tools.PUT, res.Serialize(), caller)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
BIN
swagger/favicon-16x16.png
Normal file
BIN
swagger/favicon-16x16.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 665 B |
BIN
swagger/favicon-32x32.png
Normal file
BIN
swagger/favicon-32x32.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 628 B |
60
swagger/index.html
Normal file
60
swagger/index.html
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
<!-- HTML for static distribution bundle build -->
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>Swagger UI</title>
|
||||||
|
<link rel="stylesheet" type="text/css" href="./swagger-ui.css" />
|
||||||
|
<link rel="icon" type="image/png" href="./favicon-32x32.png" sizes="32x32" />
|
||||||
|
<link rel="icon" type="image/png" href="./favicon-16x16.png" sizes="16x16" />
|
||||||
|
<style>
|
||||||
|
html
|
||||||
|
{
|
||||||
|
box-sizing: border-box;
|
||||||
|
overflow: -moz-scrollbars-vertical;
|
||||||
|
overflow-y: scroll;
|
||||||
|
}
|
||||||
|
|
||||||
|
*,
|
||||||
|
*:before,
|
||||||
|
*:after
|
||||||
|
{
|
||||||
|
box-sizing: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
body
|
||||||
|
{
|
||||||
|
margin:0;
|
||||||
|
background: #fafafa;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<div id="swagger-ui"></div>
|
||||||
|
|
||||||
|
<script src="./swagger-ui-bundle.js" charset="UTF-8"> </script>
|
||||||
|
<script src="./swagger-ui-standalone-preset.js" charset="UTF-8"> </script>
|
||||||
|
<script>
|
||||||
|
window.onload = function() {
|
||||||
|
// Begin Swagger UI call region
|
||||||
|
const ui = SwaggerUIBundle({
|
||||||
|
url: "https://petstore.swagger.io/v2/swagger.json",
|
||||||
|
dom_id: '#swagger-ui',
|
||||||
|
deepLinking: true,
|
||||||
|
presets: [
|
||||||
|
SwaggerUIBundle.presets.apis,
|
||||||
|
SwaggerUIStandalonePreset
|
||||||
|
],
|
||||||
|
plugins: [
|
||||||
|
SwaggerUIBundle.plugins.DownloadUrl
|
||||||
|
],
|
||||||
|
layout: "StandaloneLayout"
|
||||||
|
});
|
||||||
|
// End Swagger UI call region
|
||||||
|
|
||||||
|
window.ui = ui;
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
79
swagger/oauth2-redirect.html
Normal file
79
swagger/oauth2-redirect.html
Normal file
@@ -0,0 +1,79 @@
|
|||||||
|
<!doctype html>
|
||||||
|
<html lang="en-US">
|
||||||
|
<head>
|
||||||
|
<title>Swagger UI: OAuth2 Redirect</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<script>
|
||||||
|
'use strict';
|
||||||
|
function run () {
|
||||||
|
var oauth2 = window.opener.swaggerUIRedirectOauth2;
|
||||||
|
var sentState = oauth2.state;
|
||||||
|
var redirectUrl = oauth2.redirectUrl;
|
||||||
|
var isValid, qp, arr;
|
||||||
|
|
||||||
|
if (/code|token|error/.test(window.location.hash)) {
|
||||||
|
qp = window.location.hash.substring(1);
|
||||||
|
} else {
|
||||||
|
qp = location.search.substring(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
arr = qp.split("&");
|
||||||
|
arr.forEach(function (v,i,_arr) { _arr[i] = '"' + v.replace('=', '":"') + '"';});
|
||||||
|
qp = qp ? JSON.parse('{' + arr.join() + '}',
|
||||||
|
function (key, value) {
|
||||||
|
return key === "" ? value : decodeURIComponent(value);
|
||||||
|
}
|
||||||
|
) : {};
|
||||||
|
|
||||||
|
isValid = qp.state === sentState;
|
||||||
|
|
||||||
|
if ((
|
||||||
|
oauth2.auth.schema.get("flow") === "accessCode" ||
|
||||||
|
oauth2.auth.schema.get("flow") === "authorizationCode" ||
|
||||||
|
oauth2.auth.schema.get("flow") === "authorization_code"
|
||||||
|
) && !oauth2.auth.code) {
|
||||||
|
if (!isValid) {
|
||||||
|
oauth2.errCb({
|
||||||
|
authId: oauth2.auth.name,
|
||||||
|
source: "auth",
|
||||||
|
level: "warning",
|
||||||
|
message: "Authorization may be unsafe, passed state was changed in server Passed state wasn't returned from auth server"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (qp.code) {
|
||||||
|
delete oauth2.state;
|
||||||
|
oauth2.auth.code = qp.code;
|
||||||
|
oauth2.callback({auth: oauth2.auth, redirectUrl: redirectUrl});
|
||||||
|
} else {
|
||||||
|
let oauthErrorMsg;
|
||||||
|
if (qp.error) {
|
||||||
|
oauthErrorMsg = "["+qp.error+"]: " +
|
||||||
|
(qp.error_description ? qp.error_description+ ". " : "no accessCode received from the server. ") +
|
||||||
|
(qp.error_uri ? "More info: "+qp.error_uri : "");
|
||||||
|
}
|
||||||
|
|
||||||
|
oauth2.errCb({
|
||||||
|
authId: oauth2.auth.name,
|
||||||
|
source: "auth",
|
||||||
|
level: "error",
|
||||||
|
message: oauthErrorMsg || "[Authorization failed]: no accessCode received from the server"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
oauth2.callback({auth: oauth2.auth, token: qp, isValid: isValid, redirectUrl: redirectUrl});
|
||||||
|
}
|
||||||
|
window.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (document.readyState !== 'loading') {
|
||||||
|
run();
|
||||||
|
} else {
|
||||||
|
document.addEventListener('DOMContentLoaded', function () {
|
||||||
|
run();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
3
swagger/swagger-ui-bundle.js
Normal file
3
swagger/swagger-ui-bundle.js
Normal file
File diff suppressed because one or more lines are too long
1
swagger/swagger-ui-bundle.js.map
Normal file
1
swagger/swagger-ui-bundle.js.map
Normal file
File diff suppressed because one or more lines are too long
2
swagger/swagger-ui-es-bundle-core.js
Normal file
2
swagger/swagger-ui-es-bundle-core.js
Normal file
File diff suppressed because one or more lines are too long
3
swagger/swagger-ui-es-bundle.js
Normal file
3
swagger/swagger-ui-es-bundle.js
Normal file
File diff suppressed because one or more lines are too long
3
swagger/swagger-ui-standalone-preset.js
Normal file
3
swagger/swagger-ui-standalone-preset.js
Normal file
File diff suppressed because one or more lines are too long
1
swagger/swagger-ui-standalone-preset.js.map
Normal file
1
swagger/swagger-ui-standalone-preset.js.map
Normal file
File diff suppressed because one or more lines are too long
4
swagger/swagger-ui.css
Normal file
4
swagger/swagger-ui.css
Normal file
File diff suppressed because one or more lines are too long
1
swagger/swagger-ui.css.map
Normal file
1
swagger/swagger-ui.css.map
Normal file
File diff suppressed because one or more lines are too long
2
swagger/swagger-ui.js
Normal file
2
swagger/swagger-ui.js
Normal file
File diff suppressed because one or more lines are too long
1
swagger/swagger-ui.js.map
Normal file
1
swagger/swagger-ui.js.map
Normal file
File diff suppressed because one or more lines are too long
@@ -73,7 +73,7 @@ func (a *API) GetState() (State, int, error) {
|
|||||||
// CheckRemotePeer checks the state of a remote peer
|
// CheckRemotePeer checks the state of a remote peer
|
||||||
func (a *API) CheckRemotePeer(url string) (State, map[string]int) {
|
func (a *API) CheckRemotePeer(url string) (State, map[string]int) {
|
||||||
// Check if the database is up
|
// Check if the database is up
|
||||||
caller := NewHTTPCaller(map[string]map[METHOD]string{}) // Create a new http caller
|
caller := NewHTTPCaller(map[DataType]map[METHOD]string{}) // Create a new http caller
|
||||||
var resp APIStatusResponse
|
var resp APIStatusResponse
|
||||||
b, err := caller.CallPost(url, "/status", map[string]interface{}{}) // Call the status endpoint of the peer
|
b, err := caller.CallPost(url, "/status", map[string]interface{}{}) // Call the status endpoint of the peer
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -94,7 +94,7 @@ func (a *API) CheckRemotePeer(url string) (State, map[string]int) {
|
|||||||
func (a *API) CheckRemoteAPIs(urls map[string]string) (State, map[string]string, error) {
|
func (a *API) CheckRemoteAPIs(urls map[string]string) (State, map[string]string, error) {
|
||||||
// Check if the database is up
|
// Check if the database is up
|
||||||
new := map[string]string{}
|
new := map[string]string{}
|
||||||
caller := NewHTTPCaller(map[string]map[METHOD]string{}) // Create a new http caller
|
caller := NewHTTPCaller(map[DataType]map[METHOD]string{}) // Create a new http caller
|
||||||
code := 0
|
code := 0
|
||||||
e := ""
|
e := ""
|
||||||
state := ALIVE
|
state := ALIVE
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
package utils
|
package tools
|
||||||
|
|
||||||
type DataType int
|
type DataType int
|
||||||
|
|
||||||
@@ -15,27 +15,39 @@ const (
|
|||||||
WORKSPACE
|
WORKSPACE
|
||||||
RESOURCE_MODEL
|
RESOURCE_MODEL
|
||||||
PEER
|
PEER
|
||||||
SHARED_WORKSPACE
|
COLLABORATIVE_AREA
|
||||||
RULE
|
RULE
|
||||||
BOOKING
|
BOOKING
|
||||||
|
WORKFLOW_HISTORY
|
||||||
|
WORKSPACE_HISTORY
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var NOAPI = ""
|
||||||
|
var CATALOGAPI = "oc-catalog"
|
||||||
|
var SHAREDAPI = "oc-shared"
|
||||||
|
var WORKFLOWAPI = "oc-workflow"
|
||||||
|
var WORKSPACEAPI = "oc-workspace"
|
||||||
|
var PEERSAPI = "oc-peers"
|
||||||
|
var DATACENTERAPI = "oc-datacenter"
|
||||||
|
|
||||||
// Bind the standard API name to the data type
|
// Bind the standard API name to the data type
|
||||||
var DefaultAPI = [...]string{
|
var DefaultAPI = [...]string{
|
||||||
"",
|
NOAPI,
|
||||||
"oc-catalog",
|
CATALOGAPI,
|
||||||
"oc-catalog",
|
CATALOGAPI,
|
||||||
"oc-catalog",
|
CATALOGAPI,
|
||||||
"oc-catalog",
|
CATALOGAPI,
|
||||||
"oc-catalog",
|
CATALOGAPI,
|
||||||
"oc-workflow",
|
WORKFLOWAPI,
|
||||||
"",
|
NOAPI,
|
||||||
"oc-workspace",
|
WORKSPACEAPI,
|
||||||
"",
|
NOAPI,
|
||||||
"oc-peers",
|
PEERSAPI,
|
||||||
"oc-shared",
|
SHAREDAPI,
|
||||||
"oc-shared",
|
SHAREDAPI,
|
||||||
"oc-datacenter",
|
DATACENTERAPI,
|
||||||
|
NOAPI,
|
||||||
|
NOAPI,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Bind the standard data name to the data type
|
// Bind the standard data name to the data type
|
||||||
@@ -54,6 +66,8 @@ var Str = [...]string{
|
|||||||
"shared_workspace",
|
"shared_workspace",
|
||||||
"rule",
|
"rule",
|
||||||
"booking",
|
"booking",
|
||||||
|
"workflow_history",
|
||||||
|
"workspace_history",
|
||||||
}
|
}
|
||||||
|
|
||||||
func FromInt(i int) string {
|
func FromInt(i int) string {
|
||||||
@@ -40,13 +40,15 @@ func ToMethod(str string) METHOD {
|
|||||||
var HTTPCallerInstance = &HTTPCaller{} // Singleton instance of the HTTPCaller
|
var HTTPCallerInstance = &HTTPCaller{} // Singleton instance of the HTTPCaller
|
||||||
|
|
||||||
type HTTPCaller struct {
|
type HTTPCaller struct {
|
||||||
URLS map[string]map[METHOD]string // Map of the different methods and their urls
|
URLS map[DataType]map[METHOD]string // Map of the different methods and their urls
|
||||||
|
Disabled bool // Disabled flag
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewHTTPCaller creates a new instance of the HTTP Caller
|
// NewHTTPCaller creates a new instance of the HTTP Caller
|
||||||
func NewHTTPCaller(urls map[string]map[METHOD]string) *HTTPCaller {
|
func NewHTTPCaller(urls map[DataType]map[METHOD]string) *HTTPCaller {
|
||||||
return &HTTPCaller{
|
return &HTTPCaller{
|
||||||
URLS: urls, // Set the urls defined in the config & based on the data name type & method
|
URLS: urls, // Set the urls defined in the config & based on the data name type & method
|
||||||
|
Disabled: false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
BIN
~/.vscode-root/Cache/Cache_Data/15651df7a7ad0fa5_0
Normal file
BIN
~/.vscode-root/Cache/Cache_Data/15651df7a7ad0fa5_0
Normal file
Binary file not shown.
BIN
~/.vscode-root/Cache/Cache_Data/5283edf90cf4ab50_0
Normal file
BIN
~/.vscode-root/Cache/Cache_Data/5283edf90cf4ab50_0
Normal file
Binary file not shown.
BIN
~/.vscode-root/Cache/Cache_Data/a97c96d98c7c4739_0
Normal file
BIN
~/.vscode-root/Cache/Cache_Data/a97c96d98c7c4739_0
Normal file
Binary file not shown.
BIN
~/.vscode-root/Cache/Cache_Data/d121e2a6335b7510_0
Normal file
BIN
~/.vscode-root/Cache/Cache_Data/d121e2a6335b7510_0
Normal file
Binary file not shown.
BIN
~/.vscode-root/Cache/Cache_Data/fe88ee4465dbfb2c_0
Normal file
BIN
~/.vscode-root/Cache/Cache_Data/fe88ee4465dbfb2c_0
Normal file
Binary file not shown.
BIN
~/.vscode-root/Cache/Cache_Data/index
Normal file
BIN
~/.vscode-root/Cache/Cache_Data/index
Normal file
Binary file not shown.
BIN
~/.vscode-root/Cache/Cache_Data/index-dir/the-real-index
Normal file
BIN
~/.vscode-root/Cache/Cache_Data/index-dir/the-real-index
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user