updatet license, added file api docs

This commit is contained in:
2026-03-29 18:36:16 +02:00
parent 31fcdca726
commit 4484d762c2
12 changed files with 322 additions and 82 deletions
+1 -1
View File
@@ -23,4 +23,4 @@ RUN touch /app/etc/mstore/mstored.yaml
WORKDIR /app
#USER daemon:daemon
ENTRYPOINT ["/app/sbin/mstored", "--asDaemon=false", "--port=1025"]
ENTRYPOINT ["/app/sbin/mstored", "--asDaemon=false"]
-42
View File
@@ -1,42 +0,0 @@
Данный сервис был написан мной в целях представить простой в развертывании, модификации и
использовании сервис хранения артефактов.
Прежде всего образов контейнеров и helm charts. Я не претендовал и не претендую на
коммерческий продукт в широком публичном испльзовании.
Он успешно испытан при создании k8s кластеров и развертывании приложений в нем.
В этом продукте представлено три условных протокола взаимодействия:
1 Это протокол передачи компонент образов контейнеров,
выросший из протокола, придуманном неким человеком в Docker.com.
У меня много вопросов к нему (к ним?). И предполагаю что некоторые будут
содержать преимуществнно обсценную лекcику, к которой пришел
в процессе реализации протокола.
Предволожительно и по содержанию первой версии docker сервиса,
это протокол, созданный начинающим в професиии человеком и знающим только HTTP.
Но интегрированный в деловые процессы он стал основой де-факто,
судя по всему без значительных попыток пересмотра.
Кодирование состояний приложения в коды HTTP считаю возможным, есть и более страннные подходы.
Но это как будто к тебе присылают немого курьера в красной куртке, что бы сообщить
что твоя посылка потеряна.
Позднее этот протокол был несколько облагорожен и получил статус и редакцию
стандарта от Open Container Initiative.
Его реализации разнятся по содержанию и поведению, и по моим приблизительным оценкам,
совпадают с опубликованными спецификациями где-то на две трети,
даже в части обязательных указаний.
2 Созданнный в стиле первого, протокол передачи файлов и чартов. Фактически
ограничен реализацией протокола в утилите helm.
3 Протол управления аккаунтами и разрешениями сервиса. Он сделан по мотивам
JSON RPC и относительно независим от транспортной среды. Относительно незавивисим,
поскольку тип субьекта и операция с ним кодируются в пути запроса.
Этот подход с одной стороны относительно привычен для многих.
С другой стороны, мы не ограничены параметрами запросов и ответов, и ограничены
только границами json формализмов и сериализации.
+116 -24
View File
@@ -1,11 +1,67 @@
Creative Commons Attribution-NonCommercial-NoDerivatives 4.0
International Public License
Attribution-NonCommercial-ShareAlike 4.0 International
=======================================================================
Creative Commons Corporation ("Creative Commons") is not a law firm and
does not provide legal services or legal advice. Distribution of
Creative Commons public licenses does not create a lawyer-client or
other relationship. Creative Commons makes its licenses and related
information available on an "as-is" basis. Creative Commons gives no
warranties regarding its licenses, any material licensed under their
terms and conditions, or any related information. Creative Commons
disclaims all liability for damages resulting from their use to the
fullest extent possible.
Using Creative Commons Public Licenses
Creative Commons public licenses provide a standard set of terms and
conditions that creators and other rights holders may use to share
original works of authorship and other material subject to copyright
and certain other rights specified in the public license below. The
following considerations are for informational purposes only, are not
exhaustive, and do not form part of our licenses.
Considerations for licensors: Our public licenses are
intended for use by those authorized to give the public
permission to use material in ways otherwise restricted by
copyright and certain other rights. Our licenses are
irrevocable. Licensors should read and understand the terms
and conditions of the license they choose before applying it.
Licensors should also secure all rights necessary before
applying our licenses so that the public can reuse the
material as expected. Licensors should clearly mark any
material not subject to the license. This includes other CC-
licensed material, or material used under an exception or
limitation to copyright. More considerations for licensors:
wiki.creativecommons.org/Considerations_for_licensors
Considerations for the public: By using one of our public
licenses, a licensor grants the public permission to use the
licensed material under specified terms and conditions. If
the licensor's permission is not necessary for any reason--for
example, because of any applicable exception or limitation to
copyright--then that use is not regulated by the license. Our
licenses grant only permissions under copyright and certain
other rights that a licensor has authority to grant. Use of
the licensed material may still be restricted for other
reasons, including because others have copyright or other
rights in the material. A licensor may make special requests,
such as asking that all changes be marked or described.
Although not required by our licenses, you are encouraged to
respect those requests where reasonable. More considerations
for the public:
wiki.creativecommons.org/Considerations_for_licensees
=======================================================================
Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International
Public License
By exercising the Licensed Rights (defined below), You accept and agree
to be bound by the terms and conditions of this Creative Commons
Attribution-NonCommercial-NoDerivatives 4.0 International Public
License ("Public License"). To the extent this Public License may be
Attribution-NonCommercial-ShareAlike 4.0 International Public License
("Public License"). To the extent this Public License may be
interpreted as a contract, You are granted the Licensed Rights in
consideration of Your acceptance of these terms and conditions, and the
Licensor grants You such rights in consideration of benefits the
@@ -25,7 +81,15 @@ Section 1 -- Definitions.
Adapted Material is always produced where the Licensed Material is
synched in timed relation with a moving image.
b. Copyright and Similar Rights means copyright and/or similar rights
b. Adapter's License means the license You apply to Your Copyright
and Similar Rights in Your contributions to Adapted Material in
accordance with the terms and conditions of this Public License.
c. BY-NC-SA Compatible License means a license listed at
creativecommons.org/compatiblelicenses, approved by Creative
Commons as essentially the equivalent of this Public License.
d. Copyright and Similar Rights means copyright and/or similar rights
closely related to copyright including, without limitation,
performance, broadcast, sound recording, and Sui Generis Database
Rights, without regard to how the rights are labeled or
@@ -33,29 +97,33 @@ Section 1 -- Definitions.
specified in Section 2(b)(1)-(2) are not Copyright and Similar
Rights.
c. Effective Technological Measures means those measures that, in the
e. Effective Technological Measures means those measures that, in the
absence of proper authority, may not be circumvented under laws
fulfilling obligations under Article 11 of the WIPO Copyright
Treaty adopted on December 20, 1996, and/or similar international
agreements.
d. Exceptions and Limitations means fair use, fair dealing, and/or
f. Exceptions and Limitations means fair use, fair dealing, and/or
any other exception or limitation to Copyright and Similar Rights
that applies to Your use of the Licensed Material.
e. Licensed Material means the artistic or literary work, database,
g. License Elements means the license attributes listed in the name
of a Creative Commons Public License. The License Elements of this
Public License are Attribution, NonCommercial, and ShareAlike.
h. Licensed Material means the artistic or literary work, database,
or other material to which the Licensor applied this Public
License.
f. Licensed Rights means the rights granted to You subject to the
i. Licensed Rights means the rights granted to You subject to the
terms and conditions of this Public License, which are limited to
all Copyright and Similar Rights that apply to Your use of the
Licensed Material and that the Licensor has authority to license.
g. Licensor means the individual(s) or entity(ies) granting rights
j. Licensor means the individual(s) or entity(ies) granting rights
under this Public License.
h. NonCommercial means not primarily intended for or directed towards
k. NonCommercial means not primarily intended for or directed towards
commercial advantage or monetary compensation. For purposes of
this Public License, the exchange of the Licensed Material for
other material subject to Copyright and Similar Rights by digital
@@ -63,7 +131,7 @@ Section 1 -- Definitions.
no payment of monetary compensation in connection with the
exchange.
i. Share means to provide material to the public by any means or
l. Share means to provide material to the public by any means or
process that requires permission under the Licensed Rights, such
as reproduction, public display, public performance, distribution,
dissemination, communication, or importation, and to make material
@@ -71,13 +139,13 @@ Section 1 -- Definitions.
public may access the material from a place and at a time
individually chosen by them.
j. Sui Generis Database Rights means rights other than copyright
m. Sui Generis Database Rights means rights other than copyright
resulting from Directive 96/9/EC of the European Parliament and of
the Council of 11 March 1996 on the legal protection of databases,
as amended and/or succeeded, as well as other essentially
equivalent rights anywhere in the world.
k. You means the individual or entity exercising the Licensed Rights
n. You means the individual or entity exercising the Licensed Rights
under this Public License. Your has a corresponding meaning.
@@ -93,8 +161,8 @@ Section 2 -- Scope.
a. reproduce and Share the Licensed Material, in whole or
in part, for NonCommercial purposes only; and
b. produce and reproduce, but not Share, Adapted Material
for NonCommercial purposes only.
b. produce, reproduce, and Share Adapted Material for
NonCommercial purposes only.
2. Exceptions and Limitations. For the avoidance of doubt, where
Exceptions and Limitations apply to Your use, this Public
@@ -124,7 +192,13 @@ Section 2 -- Scope.
Licensed Rights under the terms and conditions of this
Public License.
b. No downstream restrictions. You may not offer or impose
b. Additional offer from the Licensor -- Adapted Material.
Every recipient of Adapted Material from You
automatically receives an offer from the Licensor to
exercise the Licensed Rights in the Adapted Material
under the conditions of the Adapter's License You apply.
c. No downstream restrictions. You may not offer or impose
any additional or different terms or conditions on, or
apply any Effective Technological Measures to, the
Licensed Material if doing so restricts exercise of the
@@ -168,7 +242,8 @@ following conditions.
a. Attribution.
1. If You Share the Licensed Material, You must:
1. If You Share the Licensed Material (including in modified
form), You must:
a. retain the following if it is supplied by the Licensor
with the Licensed Material:
@@ -196,20 +271,35 @@ following conditions.
Public License, and include the text of, or the URI or
hyperlink to, this Public License.
For the avoidance of doubt, You do not have permission under
this Public License to Share Adapted Material.
2. You may satisfy the conditions in Section 3(a)(1) in any
reasonable manner based on the medium, means, and context in
which You Share the Licensed Material. For example, it may be
reasonable to satisfy the conditions by providing a URI or
hyperlink to a resource that includes the required
information.
3. If requested by the Licensor, You must remove any of the
information required by Section 3(a)(1)(A) to the extent
reasonably practicable.
b. ShareAlike.
In addition to the conditions in Section 3(a), if You Share
Adapted Material You produce, the following conditions also apply.
1. The Adapter's License You apply must be a Creative Commons
license with the same License Elements, this version or
later, or a BY-NC-SA Compatible License.
2. You must include the text of, or the URI or hyperlink to, the
Adapter's License You apply. You may satisfy this condition
in any reasonable manner based on the medium, means, and
context in which You Share Adapted Material.
3. You may not offer or impose any additional or different terms
or conditions on, or apply any Effective Technological
Measures to, Adapted Material that restrict exercise of the
rights granted under the Adapter's License You apply.
Section 4 -- Sui Generis Database Rights.
@@ -219,12 +309,13 @@ apply to Your use of the Licensed Material:
a. for the avoidance of doubt, Section 2(a)(1) grants You the right
to extract, reuse, reproduce, and Share all or a substantial
portion of the contents of the database for NonCommercial purposes
only and provided You do not Share Adapted Material;
only;
b. if You include all or a substantial portion of the database
contents in a database in which You have Sui Generis Database
Rights, then the database in which You have Sui Generis Database
Rights (but not its individual contents) is Adapted Material; and
Rights (but not its individual contents) is Adapted Material,
including for purposes of Section 3(b); and
c. You must comply with the conditions in Section 3(a) if You Share
all or a substantial portion of the contents of the database.
@@ -345,3 +436,4 @@ the avoidance of doubt, this paragraph does not form part of the
public licenses.
Creative Commons may be contacted at creativecommons.org.
+13
View File
@@ -370,3 +370,16 @@ distclean-local:
rm -rf autom4te.cache
rm -rf $(DIST_DIR)
rm -rf tmp/
SWAG_OUTDIR = ./
SWAG_OPTS = --parseDependency \
--parseDepth 3 \
--exclude pkg,vendor \
--outputTypes yaml \
--output $(SWAG_OUTDIR)
apidoc:
mkdir -p $(SWAG_OUTDIR)
$(SWAG) init $(SWAG_OPTS) -g ./cmd/mstored/main.go
+12
View File
@@ -289,6 +289,7 @@ SHELL = @SHELL@
SORT = @SORT@
STRIP = @STRIP@
SUDO = @SUDO@
SWAG = @SWAG@
UNIQ = @UNIQ@
VERSION = @VERSION@
XARGS = @XARGS@
@@ -541,6 +542,13 @@ CHART_NAME = $(PACKAGE_NAME)-$(PACKAGE_VERSION).tgz
FREEBSD_LOCALBASE = /usr/local
FREEBSD_RCDIR = $(FREEBSD_LOCALBASE)/etc/rc.d
LINUX_SYSTEMDDIR = /lib/systemd/system
SWAG_OUTDIR = ./
SWAG_OPTS = --parseDependency \
--parseDepth 3 \
--exclude pkg,vendor \
--outputTypes yaml \
--output $(SWAG_OUTDIR)
all: all-recursive
.SUFFIXES:
@@ -1202,6 +1210,10 @@ distclean-local:
rm -rf $(DIST_DIR)
rm -rf tmp/
apidoc:
mkdir -p $(SWAG_OUTDIR)
$(SWAG) init $(SWAG_OPTS) -g ./cmd/mstored/main.go
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
+26 -10
View File
@@ -11,11 +11,22 @@ With the application you can store and share
Copyright 2026 Oleg Borodin <onborodin@gmail.com>
This work is published and licensed under a Creative Commons
Attribution-NonCommercial-NoDerivatives 4.0 International License.
This work is published and licensed under a Creative CommonsAttribution-NonCommercial-ShareAlike 4.0 International License.
Distribution of this work is permitted, but commercial use and
modifications are strictly prohibited.
* Attribution — You must give appropriate credit,
provide a link to the license, and indicate if changes
were made. You may do so in any reasonable manner,
but not in any way that suggests the licensor endorses
you or your use.
* NonCommercial — You may not use the material for commercial purposes.
* ShareAlike — If you remix, transform, or build upon the material,
you must distribute your contributions under the same license
as the original.
Distribution of this work is permitted, but commercial usu are
strictly prohibited.
## Copyright RU
@@ -24,16 +35,21 @@ modifications are strictly prohibited.
Это произведение распространяется под лицензией Creative Commons
Attribution-NonCommercial-NoDerivatives 4.0 International License
Разрешается распространение, но запрещаются коммерческое использование
и изменения данного произведения.
Разрешается распространение, при условии указания автора, произведенных изменений
и сохранении лицензии, но запрещаются коммерческое использование
данного произведения.
Вы можете свободно делиться, то есть копировать, распространять и передавать
другим лицам данное произведение при обязательном соблюдении следующих условий:
* Атрибуция: Вы должны атрибутировать произведение (указывать автора и источник)
в порядке, предусмотренном автором или лицензиаром.
* Некоммерческое использование: Вы не можете использовать это произведение
в коммерческих целях.
* Без производных произведений: Вы не можете изменять, преобразовывать или брать
за основу это произведение.
* Некоммерческое использование: Вы не можете использовать это произведение
в коммерческих целях, в целях получения выгоды или оплаты.
* Распостранять аналогично: Если вы перерабатываете, преобразуете или
создаете производные произведения на основе данного материала,
вы должны распространять свои результаты на условиях той же лицензии,
что и оригинал.
+73
View File
@@ -14,6 +14,19 @@ import (
const zeroContentLength = "0"
// GetProperty godoc
//
// @Summary Get file info
// @Description Get file info
// @Tags file
// @Param filepath path string true "File path"
// @Success 200
// @Failure 404,405
// @Router /v3/file/{filepath} [HEAD]
// @Header 200 {int64} Content-Size "File size"
// @Header 200 {string} Content-Digest "File digest"
// @Header 200 {string} Content-Name "File name"
// @Header 200 {string} Content-Collection "File collection"
func (hand *Handler) FileInfo(rctx *router.Context) {
filepath, _ := rctx.GetSubpath("filepath")
@@ -54,6 +67,17 @@ func (hand *Handler) FileInfo(rctx *router.Context) {
rctx.SetStatus(code)
}
// GetProperty godoc
//
// @Summary Store file
// @Description Store file
// @Tags file
// @Param Content-Size header int64 true "File size"
// @Param Content-Type header string true "File type"
// @Param filepath path string true "File path"
// @Success 200
// @Failure 404,405
// @Router /v3/file/{filepath} [PUT]
func (hand *Handler) PutFile(rctx *router.Context) {
contentSize := rctx.GetHeader("Content-Size")
contentType := rctx.GetHeader("Content-Type")
@@ -87,6 +111,17 @@ func (hand *Handler) PutFile(rctx *router.Context) {
rctx.SetStatus(code)
}
// GetProperty godoc
//
// @Summary Get file
// @Description Get file
// @Produce application/octet-stream
// @Produce application/vnd.cncf.helm.chart.content.v1.tar+gzip
// @Tags file
// @Param filepath path string true "File path"
// @Success 200
// @Failure 404,405
// @Router /v3/file/{filepath} [GET]
func (hand *Handler) GetFile(rctx *router.Context) {
filepath, _ := rctx.GetSubpath("filepath")
@@ -135,6 +170,15 @@ func (hand *Handler) GetFile(rctx *router.Context) {
}
}
// GetProperty godoc
//
// @Summary Delete file
// @Description Delete file
// @Tags file
// @Param filepath path string true "File path"
// @Success 200
// @Failure 404,405
// @Router /v3/file/{filepath} [DELETE]
func (hand *Handler) DeleteFile(rctx *router.Context) {
filepath, _ := rctx.GetSubpath("filepath")
@@ -162,6 +206,16 @@ func (hand *Handler) DeleteFile(rctx *router.Context) {
rctx.SetStatus(code)
}
// GetProperty godoc
//
// @Summary List files
// @Description List files
// @Tags file
// @Param path path string true "File path"
// @Success 200 {array} descr.File
// @Failure 404,405
// @Router /v3/files/{path} [GET]
// @Produce application/json
func (hand *Handler) ListFiles(rctx *router.Context) {
filepath, _ := rctx.GetSubpath("filepath")
@@ -200,6 +254,16 @@ func (hand *Handler) ListFiles(rctx *router.Context) {
rctx.SendJSON(code, res.Files)
}
// GetProperty godoc
//
// @Summary List collections
// @Description List collections
// @Tags file
// @Param path path string true "Collection path"
// @Success 200 {array} string
// @Failure 404,405
// @Router /v3/collections/{path} [GET]
// @Produce application/json
func (hand *Handler) ListCollections(rctx *router.Context) {
cpath, _ := rctx.GetSubpath("path")
@@ -237,6 +301,15 @@ func (hand *Handler) ListCollections(rctx *router.Context) {
rctx.SendJSON(code, res.Collections)
}
// GetProperty godoc
//
// @Summary Delete collections
// @Description Delete collections
// @Tags file
// @Param path path string true "Collection path"
// @Success 200
// @Failure 404,405
// @Router /v3/collection/{path} [DELETE]
func (hand *Handler) DeleteCollection(rctx *router.Context) {
cpath, _ := rctx.GetSubpath("path")
+5 -5
View File
@@ -26,12 +26,12 @@ spec:
volumeMounts:
- name: config-volume
mountPath: /app/etc/mstore
# - name: db-volume
# mountPath: /var/lib
- name: db-volume
mountPath: /var/lib
volumes:
- name: config-volume
configMap:
name: mstored-config
# - name: db-volume
# persistentVolumeClaim:
# claimName: mstore-data
- name: db-volume
persistentVolumeClaim:
claimName: mstore-data
+20
View File
@@ -3,11 +3,31 @@
*/
package main
// @title Service API
// @version 1.0
// @description API documentation
// @contact.name API Support
// @contact.url http://www.swagger.io/support
// @contact.email support@swagger.io
// @license.name Apache 2.0
// @license.url http://www.apache.org/licenses/LICENSE-2.0.html
// @query.collection.format multi
// @host localhost
// @basePath /
// @schemes http https
// @query.collection.format multi
import (
"os"
"mstore/app/logger"
"mstore/cmd/mstored/starter"
_ "mstore/app/handler"
)
func main() {
Vendored
+53
View File
@@ -631,6 +631,7 @@ build_vendor
build_cpu
build
CP
SWAG
DPKGSOURCE
DBUILDPACKAGE
HELM
@@ -3404,6 +3405,58 @@ fi
test -n "$DPKGSOURCE" && break
done
for ac_prog in swag true
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
printf %s "checking for $ac_word... " >&6; }
if test ${ac_cv_path_SWAG+y}
then :
printf %s "(cached) " >&6
else case e in #(
e) case $SWAG in
[\\/]* | ?:[\\/]*)
ac_cv_path_SWAG="$SWAG" # Let the user override the test with a path.
;;
*)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
case $as_dir in #(((
'') as_dir=./ ;;
*/) ;;
*) as_dir=$as_dir/ ;;
esac
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
ac_cv_path_SWAG="$as_dir$ac_word$ac_exec_ext"
printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
;;
esac ;;
esac
fi
SWAG=$ac_cv_path_SWAG
if test -n "$SWAG"; then
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $SWAG" >&5
printf "%s\n" "$SWAG" >&6; }
else
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
printf "%s\n" "no" >&6; }
fi
test -n "$SWAG" && break
done
for ac_prog in gcp cp
do
+2
View File
@@ -22,6 +22,8 @@ AC_PATH_PROGS([PODMAN],[podman true])
AC_PATH_PROGS([HELM],[helm true])
AC_PATH_PROGS([DBUILDPACKAGE],[dpkg-buildpackage true])
AC_PATH_PROGS([DPKGSOURCE],[dpkg-source true])
AC_PATH_PROGS([SWAG],[swag true])
AC_PATH_PROGS([CP],[gcp cp])
if test -z "$CP"; then
+1
View File
@@ -202,6 +202,7 @@ SHELL = @SHELL@
SORT = @SORT@
STRIP = @STRIP@
SUDO = @SUDO@
SWAG = @SWAG@
UNIQ = @UNIQ@
VERSION = @VERSION@
XARGS = @XARGS@