all repos — homestead @ a9f47f4e4ed3223e86dc1d5c3edd005b8d9ce589

Code for my website

internal/storage/interface.go (view raw)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
package storage

import (
	"gitlab.com/tozd/go/errors"
	"go.alanpearce.eu/homestead/internal/buffer"
	"go.alanpearce.eu/homestead/internal/content"
)

type Reader interface {
	GetFile(path string) (*File, errors.E)
	CanonicalisePath(path string) (string, bool)
}

type Writer interface {
	Mkdirp(path string) errors.E

	NewFileFromPost(post *content.Post) *File

	Write(pathname string, title string, content *buffer.Buffer) errors.E
	WritePost(post *content.Post, content *buffer.Buffer) errors.E
	WriteFile(file *File, content *buffer.Buffer) errors.E
}